Page 1 of 1
I don't understand how I should use check_uptime
Posted: Thu Sep 04, 2014 4:46 am
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
Re: I don't understand how I should use check_uptime
Posted: Thu Sep 04, 2014 9:03 am
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;
Re: I don't understand how I should use check_uptime
Posted: Thu Sep 04, 2014 9:59 am
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
Re: I don't understand how I should use check_uptime
Posted: Thu Sep 04, 2014 10:03 am
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.
Re: I don't understand how I should use check_uptime
Posted: Thu Sep 04, 2014 12:02 pm
by sreinhardt
While I'm certainly not going to yell at people looking at the help output,

I will make the change for a bit more logical message there.
Re: I don't understand how I should use check_uptime
Posted: Thu Sep 04, 2014 12:23 pm
by eloyd
You're allowed to yell so long as we can correct you in public.

Re: I don't understand how I should use check_uptime
Posted: Thu Sep 04, 2014 4:36 pm
by slansing
icebox,
Let us know if you need help with those thresholds, or using negate.
Re: I don't understand how I should use check_uptime
Posted: Fri Sep 05, 2014 1:11 am
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
and it works as I wanted it.
Cheers
Re: I don't understand how I should use check_uptime
Posted: Fri Sep 05, 2014 8:30 am
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.