[Nagios-devel] [PATCH 2/3] qh: Fall for peer pressure from myself,

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
Guest

[Nagios-devel] [PATCH 2/3] qh: Fall for peer pressure from myself,

Post by Guest »

From: Robin Sonefors

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
---
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 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 Register a new worker\n"
+ " 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






This post was automatically imported from historical nagios-devel mailing list archives
Original poster: robin.sonefors@op5.com
Locked