Nagios can process commands from external applications (including the CGIs) and alter various aspects of its monitoring functions based on the commands it receives. External applications can submit commands by writing to the command file, which is periodically processed by the Nagios daemon.

Enabling External Commands

External Commands

In order to have Nagios process external commands, make sure you do the following:

When Does Nagios Check For External Commands?

Using External Commands

External commands can be used to accomplish a variety of things while Nagios is running. Example of what can be done include temporarily disabling notifications for services and hosts, temporarily disabling service checks, forcing immediate service checks, adding comments to hosts and services, etc.

Command Format

External commands that are written to the command file have the following format...

[time] command_id;command_arguments

...where time is the time (in time_t format) that the external application submitted the external command to the command file. The values for the command_id and command_arguments arguments will depend on what command is being submitted to Nagios.

External Command File - Example Setup

susie114:~ # ls -l /srv/app/nagios/var/rw/
total 0
prw-rw---- 1 nagios nagcmd 0 Jun 22 17:46 nagios.cmd

External Command File - Example Command Submission

susie114:~ # echo "`date +[%s]` PROCESS_SERVICE_CHECK_RESULT;testserver;check_trap_test;1;test" > /srv/app/nagios/var/rw/nagios.cmd

# tail /srv/app/nagios/var/nagios.log | grep trap

[1224133947] EXTERNAL COMMAND: PROCESS_SERVICE_CHECK_RESULT;testserver;check_trap_test;1;test
[1224133947] Warning:  Passive check result was received for service 'check_trap_test' on host 'testserver', but the host could not be found!

A full listing of external commands that can be used (along with examples of how to use them) can be found online at the following URL:

See Also See Also: Passive Checks, Adaptive Monitoring

English Deutsch 日本語

Table of Contents