Hi,
I am able to place the host/service in scheduled downtime using below command
curl --silent --show-error --data cmd_typ=86 --data cmd_mod=2 --data host="XXXXX" --data com_data="Placing server in scheduled downtime from command line" --data trigger=0 --data start_time="05-20-2019 17:20:00" --data end_time="05-20-2019 17:30:00" --data fixed=1 --data hours=2 --data minutes=0 --data btnSubmit=Commit --insecure https://localhost/nagios/cgi-bin/cmd.cgi -u username:passwd
Can you advice how to delete/cancel the services from maintenance mode ?
Need help on host/service removal from maintenance mode
-
npolovenko
- Support Tech
- Posts: 3457
- Joined: Mon May 15, 2017 5:00 pm
Re: Need help on host/service removal from maintenance mode
@bsivavani, You can schedule/delete downtime using the API. I think you need to upgrade to XI 5.6.2 to get access to these commands.
1. Get the ID number of a particular downtime you want to delete. 2. Delete downtime using ID number via API command:
1. Get the ID number of a particular downtime you want to delete. 2. Delete downtime using ID number via API command:
You do not have the required permissions to view the files attached to this post.
As of May 25th, 2018, all communications with Nagios Enterprises and its employees are covered under our new Privacy Policy.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need help on host/service removal from maintenance mode
You would need to know the scheduled downtime ID, The only way I know how to get this is the following:
What you are looking for is the value on the downtimelist
Then in XI from
Help -> API Docs -> System Reference
follow the DELETE system/scheduleddowntime/<internal_id>
replacing <internal_id> with the ID you extracted above
Code: Select all
http://YOURHOST/nagiosxi/includes/components/nagioscore/ui/statusjson.php?query=downtimelist&hostname=XXXXX&apikey=XXXXXXXXXThen in XI from
Help -> API Docs -> System Reference
follow the DELETE system/scheduleddowntime/<internal_id>
replacing <internal_id> with the ID you extracted above
Re: Need help on host/service removal from maintenance mode
I tried with below command to cancel the scheduled downtime, but not able to remove/cancel maintenance mode.
curl --silent --show-error --data cmd_typ=86 --data cmd_mod=2 --data down_id=2 --data host="remotehost" --data com_data="Placing server in scheduled downtime from command line" --data trigger=0 --data fixed=1 --data childoptions=0 --data btnSubmit=Commit --insecure https://localhost/nagios/cgi-bin/cmd.cgi -u username:password
curl --silent --show-error --data cmd_typ=86 --data cmd_mod=2 --data down_id=2 --data host="remotehost" --data com_data="Placing server in scheduled downtime from command line" --data trigger=0 --data fixed=1 --data childoptions=0 --data btnSubmit=Commit --insecure https://localhost/nagios/cgi-bin/cmd.cgi -u username:password
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need help on host/service removal from maintenance mode
This isn't going to work.
First cmd_typ=86 is for creating downtime not removing it
Second, where did you get the ID (2) you are using as the down_id ?
If it was going to work this way at all it would be with the following, replacing XXXX with the actual downtime ID
First cmd_typ=86 is for creating downtime not removing it
Second, where did you get the ID (2) you are using as the down_id ?
If it was going to work this way at all it would be with the following, replacing XXXX with the actual downtime ID
Code: Select all
curl --silent --show-error --data cmd_typ=78 --data cmd_mod=2 --data down_id=XXXX --data btnSubmit=Commit --insecure https://localhost/nagios/cgi-bin/cmd.cgi -u username:passwordRe: Need help on host/service removal from maintenance mode
Thanks for the update. Please close the request.
-
scottwilkerson
- DevOps Engineer
- Posts: 19396
- Joined: Tue Nov 15, 2011 3:11 pm
- Location: Nagios Enterprises
- Contact:
Re: Need help on host/service removal from maintenance mode
Greatbsivavani wrote:Thanks for the update. Please close the request.
Locking