Windows Server Uptime alert in Nagios - NSClient
-
sify_nagios
- Posts: 54
- Joined: Thu Aug 20, 2015 8:01 am
Windows Server Uptime alert in Nagios - NSClient
Hi Team,
I would like to get alert whenever uptime of windows server is less than 2 hours or specified.
I can see nagios xi fetching the Uptime value by using below command.
/usr/local/nagios/libexec/check_nt -H 172.20.30.13 -s "" -p 12489 -v UPTIME
But it does trigger alerts.
Kindly guide us to achieve the same.
Thanks
Srini.
I would like to get alert whenever uptime of windows server is less than 2 hours or specified.
I can see nagios xi fetching the Uptime value by using below command.
/usr/local/nagios/libexec/check_nt -H 172.20.30.13 -s "" -p 12489 -v UPTIME
But it does trigger alerts.
Kindly guide us to achieve the same.
Thanks
Srini.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Windows Server Uptime alert in Nagios - NSClient
Code: Select all
/usr/local/nagios/libexec/check_nt --helpcheck_nt -H host -v variable [-p port] [-w warning] [-c critical]
[-l params] [-d SHOWALL] [-u] [-t timeout]
Options:
-w, --warning=INTEGER
Threshold which will result in a warning status
-c, --critical=INTEGER
Threshold which will result in a critical status
UPTIME =
Get the uptime of the machine.
-l <unit>
<unit> = seconds, minutes, hours, or days. (default: minutes)
Thresholds will use the unit specified above.
Code: Select all
/usr/local/nagios/libexec/check_nt -H 172.20.30.13 -s "" -p 12489 -v UPTIME -w 120As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
sify_nagios
- Posts: 54
- Joined: Thu Aug 20, 2015 8:01 am
Re: Windows Server Uptime alert in Nagios - NSClient
Hi,
The given command doesn't return critical or warning whenever the server is down.
It simply display the uptime of server.
I need the uptime should send a notification and alert.
Kindly guide us.
Regards
Srini.
The given command doesn't return critical or warning whenever the server is down.
It simply display the uptime of server.
Code: Select all
[root@Nagiosprimary perfdata]# /usr/local/nagios/libexec/check_nt -H 192.168.50.200 -p 12489 -v UPTIME -w 120
System Uptime - 0 day(s) 0 hour(s) 6 minute(s) |uptime=6
You have new mail in /var/spool/mail/root
[root@Nagiosprimary perfdata]#
Kindly guide us.
Regards
Srini.
Re: Windows Server Uptime alert in Nagios - NSClient
Did you include the warning or the critical threshold in your command? The state of the service will change, and you will receive notification if the value is below the threshold...
The following command should give you "OK" state (no thresholds specified):
You can check it out by running:
This will give you WARNING:
and this - CRITICAL:
You check command should look like this (if you want to receive a WARNING notification)
The following command should give you "OK" state (no thresholds specified):
Code: Select all
/usr/local/nagios/libexec/check_nt -H 192.168.50.200 -p 12489 -v UPTIMECode: Select all
echo $?Code: Select all
/usr/local/nagios/libexec/check_nt -H 192.168.50.200 -p 12489 -v UPTIME -w 120Code: Select all
/usr/local/nagios/libexec/check_nt -H 192.168.50.200 -p 12489 -v UPTIME -c 120Code: Select all
check_command check_xi_service_nsclient!password!UPTIME!-w 120Be sure to check out our Knowledgebase for helpful articles and solutions!
-
sify_nagios
- Posts: 54
- Joined: Thu Aug 20, 2015 8:01 am
Re: Windows Server Uptime alert in Nagios - NSClient
Hi,
Code which i have mentioned in the earlier reply was taken from CLI.
Kindly check and let us know whether it will return state in CLI or not.
Note: I haven't tested it in GUI since not succeed on CLI.
Regards
Srini.
Code which i have mentioned in the earlier reply was taken from CLI.
It doesn't return the warning or critical even though the server uptime below threshold and threshold mentioned.[root@Nagiosprimary perfdata]# /usr/local/nagios/libexec/check_nt -H 192.168.50.200 -p 12489 -v UPTIME -w 120
System Uptime - 0 day(s) 0 hour(s) 6 minute(s) |uptime=6
You have new mail in /var/spool/mail/root
[root@Nagiosprimary perfdata]#
Kindly check and let us know whether it will return state in CLI or not.
Note: I haven't tested it in GUI since not succeed on CLI.
Regards
Srini.
- Box293
- Too Basu
- Posts: 5126
- Joined: Sun Feb 07, 2010 10:55 pm
- Location: Deniliquin, Australia
- Contact:
Re: Windows Server Uptime alert in Nagios - NSClient
Execute the command above.sify_nagios wrote:It doesn't return the warning or critical even though the server uptime below threshold and threshold mentioned.
Kindly check and let us know whether it will return state in CLI or not.
Then immediately execute this command:
Code: Select all
echo $?These codes are what informs Nagios as to the state of the check.
https://nagios-plugins.org/doc/guidelines.html#AEN78
The words on the screen are just there for us humans to see what the data is. Unfortunately in this case it does not say "WARNING", but that's not important as it is the exit code which tells Nagios what the state is.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
Re: Windows Server Uptime alert in Nagios - NSClient
You could consider using check_nrpe which has better output and more options. Check out Troy's site here: http://sites.box293.com/nagios/guides/c ... cks/uptime which explains how to do that.
For example if you say:
Output:
Grtz
Willem
For example if you say:
Code: Select all
check_nrpe -H 192.168.142.1 -t 30 -c Check_Uptime -a show-all 'warning=uptime<1d' 'critical=uptime<1d'Code: Select all
critical(uptime: 01:39h, boot: 2015-Jan-06 05:38:27 (UTC))|'uptime'=5980s;86400;86400Willem
Nagios XI 5.8.1
https://outsideit.net
https://outsideit.net
Re: Windows Server Uptime alert in Nagios - NSClient
sify_nagios, let us know if you need any more help on this.
Be sure to check out our Knowledgebase for helpful articles and solutions!
-
sify_nagios
- Posts: 54
- Joined: Thu Aug 20, 2015 8:01 am
Re: Windows Server Uptime alert in Nagios - NSClient
Hi Team,
Its working now. Thanks a lot for your support.
Rgds
Srini
Its working now. Thanks a lot for your support.
Rgds
Srini