[PATCH 2/3] qh: Fall for peer pressure from myself, and implement some help
robin.sonefors at op5.com
robin.sonefors at op5.com
Wed Nov 28 15:37:22 CET 2012
From: Robin Sonefors <robin.sonefors at op5.com>
This is still quite sparse, as it's intended as inline help and hints,
rather than as complete documentation, but it should still prove
helpful.
Signed-off-by: Robin Sonefors <robin.sonefors at op5.com>
---
base/query-handler.c | 15 +++++++++++++++
base/workers.c | 10 ++++++++++
2 files changed, 25 insertions(+)
diff --git a/base/query-handler.c b/base/query-handler.c
index 51acd63..3ec4ad3 100644
--- a/base/query-handler.c
+++ b/base/query-handler.c
@@ -23,6 +23,11 @@ static dkhash_table *qh_table;
/* the echo service. stupid, but useful for testing */
static int qh_echo(int sd, char *buf, unsigned int len)
{
+ if (!strcmp(buf, "help")) {
+ nsock_printf_nul(sd,
+ "Query handler that simply echoes back what you send it.");
+ return 0;
+ }
(void)write(sd, buf, len);
return 0;
}
@@ -286,6 +291,16 @@ static int qh_core(int sd, char *buf, unsigned int len)
{
char *space;
+ if (!strcmp(buf, "help")) {
+ nsock_printf_nul(sd, "Query handler for manipulating nagios core.\n"
+ "Available commands:\n"
+ " loadctl Print information about current load control settings\n"
+ " loadctl <options> Configure nagios load control.\n"
+ " The options are the same parameters and format as\n"
+ " returned above."
+ );
+ return 0;
+ }
if ((space = memchr(buf, ' ', len)))
*(space++) = 0;
if (!space && !strcmp(buf, "loadctl")) {
diff --git a/base/workers.c b/base/workers.c
index 0f315d5..a6763c7 100644
--- a/base/workers.c
+++ b/base/workers.c
@@ -722,6 +722,16 @@ static int wproc_query_handler(int sd, char *buf, unsigned int len)
{
char *space, *rbuf = NULL;
+ if (!strcmp(buf, "help")) {
+ nsock_printf_nul(sd, "Control worker processes.\n"
+ "Valid commands:\n"
+ " wpstats Print general job information\n"
+ " register <options> Register a new worker\n"
+ " <options> can be name, pid, max_jobs and/or plugin.\n"
+ " There can be many plugin args.");
+ return 0;
+ }
+
if ((space = memchr(buf, ' ', len)) != NULL)
*space = 0;
--
1.7.11.7
------------------------------------------------------------------------------
Keep yourself connected to Go Parallel:
INSIGHTS What's next for parallel hardware, programming and related areas?
Interviews and blogs by thought leaders keep you ahead of the curve.
http://goparallel.sourceforge.net
More information about the Developers
mailing list