Skip to content

Commit

Permalink
core: Add 'wpstats' query to wproc query handler
Browse files Browse the repository at this point in the history
It doesn't do special-purpose workers yet, but at least it gives
us a base to build on and makes debugging workers quite a lot
easier.

Signed-off-by: Andreas Ericsson <[email protected]>

git-svn-id: https://nagios.svn.sourceforge.net/svnroot/nagios/nagioscore/trunk@2429 5f96b256-904b-4d8d-8c98-d829582c6739
  • Loading branch information
ageric committed Oct 28, 2012
1 parent 422a575 commit d7cf53b
Showing 1 changed file with 11 additions and 0 deletions.
11 changes: 11 additions & 0 deletions base/workers.c
Original file line number Diff line number Diff line change
Expand Up @@ -662,6 +662,17 @@ static int wproc_query_handler(int sd, char *buf, unsigned int len)

if (!strcmp(buf, "register"))
return register_worker(sd, rbuf, len);
if (!strcmp(buf, "wpstats")) {
int i;

for (i = 0; i < workers.len; i++) {
worker_process *wp = workers.wps[i];
nsock_printf(sd, "name=%s;pid=%d;jobs_running=%u;jobs_started=%u\n",
wp->source_name, wp->pid,
wp->jobs_running, wp->jobs_started);
}
return 0;
}

return 400;
}
Expand Down

0 comments on commit d7cf53b

Please sign in to comment.