From: Timo Sirainen Date: Thu, 26 Oct 2017 11:10:51 +0000 (+0300) Subject: doveadm director ring status: Add more fields related to connection status X-Git-Tag: 2.3.0.rc1~617 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=cb3f509b91af4e9cb65ce7acbbba8a335494d6d6;p=thirdparty%2Fdovecot%2Fcore.git doveadm director ring status: Add more fields related to connection status --- diff --git a/src/director/doveadm-connection.c b/src/director/doveadm-connection.c index 9e4a02f6df..db3985f386 100644 --- a/src/director/doveadm-connection.c +++ b/src/director/doveadm-connection.c @@ -154,18 +154,28 @@ static void doveadm_director_append_status(struct director *dir, string_t *str) 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" + "%"PRIdTIME_T"\t%"PRIdTIME_T, status.last_ping_msecs, + status.bytes_read, status.bytes_sent, + status.bytes_buffered, status.peak_bytes_buffered, + status.last_input.tv_sec, status.last_output.tv_sec); } static void diff --git a/src/doveadm/doveadm-director.c b/src/doveadm/doveadm-director.c index 9e13faab2c..3afa84ed4b 100644 --- a/src/doveadm/doveadm-director.c +++ b/src/doveadm/doveadm-director.c @@ -887,26 +887,36 @@ static void cmd_director_ring_status(struct doveadm_cmd_context *cctx) 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)