Using the HTTP API
You can change the notification delay using the web services HTTP API. This would be the recommended method. Some examples are shown below.
It should be noted that these commands will only change the value for the template and thus will affect host/services added after the fact, not for any hosts/services that are already added.
Set the notification delay to 15 minutes for default host and services template:
curl -k -X PATCH -H 'content-type: application/json' -d '{"first_notification_delay": "15"}' -u 'user:password' https://monitor.host/api/config/host_template/default-host-templatecurl -k -X PATCH -H 'content-type: application/json' -d '{"first_notification_delay": "15"}' -u 'user:password' https://monitor.host/api/config/service_template/default-service
Set the notification delay back to nothing:
curl -k -X PATCH -H 'content-type: application/json' -d '{"first_notification_delay": "0"}' -u 'user:password' https://monitor.host/api/config/host_template/default-host-templatecurl -k -X PATCH -H 'content-type: application/json' -d '{"first_notification_delay": "0"}' -u 'user:password' https://monitor.host/api/config/service_template/default-service
Get a list of done changes and commit these:
curl -k -X GET -u 'user:password' https://monitor.host/api/config/changecurl -k -X POST -u 'user:password' https://monitor.host/api/config/change
Using the older OP5 API from the shell
The script would need to be edited to set the service and host notification delay or to make them variable.
This script is called with the extend parameter or reset.
change_delay.sh extend
change_delay.sh reset
You can create a cron file in /etc/cron.d to run the attached check_delay shell script with the relevant cron time entires. For more information on cron entries, refer to “More about /etc/crontab file and /etc/cron.d/* directories” in https://www.cyberciti.biz/faq/how-do-i-add-jobs-to-cron-under-linux-or-unix-oses/
Comments
0 comments
Please sign in to leave a comment.