Go to All Forums

API - list all current maintenance instances

We're using OctopusDeploy to release our software to various environments, and within the process we're querying the Site24x7 API to put servers in to maintenance mode so we're not alerted during releases. Once a successful release is finished, the last step of the process ends the maintenance object via the API. Unfortunately if the release process does not end successfully, we lose access to the maintenance ID object carried through the process, so servers are left in maintenance.

I'm trying to query the API to list all current maintenance as we see in the Site24x7 interface (www.site24x7.com/app/client#/admin/operations/view-maintenance-monitors), however /api/maintenance lists all maintenance instances that have ever existed, and there are no parameters that can be given to list only current maintenance. I can see that the aforementioned page gets its data from /api/current_maintenance_list, which returns JSON as attached. 

 

Please can the /api/current_maintenance_list be exposed for end users to access via the API? Or can functionality be considered to enable us to list active maintenance objects?

 

Cheers.

Like (2) Reply
Replies (2)

Re: API - list all current maintenance instances

Hi,

You can get the id of in progress maintenance using the "maintenance_status" attribute from the list returned in /api/maintenance.

https://www.site24x7.com/help/api/#list-maintenance

"maintenance_status" : "I" means, it is in progress.

https://www.site24x7.com/help/api/#schedule_maintenance_status_constants

Then you can pass that maintenance_id to "/api/end_maintenance" api to stop it.

https://www.site24x7.com/help/api/#end-resource-maintenance

Hope this helps. We will also look into documenting the api current_maintenance_list.

Thillai.

Like (0) Reply

Re: Re: API - list all current maintenance instances

Hi Thillai,

Thanks for your reply. I had initially done it that way, however we have nearly 800 maintenance instances so far, so pulling back that much data to find a few current instances seems inefficient. Hopefully we'll be able to use current_maintenance_list which would make this much more efficient.

 

Cheers,

Matt

Like (0) Reply

Was this post helpful?