check_nt Uptime

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
szkoda
Posts: 42
Joined: Thu Dec 04, 2014 8:48 am

check_nt Uptime

Post by szkoda »

Is there a way to use check_nt uptime to generate a warning/critical alert if the uptime is below a minute?

I'm trying to work out a way to monitor whether a server has rebooted or has rebooted itself.
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: check_nt Uptime

Post by slansing »

Well, one way to check that could be through the windows event logs, that would be pretty sure-fire. Uptime? You should be able to define min and max warning and critical levels:

http://www.nsclient.org/nscp/wiki/Check ... heckUpTime
szkoda
Posts: 42
Joined: Thu Dec 04, 2014 8:48 am

Re: check_nt Uptime

Post by szkoda »

I use check_nt for the uptime check and tried adding "-c 1" to send me a critical alert when uptime is 1 minute but it doesn't work.

Could you tell me the correct syntax for the command please?

Also how simple is it to get nagios to look at the windows event log to detect a reboot - is there a plugin that can do this?
User avatar
Box293
Too Basu
Posts: 5126
Joined: Sun Feb 07, 2010 10:55 pm
Location: Deniliquin, Australia
Contact:

Re: check_nt Uptime

Post by Box293 »

Code: Select all

 UPTIME =
  Get the uptime of the machine.
  -l <unit> 
  <unit> = seconds, minutes, hours, or days. (default: minutes)
  Thresholds will use the unit specified above.
The default unit is minutes, so when you use "-c 1" you are saying only report critical if it's been up for less than a minute. If you're doing five minute service checks then it's likely you'll miss this.

Here's a machine that has been up for 20 minutes. I tried with a critical of 19 and it generates an OK status (0).

Code: Select all

Command:
./check_nt -H win2008r2-01 -p 12489 -v UPTIME -c 19

Output:
System Uptime - 0 day(s) 0 hour(s) 20 minute(s) |uptime=20

Command:
echo $?

Output:
0
Here's a machine that has been up for 21 minutes. I tried with a critical of 22 and it generates a CRITICAL status (2).

Code: Select all

Command:
./check_nt -H win2008r2-01 -p 12489 -v UPTIME -c 22

Output:
System Uptime - 0 day(s) 0 hour(s) 21 minute(s) |uptime=21

Command:
echo $?

Output:
2
szkoda wrote:Also how simple is it to get nagios to look at the windows event log to detect a reboot - is there a plugin that can do this?
NSClient++ can do this differently with different versions:
0.3.9: https://mbrownnyc.wordpress.com/2011/08 ... -nagios-2/
0.4.x: http://www.medin.name/blog/2012/03/20/r ... -nsclient/

Although personally Nagios Log Server is a good solution as the logs are stored away from the original server and can be searched later. If someone clears the event logs on the original box it doesn't matter.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
szkoda
Posts: 42
Joined: Thu Dec 04, 2014 8:48 am

Re: check_nt Uptime

Post by szkoda »

Thankyou, I've set it to 10 mins now and its working exactly as expected.

You can mark this as solved.
Locked