UPTIME Threshold

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.
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: UPTIME Threshold

Post 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?
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: UPTIME Threshold

Post by amitgupta19 »

I try to run the command from the nagios Server

But it is not generating any Alert, see the attached screenshot.
Attachments
UPTIME Command from the Nagios Server Manually
UPTIME Command from the Nagios Server Manually
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: UPTIME Threshold

Post 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/
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: UPTIME Threshold

Post by amitgupta19 »

Thanks for pointing this out:

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

But still no Alert generated.
Attachments
UPTIME-Command definition-Updated.JPG
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: UPTIME Threshold

Post by scottwilkerson »

Did you read the doc I sent?

Your config that you are showing doesn't have a contact specified to alert
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: UPTIME Threshold

Post 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.
scottwilkerson
DevOps Engineer
Posts: 19396
Joined: Tue Nov 15, 2011 3:11 pm
Location: Nagios Enterprises
Contact:

Re: UPTIME Threshold

Post by scottwilkerson »

It should only show critical if the machine has been up less than 30 hours
Former Nagios employee
Creator:
ahumandesign.com
enneagrams.com
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: UPTIME Threshold

Post by amitgupta19 »

But it is not showing.
User avatar
lmiltchev
Former Nagios Staff
Posts: 13587
Joined: Mon May 23, 2011 12:15 pm

Re: UPTIME Threshold

Post 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
Be sure to check out our Knowledgebase for helpful articles and solutions!
amitgupta19
Posts: 286
Joined: Fri Sep 08, 2017 5:53 am

Re: UPTIME Threshold

Post by amitgupta19 »

Please find here with the Output of the manual command

It is giving 0 in both the cases.
Attachments
UPTIME-ManualCommand.JPG
Locked