icingadb-web icon indicating copy to clipboard operation
icingadb-web copied to clipboard

Downtime: delete all downtimes of a host and its service via icingadb api withouth the need to address individual downtime guids

Open K0nne opened this issue 1 year ago • 3 comments

Is your feature request related to a problem? Please describe.

Today we use the monitoring-module's api to schedule and remove downtimes for hosts and their services on demand in automated ways. The old monitoring module handles the removal in the following way:

../icingaweb2/monitoring/downtimes/delete-all?host_name=<hostname>

If I want to do this with icingadb, it's api call references multiple downtimes, combined with their individual guids: image

Describe the solution you'd like

Is it possible to remove all downtimes for a host an it's services with icingadb's api without the need to adress these guids? Something like:

../icingaweb2/icingadb/downtimes/delete-all?name=<hostname>

Additional context

This issues forces us to keep the old monitoring module activated in the background.

K0nne avatar Sep 17 '24 15:09 K0nne

Thank you very much for the quick fix 🥇

K0nne avatar Sep 18 '24 12:09 K0nne

It's not merged yet ;)

nilmerg avatar Sep 18 '24 13:09 nilmerg

Sorry, I was too euphoric 🙈 We are using the fix already

K0nne avatar Sep 18 '24 13:09 K0nne

Hello again!

Out user also whish for a way to remove downtimes for individulal services. The usage of /icingaweb2/icingadb/downtimes/delete?host.name=<hostname> to remove them all is in some cases too much on an sledgehammer approach, where users need to remove only individual downtimes one after another.

Could you expand the functionality? Something like /icingaweb2/icingadb/downtimes/delete?service.name=<hostname>!<servicename> whould be helpful.

K0nne avatar Apr 01 '25 07:04 K0nne

If I'm not mistaken, the linked pull request allows to pass any filter the comment/downtime list also accepts. If you search there for the downtimes you want to remove and use the same filter for the automation endpoint, it should affect only those you saw in the list as well.

nilmerg avatar Apr 01 '25 09:04 nilmerg

This approach works, but unfortunately you need to know the individual guid of every single service downtime, which is hidden knowledge outside of icinga. Also I expect the guid to be ever changing.

/icingaweb2/icingadb/downtimes/delete?name=<host_name>%21<service_name>%21<individual_guid> {"status":"success","data":[{"type":"success","message":"Removed downtime successfully"}]}

The users only know their host- and the service-names. With knowledge of the known facts alone I am unable to delete a service downtime:

/icingaweb2/icingadb/downtimes/delete?name=<host_name>%21<service_name> {"status":"error","message":"No command targets found"}

Am I maybe doing things wrong?

K0nne avatar Apr 03 '25 12:04 K0nne

Try /icingaweb2/icingadb/downtimes/delete?host.name=<host-name>&service.name=<service_name>. With any filter, I meant any filter ;)

nilmerg avatar Apr 04 '25 07:04 nilmerg

Thank you so much for clarification!

K0nne avatar Apr 04 '25 08:04 K0nne