Need help on host/service removal from maintenance mode

This support forum board is for support questions relating to Nagios XI, our flagship commercial network monitoring solution.
Locked
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Need help on host/service removal from maintenance mode

Post by bsivavani »

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 ?
npolovenko
Support Tech
Posts: 3457
Joined: Mon May 15, 2017 5:00 pm

Re: Need help on host/service removal from maintenance mode

Post by npolovenko »

@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.
Untitled2.png
2. Delete downtime using ID number via API command:
Untitled.png
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

Post by scottwilkerson »

You would need to know the scheduled downtime ID, The only way I know how to get this is the following:

Code: Select all

http://YOURHOST/nagiosxi/includes/components/nagioscore/ui/statusjson.php?query=downtimelist&hostname=XXXXX&apikey=XXXXXXXXX
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
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Re: Need help on host/service removal from maintenance mode

Post by bsivavani »

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
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

Post by scottwilkerson »

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

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:password
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
bsivavani
Posts: 339
Joined: Tue Oct 06, 2015 9:17 am

Re: Need help on host/service removal from maintenance mode

Post by bsivavani »

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

Post by scottwilkerson »

bsivavani wrote:Thanks for the update. Please close the request.
Great

Locking
Former Nagios employee
Creator:
Human Design Website
Get Your Human Design Chart
Locked