Nagios run a script on Red Hat box
Nagios run a script on Red Hat box
I have a Red Hat LInux server being monitored with Nagios by nrpe. I have a script that needs to be ran and then if the Expect output is "shnlp-syslog-service is running" everything is good. If when the script is ran and anything else is returned I need a notification to be sent saying something like "Skyhigh is not getting logs! Skyhigh logging service is stopped". Is this possible with Nagios XI and if so what is the best way to go about setting a check like this up?
Re: Nagios run a script on Red Hat box
It sounds like you need to write up a plugin to do so. Take a look at one I wrote, that could be modified for your need - https://github.com/rcknag/nagios-plugin ... ocalnfs.sh
Specifically, this part -
You can evaluate based on how many lines the response is, and then you would need to exit #(where # is the number to exit on)
In nagios, 0 = OK, 1 = WARNING, 2 = CRITICAL, and 3 = UNKNOWN. These are what Nagios uses to relay what the status is.
https://nagios-plugins.org/doc/guidelines.html is a good reference to use for understanding the plugin guidelines.
Specifically, this part -
Code: Select all
count=$(/usr/bin/timeout 10 /usr/local/nagios/libexec/check_disk -w 10 -c 20 -p "$path" | wc -l)
In nagios, 0 = OK, 1 = WARNING, 2 = CRITICAL, and 3 = UNKNOWN. These are what Nagios uses to relay what the status is.
https://nagios-plugins.org/doc/guidelines.html is a good reference to use for understanding the plugin guidelines.
Former Nagios Employee