From 8f792fde2d21ec3a95fc7fba098b62b6dec3a4ce Mon Sep 17 00:00:00 2001 From: "roberto@oneiric64" Date: Mon, 12 Dec 2011 15:15:15 +0100 Subject: [PATCH] export daemons infos in stats server --- master_utils.c | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/master_utils.c b/master_utils.c index ab6b8e56..3b835284 100644 --- a/master_utils.c +++ b/master_utils.c @@ -330,6 +330,22 @@ void uwsgi_send_stats(int fd) { stats_send("\"cwd\": \"%s\",\n", cwd); free(cwd); + if (uwsgi.daemons) { + fprintf(output, "\"daemons\": [\n"); + struct uwsgi_daemon *ud = uwsgi.daemons; + while(ud) { + fprintf(output, "\t{ \"cmd\": \"%s\", \"pid\": %d, \"respawns\": %llu }", + ud->command, (int) ud->pid, (unsigned long long) ud->respawns-1); + if (ud->next) + fprintf(output, ",\n"); + else { + fprintf(output, "\n"); + } + ud = ud->next; + } + fprintf(output, "],\n"); + } + fprintf(output, "\"workers\": [\n"); for (i = 0; i < uwsgi.numproc; i++) {