## External Commands

Introduction

Nagios can process commands from external applications (including CGIs - see the command CGI for an example) and alter various aspects of its monitoring functions based on the commands it receives.

Enabling External Commands

By default, Nagios does not check for or process any external commands. If you want to enable external command processing, you'll have to do the following...

- Enable external command checking with the check_external_commands option
- Set the frequency of command checks with the command_check_interval option
- Specify the location of the command file with the command_file option. Its best to put the external command file in its own directory (i.e. /usr/local/nagios/var/rw).
- Setup proper permissions on the directory containing the external command file. Details on how to do this can be found here.

When Does Nagios Check For External Commands?

- At regular intervals specified by the command_check_interval option in the main configuration file
- Immediately after event handlers are executed. This is in addtion to the regular cycle of external command checks and is done to provide immediate action if an event handler submits commands to Nagios.

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 or CGI committed the external command to the command file. Some of the commands that are available are described in the table below, along with their command_id and a description of their command_arguments.

Implemented Commands

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:

http://www.nagios.org/developerinfo/externalcommands/