monit-general
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Capture program/script output and display on service page?


From: Rob Cotrone
Subject: Capture program/script output and display on service page?
Date: Mon, 25 Nov 2013 16:32:19 -0500
User-agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:24.0) Gecko/20100101 Thunderbird/24.1.1

Is it possible to capture a program(plugin) script output and display it on the service page?

While looking at the source I've seen that if a failure occurs, stdout, then stderr, are captured into the event structure.
I modified the cervlet.c to display it if it exists.  It's working a bit.

However I also noticed if the script/program is successful, without ever having a failure, the output is NOT captured.
I added a few lines to capture it (duplicating another block).
It seems that further down the line, the event is not created if the state is succeeded.

While I thought about modifying that further I realized I'm getting deeper into unfamiliar territory since I'm new to monit. I could create a pointer in the Service_T to store a copy of the buffer, I'm not sure that's the best place to keep it.

In the past, I've used NAGIOS everywhere.
I'm considering the use of monit, and support for it, on limetech's unRAID platform.
Monit is pretty self contained and may fit the bill for users.

The one thing that is missing is the actual program/plugin output display.
I'm used to popping up NAGIOS, getting a birds eye view of all service plugin output data, not just a success or failure, but a few lines of data from the plugin(program) output.

When showing users monit, some users balked, because they could not see the output of their test scripts via the browser interface.

This is what I was playing with so far.

address@hidden:/unraid/disk1/home/rcotrone/src.slacky/monit/monit# diff -u monit-5.6/src/http/cervlet.c monit-5.6.new/src/http/cervlet.c
--- monit-5.6/src/http/cervlet.c        2013-08-20 03:37:08.000000000 -0400
+++ monit-5.6.new/src/http/cervlet.c    2013-11-24 00:50:32.000000000 -0500
@@ -854,6 +854,11 @@
StringBuffer_append(res->outputbuffer, "<tr><td>Timeout</td><td>If restarted %d times within %d cycle(s) then %s</td></tr>", ar->count, ar->cycle, Util_describeAction(ar->action->failed, buf, sizeof(buf)));

StringBuffer_append(res->outputbuffer, "<tr><td>Data collected</td><td>%s</td></tr>", Time_string(s->collected.tv_sec, buf));
+#if 1
+        if ( s->eventlist != NULL ) {
+ StringBuffer_append(res->outputbuffer, "<tr><td>Message</td><td><pre>%s</pre></td></tr>", NVLSTR(s->eventlist->message));
+        }
+#endif

         /* Parameters */
         print_service_params_icmp(res, s);




reply via email to

[Prev in Thread] Current Thread [Next in Thread]