check_uptime

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
srisurya
Posts: 8
Joined: Thu Sep 29, 2016 9:01 am

check_uptime

Post by srisurya »

I want to get a clear picture on how to use check_uptime. I want the threshold to be critical if the system is up for more than 15 minutes. How can I set it up ?
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: check_uptime

Post by mcapra »

From the help menu:

Code: Select all

[root@localhost libexec]# ./check_uptime -h
check_uptime v2.1.2 (nagios-plugins 2.1.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]

Options:
 -h, --help
    Print detailed help screen
 -V, --version
    Print version information
 --extra-opts=[section][@file]
    Read options from an ini file. See
    https://www.nagios-plugins.org/doc/extra-opts.html
    for usage and examples.
-t, Plugin timeout, default 10 seconds
-c, Critcal threshold
-w, Warning threshold
-u, Time unit of measurement (seconds|minutes|hours|days) (default: minutes)
-vvv, Enable verbose output
If I wanted to return critical for a machine with uptime greater than 15 minutes:

Code: Select all

[root@localhost libexec]# /usr/local/nagios/libexec/check_uptime -u minutes -w 10 -c 15
Uptime CRITICAL: 20 day(s) 1 hour(s) 25 minute(s) | uptime=28885.000000;10.000000;15.000000;
And if I reboot the machine:

Code: Select all

[root@localhost ~]# /usr/local/nagios/libexec/check_uptime -u minutes -w 10 -c 15
Uptime OK: 0 day(s) 0 hour(s) 1 minute(s) | uptime=1.000000;10.000000;15.000000;
Former Nagios employee
https://www.mcapra.com/
Locked