Active and passive checks
To understand how to code a plugin, we have first to how, on a broad scale, a Nagios check works. There are two different kinds of checks.
Active checks
Based on a time range, or manually triggered, an active check sees a plugin actively connecting to a service and collecting information. A typical example could be for a plugin to check the disk space: once invoked, it interfaces with (usually) the operating system, executes a df
command, works on the output, extracts the value related to the disk space, evaluates it against some thresholds, and reports back a status, such asOK
,WARNING
,CRITICAL
, or UNKNOWN
.
Passive checks
In this case, Nagios does not trigger anything but waits to be by some means by the service, which must be monitored. It seems quite confusing, but let's make a real-life example. How would you monitor if a disk backup has been completed successfully? One quick answer would be: knowing when the backup task starts and how long it lasts, we can define...