# HG changeset patch # User Timo Sirainen # Date 1509016251 -10800 # Node ID 0170e1657f4de1c64b91e7f2529968b07618a357 # Parent 0281041d5067c8dcdc9d5287d7338ff56f2eb92f doveadm director ring status: Add more fields related to connection status diff -r 0281041d5067 -r 0170e1657f4d src/director/doveadm-connection.c --- a/src/director/doveadm-connection.c Thu Oct 26 14:18:50 2017 +0300 +++ b/src/director/doveadm-connection.c Thu Oct 26 14:10:51 2017 +0300 @@ -155,18 +155,29 @@ str_printfa(str, "syncing - last sync %d secs ago", (int)(ioloop_time - dir->ring_last_sync_time)); } + str_printfa(str, "\t%u", dir->last_sync_msecs); } static void doveadm_director_connection_append_status(struct director_connection *conn, string_t *str) { + struct director_connection_status status; + if (!director_connection_is_handshaked(conn)) str_append(str, "handshaking"); else if (director_connection_is_synced(conn)) str_append(str, "synced"); else str_append(str, "syncing"); + + director_connection_get_status(conn, &status); + str_printfa(str, "\t%u\t%"PRIuUOFF_T"\t%"PRIuUOFF_T"\t%zu\t%zu\t" + "%ld\t%ld", status.last_ping_msecs, + status.bytes_read, status.bytes_sent, + status.bytes_buffered, status.peak_bytes_buffered, + (long)status.last_input.tv_sec, + (long)status.last_output.tv_sec); } static void diff -r 0281041d5067 -r 0170e1657f4d src/doveadm/doveadm-director.c --- a/src/doveadm/doveadm-director.c Thu Oct 26 14:18:50 2017 +0300 +++ b/src/doveadm/doveadm-director.c Thu Oct 26 14:10:51 2017 +0300 @@ -872,26 +872,36 @@ doveadm_print_header_simple("type"); doveadm_print_header_simple("last failed"); doveadm_print_header_simple("status"); + doveadm_print_header_simple("ping ms"); + doveadm_print_header_simple("input"); + doveadm_print_header_simple("output"); + doveadm_print_header_simple("buffered"); + doveadm_print_header_simple("buffered peak"); + doveadm_print_header_simple("last read"); + doveadm_print_header_simple("last write"); director_send(ctx, "DIRECTOR-LIST\n"); while ((line = i_stream_read_next_line(ctx->input)) != NULL) { if (*line == '\0') break; T_BEGIN { + unsigned int i; time_t ts; args = t_strsplit_tabescaped(line); - if (str_array_length(args) >= 5 && - str_to_time(args[3], &ts) == 0) { - doveadm_print(args[0]); - doveadm_print(args[1]); - doveadm_print(args[2]); - if (ts == 0) - doveadm_print("never"); - else - doveadm_print(unixdate2str(ts)); - doveadm_print(args[4]); + for (i = 0; i < 12 && args[i] != NULL; i++) { + if ((i == 3 || i == 10 || i == 11) && + str_to_time(args[i], &ts) == 0) { + if (ts == 0) + doveadm_print("never"); + else + doveadm_print(unixdate2str(ts)); + } else { + doveadm_print(args[i]); + } } + for (; i < 12; i++) + doveadm_print("-"); } T_END; } if (line == NULL)