Skip to content

Nagios / Monitoring plugin (nagios_plugin) ​

Runs a plugin that follows the Nagios plugin guidelines (the Monitoring Plugins, or your own), unchanged, from the script directory of the Probeward host. The exit status becomes health, the first line of output the message, and the performance data channels. Read Scripts, plugins and the security model first.

Only administrators can attach or change this sensor, and nothing runs until the administrator of the Probeward host sets PROBEWARD_SCRIPT_DIR and puts the plugins there.

Channels ​

KeyNameUnitDefault limits
exit_statusPlugin statusnone0 OK, 1 Warning (warning), 2 Critical (down)
run_msRun timemswarning above 10000
one per performance data entryits labelits unit, see belownone. Set limits on the sensor.

Parameters ​

ParameterDefaultMeaning
filerequiredThe plugin's file name inside the script directory, for example check_disk.
argsnoneUp to 32 arguments, passed one by one and never through a shell: ["-H", "{address}", "-p", "22"]. {address} and {hostname} are replaced by the device's address and host name. A value with spaces or shell characters is one argument, and arrives intact.
pass_secretfalseHand the sensor's secret credential to the plugin in the environment variable PROBEWARD_SECRET. Plugins that take a password on the command line cannot use it; wrap them in a script that reads the variable.

Suggested interval: 300 seconds. Credential: an optional secret, used when pass_secret is on.

Exit status ​

Exit statusResult
0OK: Up.
1WARNING: the sensor is Warning.
2CRITICAL: the sensor is Down.
3UNKNOWN: a collection failure (kind protocol), <plugin> reported UNKNOWN: <message>. The plugin could not tell, which is not the same as the thing being down.
anything else, or a signalA collection failure that says the status is not a plugin status, with the first line. 127 usually means a missing interpreter or library.

Output ​

The first line is message | performance data; the message is shown as it is, cut at 300 characters. Later lines are long text until a line holds |, from which point to the end of the output everything is performance data.

Performance data is read as label=value[UOM];warn;crit;min;max, entries separated by spaces:

PartRead as
labelThe channel's name. The key is made from it as for the incumbent format: /var/log becomes var_log, / becomes root. A label in single quotes may hold spaces ('free space'=3), and '' is a quote inside it. A clash with exit_status or run_ms, or with another label, gets _2.
valueA number; a comma decimal is accepted. U is unknown.
UOMB, KB, MB, GB, TB become bytes (times 1024 for each step) and us becomes milliseconds (divided by 1000), so the interface formats them as sizes and times. s, ms and % are kept as they are, and c (a counter) is a plain count (#). Nothing means a plain number. Any other unit is shown as the plugin wrote it.
warn, critRead and not used: the plugin has already judged, and its exit status is the verdict.
min, maxRead and not used.

An entry that cannot be read is skipped and counted in the message. At most 64 entries are kept.

Where names and units come from ​

The template knows exit_status and run_ms. Every performance data channel is named and given its unit by the plugin's own output: the label is the name (the key stays the identity of the channel and its history) and the unit of measure, normalised as above, is the unit. Probeward keeps the latest label and unit it saw for each key, per sensor, and shows them in the channel table, the graphs, the value summary in the tree and the limits editor. A plugin that changes a label's spelling but not the key (Free Space and free space are both free_space) is shown under its newest spelling. The text is untrusted: names are cut to 80 characters, units to 16, control characters are removed, and both are shown as plain text. A channel that has stopped appearing stays listed until newer ones push it out (a sensor remembers up to 100 channels). A plugin cannot rename exit_status or run_ms.

What was tested ​

Two kinds of test, reported separately because they are different claims. Representative output of the plugin guidelines is parsed in unit tests (quoted labels, units, several lines, unknown values, garbage). And the real Monitoring Plugins 2.3.3 from Debian bookworm (check_dummy, check_disk, check_load, check_tcp, check_procs), extracted from the Debian package in a container and run unchanged by the sensor against a real listening port, a real filesystem and the live process table. The test uses them from /usr/lib/nagios/plugins, /usr/lib/monitoring-plugins, the directory in PROBEWARD_TEST_PLUGIN_DIR, or extracts them with Docker. No other plugin collection has been run. Plugins that need a runtime (Perl, Python) need it installed on the probe host; the plugins are not shipped with Probeward.

Failures ​

The failures of the script sensor apply: the feature switched off, a missing or non-executable file, a timeout, too much output.

AGPL-3.0-only