I am trying to schedule and cancel downtime in Nagios core 4.x.
I could schedule a downtime for a host using the following cmd:
curl --silent --show-error --data cmd_typ=55 --data cmd_mod=2 --data host=automichost1 --data "com_data=Updating+application" --data trigger=0 --data "start_time=05-15-2016 19:00:00" --data "end_time=05-15-2016 19:15:00" --data fixed=1 --data btnSubmit=Commit --insecure http://localhost:80/nagios/cgi-bin/cmd.cgi -u "nagiosadmin:XXXXXX"
This cmd does not return the downtime id generated and simply returns a html file.
but to cancel the schedule downtime i need to use following
curl --silent --show-error --data cmd_typ=78 --data cmd_mod=2 --data down_id=2 --data "com_data=Updating+application" --data btnSubmit=Commit --insecure http://localhost:80/nagios/cgi-bin/cmd.cgi -u "nagiosadmin:xxxxxxx"
Here I need down_id to Cancel a downtime. In an automation script there is no way to get this downtime id from any nagios external command. I also tried the following external command mentioned on http://docs.icinga.org/latest/en/cgiparams.html CMD_DEL_DOWNTIME_BY_HOST_NAME 171
but this is not working on Nagios and gives message "Sorry, but you are not authorized to commit the specified command.".
I am stuck now and cannot move forward. does anyone knows how to acheive this?