Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
Capture command output
1.1
2015-09-29
- Nagios 1.x
- Nagios 2.x
- Nagios 3.x
- Nagios 4.x
GPL
13890
File | Description |
---|---|
capture_output.pl | capture_output.pl |
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
This is useful for debugging failing Nagios monitors.
A log entry sample:
2015-8-27 13:22:54 ------ debugging
cmd=[/usr/lib/nagios/plugins/check_disk '-w' '20%' '-c' '10%' '-e']
output=[DISK CRITICAL - /run/user/1001/gvfs is not accessible: Permission denied
]
retcode=2
This plugin was originally written 2007-03-24 by Wolfgang Wagner (http://www.waggy.at/nagios/capture_plugin.htm)
Copyright 2007 by Wolfgang Wagner. All rights reserved.
The plugin does not require any additional utilities, it simply wraps the original command, logs the output to a file and then returns the results and RC back to Nagios for handling.
Configuration:
Consider this command:
define command{
command_name check_ssl_cert
command_line /usr/lib/nagios/plugins/check_http -H '$HOSTADDRESS$' -I '$HOSTADDRESS$' -C10
}
In order to use the plugin, simple add /path/to/capture_output.pl in the beginning of the command, like so:
define command{
command_name check_ssl_cert
command_line /usr/lib/nagios/plugins/capture_output.pl /usr/lib/nagios/plugins/check_http -H '$HOSTADDRESS$' -I '$HOSTADDRESS$' -C10
}
Revised by Jess Portnoy on 2015-09-28, Changes:
- Exit with 3 [UNKNOWN] if cannot open() or close() file
- chmod file to 600 since it might contain sensitive info
- some cleanup
Copyright 2007 by Wolfgang Wagner. All rights reserved.
The plugin does not require any additional utilities, it simply wraps the original command, logs the output to a file and then returns the results and RC back to Nagios for handling.
Configuration:
Consider this command:
define command{
command_name check_ssl_cert
command_line /usr/lib/nagios/plugins/check_http -H '$HOSTADDRESS$' -I '$HOSTADDRESS$' -C10
}
In order to use the plugin, simple add /path/to/capture_output.pl in the beginning of the command, like so:
define command{
command_name check_ssl_cert
command_line /usr/lib/nagios/plugins/capture_output.pl /usr/lib/nagios/plugins/check_http -H '$HOSTADDRESS$' -I '$HOSTADDRESS$' -C10
}
Revised by Jess Portnoy
- Exit with 3 [UNKNOWN] if cannot open() or close() file
- chmod file to 600 since it might contain sensitive info
- some cleanup
Reviews (1)
byikarpov, September 3, 2017
I spent few hour trying to figure it out why plugin that works just fine from the command line, does not work under centreon. And this script told me that sudo wants tty...