]> git.ipfire.org Git - thirdparty/haproxy.git/commitdiff
MINOR: mworker/cli: show programs in 'show proc'
authorWilliam Lallemand <wlallemand@haproxy.com>
Mon, 1 Apr 2019 09:30:03 +0000 (11:30 +0200)
committerWilly Tarreau <w@1wt.eu>
Mon, 1 Apr 2019 12:45:37 +0000 (14:45 +0200)
Show the programs in 'show proc'

Example:

# programs
2285            dataplane-api   -               0               0d 00h00m12s
# old programs
2261            dataplane-api   -               1               0d 00h00m53s

src/mworker.c

index d847ee9006f0afeb609e5a3ca63df26750dfb11c..ac5d1a0400fb84e88d13e2d48a9ad49e9bb6ac07 100644 (file)
@@ -442,6 +442,38 @@ static int cli_io_handler_show_proc(struct appctx *appctx)
                free(msg);
        }
 
+       /* displays external process */
+       chunk_appendf(&trash, "# programs\n");
+       old = 0;
+       list_for_each_entry(child, &proc_list, list) {
+               up = now.tv_sec - child->timestamp;
+
+               if (child->type != 'e')
+                       continue;
+
+               if (child->reloads > 0) {
+                       old++;
+                       continue;
+               }
+               chunk_appendf(&trash, "%-15u %-15s %-15s %-15d %dd %02dh%02dm%02ds\n", child->pid, child->id, "-", child->reloads, up / 86400, (up % 86400) / 3600, (up % 3600) / 60, (up % 60));
+       }
+
+       if (old) {
+               chunk_appendf(&trash, "# old programs\n");
+               list_for_each_entry(child, &proc_list, list) {
+                       up = now.tv_sec - child->timestamp;
+
+                       if (child->type != 'e')
+                               continue;
+
+                       if (child->reloads > 0) {
+                               chunk_appendf(&trash, "%-15u %-15s %-15s %-15d %dd %02dh%02dm%02ds\n", child->pid, child->id, "-", child->reloads, up / 86400, (up % 86400) / 3600, (up % 3600) / 60, (up % 60));
+                       }
+               }
+       }
+
+
+
        if (ci_putchk(si_ic(si), &trash) == -1) {
                si_rx_room_blk(si);
                return 0;