## Adaptive Monitoring

Introduction

Nagios allows you to change certain commands and host and service check attributes during runtime. I'll refer to this feature as "adaptive monitoring". Please note that the adaptive monitoring features found in Nagios will probably not be of much use to 99% of users, but they do allow you to do some neat things.

What Can Be Changed?

The following service check attributes can be changed during runtime:

- Check command (and command arguments)
- Event handler command (and command arguments)
- Check interval
- Max check attempts

The following host check attributes can be changed during runtime:

- Check command (and command arguments)
- Event handler command (and command arguments)
- Check interval
- Max check attempts

The following global attributes can be changed during runtime:

- Global host event handler command (and command arguments)
- Global service event handler command (and command arguments)

External Commands For Adaptive Monitoring

In order to change global or host- or service-specific attributes during runtime, you must submit the appropriate external command to Nagios via the external command file. The table below lists the different attributes that may be changed during runtime, along with the external command to accomplish the job.

NOTE: When changing check commands or event handler commands, it is important to note that these commands must have been configured using command definitions before Nagios was started. Any request to change an check or event event handler command to use a command which has not been defined is ignore. Also of note, you specify command arguments along with the actual command name - just seperate individual arguments from the command name (and from each other) using bang (!) characters. More information on how arguments in command definitions are processed during runtime can be found in the documentation on macros.

Attribute | External Command | Notes
--- | --- | ---
Service check command | CHANGE_SVC_CHECK_COMMAND:command_name | Changes the service's current check command to whatever you specify in the command_name argument.
Service event handler | CHANGE_SVC_EVENT_HANDLER:command_name | Changes the service's current event handler command to whatever you specify in the command_name argument.
Service check interval | CHANGE_NORMAL_SVC_CHECK_INTERVAL:interval | Changes the service's normal check interval to be whatever you specify in the interval argument.
Service check retry interval | CHANGE_RETRY_SVC_CHECK_INTERVAL:interval | Changes the services' retry check interval to be whatever you specify in the interval argument.
Max service check attempts | CHANGE_MAX_SVC_CHECK_ATTEMPTS:attempts | Changes the maximum number of check attempts for the service to whatever you specify in the attempts argument.
Host check command | CHANGE_HOST_CHECK_COMMAND:command_name | Changes the host's current check command to whatever you specify in the command_name argument.
Host event handler | CHANGE_HOST_EVENT_HANDLER:command_name | Changes the host's current event handler command to whatever you specify in the command_name argument.
Host check interval | CHANGE_NORMAL_HOST_CHECK_INTERVAL:interval | Changes the host's check interval to be whatever you specify in the interval argument.
Max host check attempts | CHANGE_MAX_HOST_CHECK_ATTEMPTS:attempts | Changes the maximum number of check attempts for the host to whatever you specify in the attempts argument.
Global host event handler | CHANGE_GLOBAL_HOST_EVENT_HANDLER;command_name | Changes the current global host event handler command to whatever you specify in the command_name argument.
Global service event handler | CHANGE_GLOBAL_SVC_EVENT_HANDLER;command_name | Changes the current global service event handler command to whatever you specify in the command_name argument.