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 a meaningful message. Left alone, Nagios 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 definition define command{ command_name check_ssh command_line /usr/lib/nagios/plugins/check_ssh '$HOSTADDRESS$' }
We can see here a command definition namedcommand_name check_ssh
.
Let's keep check_ssh
in mind, because it will be the handle we will use to refer to this command definition later on. As we can see, this definition is really short; it defines a handle, and, most importantly, the command line to call the plugin...