Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_uptime with full support for notifications
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
It can be used to notify (with a warning or critical exit status) if an host has a boot time lower or greater than a given number of minutes. You can specify the notification ranges by using the standard Nagios syntax: '[@]start:end'.
Usage:
check_uptime [--warning [@]start:end] [--critical [@]start:end]
Examples:
check_uptime
check_uptime --warning 30: --critical 15:
Supported platforms:
* Linux (tested on openmamba GNU/Linux and RHEL 4,5,6)
* FreeBSD 8.2-RELEASE-p10
* AIX 6.1 with gcc 4.2.0
* Solaris 11.1 (SunOS solaris 5.11 11.1) with gcc 4.5.2
* OpenIndiana build 151a7 with gcc 4.3.3
* OpenBSD 5.2 with gcc 4,2,1
Please drop me a note if this plugin does not compile or run on your favorite os!
Note. The corresponding plugin shipped by nagios-plugins 2.0 or better is based on the clock monotonic function (clock_gettime() with clockid_t eq. to CLOCK_MONOTONIC).
According to the POSIX specifications "the value returned by clock_gettime() represents the amount of time (in seconds and nanoseconds) since an unspecified point in the past (for example, system start-time, or the Epoch)".
The (recent) Linux kernels returns a value that is somehow related to the system start-time but can be different from the output of the command uptime (procps), or the first value returned by /proc/uptime.
$ /usr/bin/uptime
18:45:00 up 8:46, 7 users, load average: 0.67, 1.79, 2.49
$ awk '{printf("%02d:%02dn",($1/60/60%24),($1/60%60))}' /proc/uptime
08:46
$ ./clock_monotonic
4 hours 37 min
Conversely, the implementation followed by this Nagios plugins is compatible with uptime and /proc/uptime
check_uptime [--warning [@]start:end] [--critical [@]start:end]
Examples:
check_uptime
check_uptime --warning 30: --critical 15:
Supported platforms:
* Linux (tested on openmamba GNU/Linux and RHEL 4,5,6)
* FreeBSD 8.2-RELEASE-p10
* AIX 6.1 with gcc 4.2.0
* Solaris 11.1 (SunOS solaris 5.11 11.1) with gcc 4.5.2
* OpenIndiana build 151a7 with gcc 4.3.3
* OpenBSD 5.2 with gcc 4,2,1
Please drop me a note if this plugin does not compile or run on your favorite os!
Note. The corresponding plugin shipped by nagios-plugins 2.0 or better is based on the clock monotonic function (clock_gettime() with clockid_t eq. to CLOCK_MONOTONIC).
According to the POSIX specifications "the value returned by clock_gettime() represents the amount of time (in seconds and nanoseconds) since an unspecified point in the past (for example, system start-time, or the Epoch)".
The (recent) Linux kernels returns a value that is somehow related to the system start-time but can be different from the output of the command uptime (procps), or the first value returned by /proc/uptime.
$ /usr/bin/uptime
18:45:00 up 8:46, 7 users, load average: 0.67, 1.79, 2.49
$ awk '{printf("%02d:%02dn",($1/60/60%24),($1/60%60))}' /proc/uptime
08:46
$ ./clock_monotonic
4 hours 37 min
Conversely, the implementation followed by this Nagios plugins is compatible with uptime and /proc/uptime
Reviews (1)
This plugin was successfully tested in our production environment on 800 hosts.
Now we can see when a host reboots unexpectedly. We are using a critical threshold when uptime is less than 15mn.
Thx for your contribution.
Now we can see when a host reboots unexpectedly. We are using a critical threshold when uptime is less than 15mn.
Thx for your contribution.