]> git.ipfire.org Git - thirdparty/dovecot/core.git/commitdiff
doveadm director ring status: Add more fields related to connection status
authorTimo Sirainen <timo.sirainen@dovecot.fi>
Thu, 26 Oct 2017 11:10:51 +0000 (14:10 +0300)
committerTimo Sirainen <timo.sirainen@dovecot.fi>
Tue, 7 Nov 2017 19:14:18 +0000 (21:14 +0200)
src/director/doveadm-connection.c
src/doveadm/doveadm-director.c

index a6ac0ad2afc754336e8d9ac323259a368e14d761..1fb2ef777b650a66244fed33ab240a751486b872 100644 (file)
@@ -155,18 +155,29 @@ 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"
+                   "%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
index 1981eafba120860af20c8b68000906f3d8edb8b6..4914b9be005531e6146a96b5a624a6d7e30f65be 100644 (file)
@@ -872,26 +872,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)