Skip to content
Davide Madrisan edited this page Oct 10, 2015 · 17 revisions

Nagios Plugins for Linux

A suite of Nagios plugins for monitoring Linux servers and appliances

Nagios is an open source computer system monitoring, network monitoring and infrastructure monitoring software application. Nagios, originally created under the name NetSaint, was written and is currently maintained by Ethan Galstad along with a group of developers who are actively maintaining both the official and unofficial plugins.

The Nagios Plugins for Linux are intended to be run by NRPE, the Nagios Remote Plugin Executor, that "allows you to remotely execute Nagios plugins on other Linux/Unix machines. This allows you to monitor remote machine metrics (disk usage, CPU load, etc.)."

Available Nagios Plugins

Plugin Description
check_clock Returns the number of seconds elapsed between local time and Nagios time
[check_cpu] Checks the CPU (user mode) utilization
[check_cpufreq] Displays the CPU frequency characteristics
[check_cswch] Checks the total number of context switches across all CPUs
[check_fc] Monitors the status of the fiber status ports
[check_ifmountfs] Checks whether the given filesystems are mounted
[check_intr] Monitors the total number of system interrupts
[check_iowait] Monitors the I/O wait bottlenecks
[check_load] Checks the current system load average
[check_memory] Checks the memory usage
[check_multipath] Checks the multipath topology status
[check_nbprocs] Displays the number of running processes per user
[check_network] Displays some network interfaces statistics
[check_paging] Checks the memory and swap paging
[check_readonlyfs] Checks for readonly filesystems
[check_swap] Checks the swap usage
[check_tcpcount] Checks the tcp network usage
[check_temperature] Monitors the hardware's temperature
[check_uptime] Checks how long the system has been running
[check_users] Displays the number of users that are currently logged on

LNX_UPTIME - check how long the system has been running

[ /etc/nrpe.d/check_uptime ]
command[check_uptime]=/usr/lib/nagios/plugins/check_uptime
command[check_uptime_notify]=/usr/lib/nagios/plugins/check_uptime --critical 30:
Usage note

In the example above, a notification will be sent by Nagios when the uptime of the monitored server will be less than 30 minutes. This will catch, for instance, an unexpected reboot of a servers caused by a non-maskable interrupt (a signal of a non-recoverable hardware error).

A note on the implementation of "check_uptime" provided by nagios-plugins 2.0+

This new Nagios plugin is based on the POSIX function clock_gettime() associated with the clock monotonic option (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 of /proc/uptime.

$ /usr/bin/uptime
18:45:00 up  8:46,  7 users,  load average: 0.67, 1.79, 2.49

$ awk '{printf("%02d:%02d\n",($1/60/60%24),($1/60%60))}' /proc/uptime
08:46

$ ./clock_monotonic
4 hours 37 min

(On OpenBSD 5.0, the clock monotonic function returns the same value as uptime, which is confirming this behaviour is platform dependent).

The implementation followed by nagios-plugins-linux is compatible with uptime and /proc/uptime.

This plugin checks how long the system has been running.
Copyright (C) 2010,2012-2014 Davide Madrisan <[email protected]>

Usage:
  check_uptime [OPTION]

Options:
  -m, --clock-monotonic  use the monotonic clock for retrieving the time
  -w, --warning PERCENT   warning threshold
  -c, --critical PERCENT   critical threshold
  -h, --help      display this help and exit
  -V, --version   output version information and exit

Examples:
  check_uptime
  check_uptime --critical 15: --warning 30:
  check_uptime --clock-monotonic -c 15: -w 30:

See the Nagios Developer Guidelines for range format:
<https://nagios-plugins.org/doc/guidelines.html#THRESHOLDFORMAT>
Example of output
uptime OK: 23 hours 56 min | uptime=1436
Performance data

uptime (in minutes)