On 25 Nov 2013, at 22:32, Rob Cotrone <[email protected]> wrote:
> Is it possible to capture a program(plugin) script output and display it on > the service page? Yes, but this require some minor modifications to the code > 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. > * > 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. In Monit, most of the standard checks are built-in and do not rely on plugins. The program check you refer to do not use a plugin output “protocol” to determine if the check succeeded or not like I believe Nagios does. Instead we simply test the exit code of the program. In case of an error, i.e. the program exited with an unexpected status, the output from the program will be included in an alert, otherwise no output is displayed. The web-ui does display the last known exit status of a program. I’m not sure I see the benefit of displaying the _output_ from the program in the web-ui if everything is okay? In case of errors I can see this might be useful, even though you do get the output in an alert. What do others think? In any case, if you want to always display the last output of a program in the web-ui I suggest you copy the approach used to display the latest exit status of the program. Expand 'struct myprogram' in monit.h with a buffer to hold the program output. I suggest a static buffer of some reasonable size so you don’t have to allocate/free every time. Then in validate.c:check_program read the output from the command and copy into the myprogram buffer at the same place in the code where the exitStatus is copied. To display the output from the program in the Web-UI, again use the same approach we use to display program exitStatus in cervlet.c:print_service_params_program. That should be it. -- To unsubscribe: https://lists.nongnu.org/mailman/listinfo/monit-general
