This functionality exists in the product, and as such the following is unsupported. These instructions should only be used for troubleshooting purposes.
For a complete list of what external commands that Naemon can receive, please see the External Command Reference.
There are multiple external commands for different kinds of downtimes. In this example, we will schedule a downtime for a host, with:
External commands are sent into the following file, as the "monitor" user:
The string that is sent in has the following values, in a single line sequence:
Example of full command to schedule a downtime for host "master01" that begins right now and lasts for 1200 seconds (20 minutes):
Functionality can be verified in naemon.log:
(...) EXTERNAL COMMAND: SCHEDULE_HOST_DOWNTIME;master01;1537271706;1537272706;1;0;3600;naemonadmin;This is an example comment.
Scheduling repeated downtimes via cron
Since the above bash command will generate a downtime for a host instantly, this can be added to monitor's cron if it should repeat. Crontab syntax:
Insert the following line:
Save the file and exit.
Since this line will run at 23:45 every day, a scheduled host downtime for "master01" will start at that time and will continue for 20 minutes.
Note that in this context, the "duration" value has no effect. As per the Naemon documentation:
If the ‘fixed’ argument is set to one (1), downtime will start and end at the times specified by the ‘start’ and ‘end’ arguments. Otherwise, downtime will begin between the ‘start’ and ‘end’ times and last for ‘duration’ seconds. The ‘start’ and ‘end’ arguments are specified in time_t format (seconds since the UNIX epoch). The specified host downtime can be triggered by another downtime entry if the ‘trigger_id’ is set to the ID of another scheduled downtime entry. Set the ‘trigger_id’ argument to zero (0) if the downtime for the specified host should not be triggered by another downtime entry.