want to monitor host restarts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
Locked
chewy747
Posts: 9
Joined: Thu Aug 02, 2012 11:51 am

want to monitor host restarts

Post 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.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: want to monitor host restarts

Post 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.
chewy747
Posts: 9
Joined: Thu Aug 02, 2012 11:51 am

Re: want to monitor host restarts

Post 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
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: want to monitor host restarts

Post 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.
Former Nagios employee
chewy747
Posts: 9
Joined: Thu Aug 02, 2012 11:51 am

Re: want to monitor host restarts

Post by chewy747 »

please excuse my ignorance but Im not sure how to make a wrapper script. any help or direction would be appreciated
tmcdonald
Posts: 9117
Joined: Mon Sep 23, 2013 8:40 am

Re: want to monitor host restarts

Post 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?
Former Nagios employee
chewy747
Posts: 9
Joined: Thu Aug 02, 2012 11:51 am

Re: want to monitor host restarts

Post by chewy747 »

System Uptime - 13 day(s) 4 hour(s) 20 minute(s)
abrist
Red Shirt
Posts: 8334
Joined: Thu Nov 15, 2012 1:20 pm

Re: want to monitor host restarts

Post 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.
Former Nagios employee
"It is turtles. All. The. Way. Down. . . .and maybe an elephant or two."
VI VI VI - The editor of the Beast!
Come to the Dark Side.
Locked