Using adaptive monitoring
Nagios provides a very powerful feature called adaptive monitoring that allows the modification of various check-related parameters on the fly. This is done by sending a command to the Nagios external command pipe.
The first thing that can be changed on the fly is the command to be executed by Nagios, along with the attributes that will be passed to it-an equivalent of the check_command
directive in the object definition. In order to do that we can use the CHANGE_HOST_CHECK_COMMAND
or CHANGE_SVC_CHECK_COMMAND
command. These require the hostname, or the hostname and service description, and the check command as arguments.
This can be used to actually change how hosts or services are checked, or to only modify parameters that are passed to the check commands-for example, a check for ping latency can be modified based on whether a primary or a backup connection is used. An example to change a check command of a service, which changes the command and its specified parameters...