Page 1 of 1

want to monitor host restarts

Posted: Tue Mar 25, 2014 7:23 am
by chewy747
I need to monitor if a host restarts. I am currenly just checking if explorer.exe is running on my windows hosts. if it isnt I generally know the host has restarted. I think I should be able to use the check_nt!uptime command to do it but I can seem to figure out how I can modify it or what else needs to be modified to allow this to work like I am thinking. thanks for any guidance and I can provide more details if needed.

Re: want to monitor host restarts

Posted: Tue Mar 25, 2014 2:37 pm
by slansing
Yes, you should be able to use uptime to show how long the system has been up. Try manually running the following:

Code: Select all

/dir/path/to/plugins/check_nt -H ip.addr.of.host -s "password if you have one set" -p 12489 -v UPTIME
As far as I know it can only be used to determine uptime itself, I don't believe it returns any state but OK.

Re: want to monitor host restarts

Posted: Tue Mar 25, 2014 2:50 pm
by chewy747
to clarify I already am successfully returning the uptime. I just would like to be able to be notififed for instance if the uptime is less than 10 or 15 minutes

Re: want to monitor host restarts

Posted: Tue Mar 25, 2014 4:55 pm
by tmcdonald
Well, you can always write a simple wrapper script that calls that plugin and interprets the output based on the warning and crit levels you specify. Then thr wrapper itself will output a 0, 1 or 2 accordingly.

Re: want to monitor host restarts

Posted: Wed Mar 26, 2014 7:22 am
by chewy747
please excuse my ignorance but Im not sure how to make a wrapper script. any help or direction would be appreciated

Re: want to monitor host restarts

Posted: Wed Mar 26, 2014 9:53 am
by tmcdonald
Actually you might not even need that. Depending on the output you might be able to use the -w and -c switches to specify warning and critical levels respectively. Can you post the output?

Re: want to monitor host restarts

Posted: Wed Mar 26, 2014 10:40 am
by chewy747
System Uptime - 13 day(s) 4 hour(s) 20 minute(s)

Re: want to monitor host restarts

Posted: Wed Mar 26, 2014 1:26 pm
by abrist
check_nt -v UPTIME was updated to include thresholds and performance data. I suggest updating your nagios-plugins package to 2.0 (https://nagios-plugins.org/), and then configuring thresholds to warn you if its uptime is less than a certain amount of time.