I don't understand how I should use check_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
icebox
Posts: 5
Joined: Thu Sep 04, 2014 4:36 am

I don't understand how I should use check_uptime

Post by icebox »

I'm about to setup check_uptime for my servers in order to graph the uptime. I thought it would also make a nice way to alert me when a server rebooted. After reading the help page I was convinced that any values *under* critical or warning would produce an alert. But I see it's the oposite:

Code: Select all

 ./check_uptime 
Uptime OK: 7 day(s) 15 hour(s) 5 minute(s) | uptime=10985.000000;;;

#Thinking that anything *under* 10 minutes produces a critical I see that anything *over* ten minutes gives me a critical
./check_uptime -c 10 
Uptime CRITICAL: 7 day(s) 15 hour(s) 5 minute(s) | uptime=10985.000000;;10.000000;

 ./check_uptime -c 10 -w 20
Uptime CRITICAL: 7 day(s) 15 hour(s) 8 minute(s) | uptime=10988.000000;20.000000;10.000000;
I don't see the use in having an alert when a server passes a certain uptime - maybe if you have regular reboot schedules, but I see more value in getting alerts when a server reboots. Or at least please consider implementing both?

Cheers
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: I don't understand how I should use check_uptime

Post by eloyd »

Having never used this plugin, I never looked at it. But you're right. It's backwards. @abrist, fix it! :-)

Code: Select all

[root@nagios plugins]# uptime
 09:56:47 up 28 days, 11:36,  1 user,  load average: 0.03, 0.02, 0.00
[root@nagios plugins]# ./check_uptime
Uptime OK: 28 day(s) 11 hour(s) 36 minute(s) | uptime=41016.000000;;;
[root@nagios plugins]# ./check_uptime -c 10 -w 5
Uptime CRITICAL: 28 day(s) 11 hour(s) 36 minute(s) | uptime=41016.000000;5.000000;10.000000;
[root@nagios plugins]# ./check_uptime -c 30 -w 60
Uptime CRITICAL: 28 day(s) 11 hour(s) 37 minute(s) | uptime=41017.000000;60.000000;30.000000;
[root@nagios plugins]# ./check_uptime -c 30 -w 60-udays
Uptime CRITICAL: 28 day(s) 11 hour(s) 37 minute(s) | uptime=41017.000000;60.000000;30.000000;
[root@nagios plugins]# ./check_uptime -c 30 -w 60 -u days
Uptime OK: 28 day(s) 11 hour(s) 37 minute(s) | uptime=28.000000;60.000000;30.000000;
[root@nagios plugins]# ./check_uptime -c 30 -w 60 -u hours
Uptime CRITICAL: 28 day(s) 11 hour(s) 37 minute(s) | uptime=683.000000;60.000000;30.000000;
[root@nagios plugins]# ./check_uptime -c 30 -w 60
Uptime CRITICAL: 28 day(s) 11 hour(s) 37 minute(s) | uptime=41017.000000;60.000000;30.000000;
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: I don't understand how I should use check_uptime

Post by slansing »

I spoke with sreinhardt and this is actually intentional. We do know it can be like, what the heck, this is backwards, but it is done to keep all of the plugins on the same level. What I mean by that is, we're keeping the Nagios Plugins to the Plugins Guidelines, and not trying to interpret what the user wants, rather, setting them all to read their thresholds one way so there are no odd edge cases floating around. You will want to either use negate http://assets.nagios.com/downloads/nagi ... ios-XI.pdf (can be used with core as well), or you will want to use colons or gt > lt < as defined here:

https://nagios-plugins.org/doc/guidelines.html
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: I don't understand how I should use check_uptime

Post by eloyd »

Then at least change the help output to match the results:

Code: Select all

[root@nagios plugins]# ./check_uptime -h
check_uptime v2.0.2 (nagios-plugins 2.0.2)
Copyright (c) 2014 Nagios Plugin Development Team
        <Andy Brist>

This plugin checks the system uptime and alerts if LESS THAN THE THRESHOLD.
Threshold unit of measurement specified with "-u".
"-u" switch supports: seconds|minutes|hours|days.
Usage:
check_uptime [-u uom] [-w threshold] [-c threshold] [-t] [-h] [-vvv] [-V]
I added uppercase to indicate what needs to be changed.
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
sreinhardt
-fno-stack-protector
Posts: 4366
Joined: Mon Nov 19, 2012 12:10 pm

Re: I don't understand how I should use check_uptime

Post by sreinhardt »

While I'm certainly not going to yell at people looking at the help output, :D I will make the change for a bit more logical message there.
Nagios-Plugins maintainer exclusively, unless you have other C language bugs with open-source nagios projects, then I am happy to help! Please pm or use other communication to alert me to issues as I no longer track the forum.
User avatar
eloyd
Cool Title Here
Posts: 2190
Joined: Thu Sep 27, 2012 9:14 am
Location: Rochester, NY
Contact:

Re: I don't understand how I should use check_uptime

Post by eloyd »

You're allowed to yell so long as we can correct you in public. :)
Image
Eric Loyd • http://everwatch.global • 844.240.EVER • @EricLoyd
I'm a Nagios Fanatic! • Join our public Nagios Discord Server!
slansing
Posts: 7698
Joined: Mon Apr 23, 2012 4:28 pm
Location: Travelling through time and space...

Re: I don't understand how I should use check_uptime

Post by slansing »

icebox,

Let us know if you need help with those thresholds, or using negate.
icebox
Posts: 5
Joined: Thu Sep 04, 2014 4:36 am

Re: I don't understand how I should use check_uptime

Post by icebox »

Hi,

Makes sense to keep the plugin standard, thanks for taking the time to explain. Thanks, never knew of the negate plugin and to my shame I never thought of ranges.

I simply changed my check to

Code: Select all

./check_uptime -c 20:
and it works as I wanted it.

Cheers
User avatar
lmiltchev
Bugs find me
Posts: 13589
Joined: Mon May 23, 2011 12:15 pm

Re: I don't understand how I should use check_uptime

Post by lmiltchev »

I am glad your issue has been resolved. I am locking this topic. If you have any more questions/issues, please, start a new thread.
Be sure to check out our Knowledgebase for helpful articles and solutions!
Locked