Nagios scripts

Nagios, an extensible monitoring framework, is well-know for its ability to provide convenient means to add user-defined monitoring tools. Apart from providing the supplied standard set of monitors, it’s possible to use ‘command’ directive to invoke an arbitrary command (e.g. run a program and/or script) to add user-written plugins (scripts).

To implement that, add proper definitions to /etc/nagios/misccomands.cfg or the corresponding configuration file in case you use custom config paths. Add ‘define command’ block with two directives: command_line and command_name, e.g.

define command{
command_name my_script
command_line /path/to/script/scriptname $HOSTADDRESS$ $ARG1$ $ARG2$ $ARG3$
}

(refer to Nagios reference on how to pass parameters). After that, use ‘check_command’ to run the defined command.

Glossary

Related terms:
Nagios configuration
Nagiosgraph
Nagios plugins