Automatic downtime OR disable notification based on UPS status

Hi,

Is there an easy way we can apply an automatic downtime or disable notification for all hosts/services that have the same vars.geolocation when the UPS status is critical ?

Sounds like intended use of dependency objects. Means, you define some dependencies from these host and service to UPS status to disable execution and/or its notifications.

@rsx

yeah but with the dependency, when the power will come UP, it will generate a ton of notification until all host are back online.

Maybe it will be better to use dependency when the satellite is down for this site AND also put all host/service in downtime when the UPS start on battery ?

Hi there,

you could write your own custom script and set downtime via API:
https://icinga.com/docs/icinga-2/latest/doc/12-icinga2-api/#schedule-downtime

Handle it as notification which will be triggered on OK / CRITICAL(on UPS host) to set / remove the Downtime.
You could also delete downtime when UPS is in OK state and set a second Downtime right away which will last for examle 10 Minutes (as grace period for all Hosts to come UP again).

Service / Hosts should be filterable by any vars in api command as I get it right (don’t use api to set downtime myself - so correct me please if I’m wrong here).

BR,
Chris

The above suggestion by ChrissK could be run by an event handler script that you could assign to the service checking on the UPS battery. So when the latter goes into a particular state (CRITICAL, say) your e.h. script is triggered and implements the downtimes.

1 Like