Command and service definitions

At the base of everything in Nagios is a plugin, the minion who carries out the job of retrieving the information, evaluating it, raising the alarm, and providing a meaningful message. Left alone, Nagios does not know how to call a plugin, what options to pass to it or how to handle it, so we need a command definition, which defines how the script will be called.

Let's take as an example the command definition for the ssh service check, which is failing because the port used for the check is not the one the daemon is listening on:

# 'check_ssh' command definitiondefine command{command_name check_sshcommand_line /usr/lib/nagios/plugins/check_ssh '$HOSTADDRESS$'}

We can see here a command definition named command_name ...

Get Mastering Bash now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.