Page 2 of 3

Re: UPTIME Threshold

Posted: Thu Mar 15, 2018 8:30 am
by amitgupta19
Please refer to my first attachment, UPTime Definition.

It is also the same as you suggested.

but Still the same status.

I Hope that below command i need to run from the Nagios Server:
./check_nt -H IP_ADDRESS -p 12489 -s secret-password760 -v UPTIME -l hours -c 5

From which path i should run this command?

Re: UPTIME Threshold

Posted: Thu Mar 15, 2018 8:51 am
by amitgupta19
I try to run the command from the nagios Server

But it is not generating any Alert, see the attached screenshot.

Re: UPTIME Threshold

Posted: Thu Mar 15, 2018 9:12 am
by scottwilkerson
amitgupta19 wrote:Please refer to my first attachment, UPTime Definition.
you had this

Code: Select all

check_command        check_nt!UPTIME -l hours -c 5
I proposed this

Code: Select all

check_command        check_nt!UPTIME!-l hours -c 5
amitgupta19 wrote:But it is not generating any Alert, see the attached screenshot.
Running the command doesn't generate Nagios notifications the rest of the configuration does

Here is the documentation on notifications
https://assets.nagios.com/downloads/nag ... tions.html

Nagios XI takes a lot of the complexity our of setting up and configuring notifications with easy to use web UI and configuration wizards, you may want to check that out
https://www.nagios.com/products/nagios-xi/

Re: UPTIME Threshold

Posted: Thu Mar 15, 2018 9:37 am
by amitgupta19
Thanks for pointing this out:

PFA screenshot from services.cfg, hope this time command should be OK.

But still no Alert generated.

Re: UPTIME Threshold

Posted: Thu Mar 15, 2018 11:56 am
by scottwilkerson
Did you read the doc I sent?

Your config that you are showing doesn't have a contact specified to alert

Re: UPTIME Threshold

Posted: Thu Mar 15, 2018 12:13 pm
by amitgupta19
i have defined the
contact_groups admins

Still the status is same.

Atleast it should show the Alert on the Console. I hope that contact_groups is for generating Notifications like Email.

Please correct if i am wrong here.

Re: UPTIME Threshold

Posted: Thu Mar 15, 2018 12:23 pm
by scottwilkerson
It should only show critical if the machine has been up less than 30 hours

Re: UPTIME Threshold

Posted: Thu Mar 15, 2018 12:34 pm
by amitgupta19
But it is not showing.

Re: UPTIME Threshold

Posted: Thu Mar 15, 2018 1:13 pm
by lmiltchev
You will see an alert when you have an exit code of 2 (CRITICAL). Test your check again from the command line to see what is the exit code. Here's an example of exit code of 0 (OK), when I use "20" hours as a critical threshold, and exit code of 2 (CRITICAL), when I use "30" hours as a critical threshold:

Code: Select all

[root@main-nagios-xi libexec]# ./check_nt -H x.x.x.x -s password -p 12489 -v UPTIME -l hours -c 20
System Uptime - 1 day(s) 1 hour(s) 30 minute(s) |uptime=25
[root@main-nagios-xi libexec]# echo $?
0
[root@main-nagios-xi libexec]# ./check_nt -H x.x.x.x -s password -p 12489 -v UPTIME -l hours -c 30
System Uptime - 1 day(s) 1 hour(s) 30 minute(s) |uptime=25
[root@main-nagios-xi libexec]# echo $?
2
In case your service goes to hard critical, you would see something like this in the nagios.log:

Code: Select all

[1521136984] SERVICE ALERT: Windows7;Uptime;CRITICAL;HARD;5;System Uptime - 1 day(s) 1 hour(s) 27 minute(s)
If contacts/contactgroups have been added to this service, and it's been configured properly, notifications will be sent as well. Read more about notifications in Nagios Core here:

https://assets.nagios.com/downloads/nag ... tions.html

Re: UPTIME Threshold

Posted: Mon Mar 19, 2018 10:20 am
by amitgupta19
Please find here with the Output of the manual command

It is giving 0 in both the cases.