Page 1 of 2
how to monitor STARTING state?
Posted: Wed Nov 16, 2016 4:07 pm
by gornm565
Currently, I am only able to monitor services that are in a STOPPED state. How do I monitor services that are in the STARTING state? I need to be getting critical alerts for those.
Thanks a lot.
Re: how to monitor STARTING state?
Posted: Wed Nov 16, 2016 4:14 pm
by rkennedy
You can use the negate plugin (which will flip statuses from OK -> CRITICAL) to accomplish this. See this link -
https://assets.nagios.com/downloads/nag ... ios-XI.pdf
For example, this is an OK state -
Code: Select all
[root@bob libexec]# ./check_http -H google.com
HTTP OK: HTTP/1.1 301 Moved Permanently - 559 bytes in 0.097 second response time |time=0.096733s;;;0.000000 size=559B;;;0
[root@bob libexec]# echo $?
0
echo $? is going to tell us the exit code, 0 is ok, 1 is warning, and 2 is critical.
Code: Select all
[root@bob libexec]# ./negate -o CRITICAL ./check_http -H google.com
HTTP OK: HTTP/1.1 301 Moved Permanently - 559 bytes in 0.093 second response time |time=0.093093s;;;0.000000 size=559B;;;0
[root@bob libexec]# echo $?
2
This tells us that it says 'OK', but really it's exiting with a 2 which is critical.
Re: how to monitor STARTING state?
Posted: Wed Nov 16, 2016 4:17 pm
by avandemore
gornm565 wrote:Currently, I am only able to monitor services that are in a STOPPED state.
Can you describe what you mean by this? In the Nagios "world" these states exist: OK, WARNING, CRITICAL, UNKNOWN. A service is monitored by its definition and associations not its state, at least not without drastic alterations.
Re: how to monitor STARTING state?
Posted: Wed Nov 16, 2016 4:35 pm
by gornm565
I meant a Windows service. You can setup an alert to notify you when a Windows Service crashes and enters a STOPPED state. Sometimes a service hangs in the STARTING state and nagios doesn't let us know.
Re: how to monitor STARTING state?
Posted: Wed Nov 16, 2016 5:05 pm
by eloyd
If it's not Started, and it's not Stopped, it must be Starting. So negate your Stopped and Started and you'll have Starting.
Re: how to monitor STARTING state?
Posted: Wed Nov 16, 2016 5:48 pm
by avandemore
Does that answer your question
@gornm565?
Re: how to monitor STARTING state?
Posted: Thu Nov 17, 2016 11:26 am
by gornm565
Sorry, need a little bit more detailed help on this.
Is there a way to do this in the GUI and if yes, where would I make these changes? I attached 3 screenshot of a Windows service "MarketDataService.1". It's "STARTED", so it shows a green OK. Where do I make the config changes that would also send me an alert if the service gets stuck in the STARTING state?
Thanks.
Re: how to monitor STARTING state?
Posted: Thu Nov 17, 2016 11:51 am
by avandemore
Can you use the Test Check Commandfrom the second screenshot and post the entirety of the command and output?
Re: how to monitor STARTING state?
Posted: Thu Nov 17, 2016 11:56 am
by gornm565
COMMAND: /usr/local/nagios/libexec/check_nt -H SERVERP01 -s "check123" -p 12489 -v SERVICESTATE -l MarketDataService.1 -d SHOWALL
OUTPUT: MarketDataService.1: Started
avandemore wrote:Can you use the Test Check Commandfrom the second screenshot and post the entirety of the command and output?
Re: how to monitor STARTING state?
Posted: Thu Nov 17, 2016 1:48 pm
by avandemore
After digging into this, I do not believe check_nt is usable for your situation. It's a wrapper for NSClient which actually does have the functionality. So the summary is your best bet is to setup NRPE and use that to run the check via NSCLient and alert accordingly.