Notification on DowntimeCreated event

The topic has been brought up before & I’ll describe our use case:

We need a notification event triggered when a downtime is created.

Use case:
When a downtime is created an email notification should be sent out to recipients responsible for systems not monitored by our Icinga instance to take care of the downtime on their side. These downtimes by default get scheduled at least several hours before the downtime starting.

Maybe someone has written an event listener / handler for this.

Thanks

JP

Your script for handling host or service alerts needs to handle
$notification.type$ = DOWNTIMESTART and DOWNTIME END

That’s really all there is to it.

Antony.

@Pooh Sorry, I don’t want to be rude… I don’t need to handle downtime start & end. I need to handle downtime create. We plan a downtime several hours / days in advance & when planning (creating) the downtime a notification should be send out to non-company people depending on our services.

I’m not sure that this is implemented…

JP

I’ve I’ve understood you correctly this time, then you’re asking for a way to
put a machine into downtime, from some other script?

In that case, something like:

for type in Host Service
do
curl -k -s -u root:secretpassword -o /dev/null -H ‘Accept: application/json’
-X POST ‘https://your.icinga.server:5665/v1/actions/schedule-downtime’ -d ‘{
“type”: "’$type’", “filter”: “host.name==”’$name.of.server’"", “start_time”:
date +%s’, “end_time”: ‘date +%s -d "+$downtime seconds"’, “author”:
“maintenance script”, “comment”: “Machine being taken down for maintenance”,
“pretty”: false }’
done

Set $downtime to whatever period you think you need. As it standard the above
will put the machien into downtime starting now, but by changing the
start_time and end_time you can set whatever you like.

Hope that helps,

Antony.

Hi @Pooh

we use Icinga Web 2 where I can schedule downtimes. As an example: When I create (schedule) a new downtime for a host next sunday from 6am to 10am, I want a notification to be sent out right now when I save the scheduled downtime.

As far as I read the documentation & followed the community, there is no (Scheduled)DowntimeCreated event that is triggered when a future downtime is planned.

Right now a DowntimeStarted event is triggered when the downtime starts (sic), but what when you want some parties to be notified before (at creation of the scheduled downtime),

I hope I’ve made my point more transparent.

Best

JP

Hello Jprusch,
I hope you are well. I believe what you asking for is not possible in the Icinga application. The Icinga application can send out notification when a downtime starts and ends but your asking to send out a notification a certain time period before the the downtime starts. Correct? If so, this is not possible in the default Icinga configuration.

You could create a bash script to run at a certain time to do all this for you. A quick example below.

bash script ( or whatever programming language )
Line 1 - send email out on Sunday to team about downtime that will happen on Friday
Line 2 - use API commands to set downtime on Icinga host / service object on Friday.

I hope that helps
Alex

Thanks, that’s what I thought & knew.

Best

JP

Hello and welcome to the community!

Did any of the answers help you figure out a good way to solve your issue?
If yes, I would like to ask you to mark that answer as the “solution”.
If not, would you mind rephrasing your issue?

It seems like a plausible use case to me anyway, so I would run it by the devs next week and see what they think :slight_smile:

Have a nice weekend!
Feu

Hi @theFeu

the answers didn’t help me with the initial problem.

Story / Use case:

As an Icinga admin I would like to get persons notified when I created a scheduled downtime in the future to inform them in advance that a service/host will not be available.

This calls for an implementation of a DowntimeCreated event, which can be used by notification in the filter section of Icinga Web 2 / Icinga Director.

Thanks for your support & stay healthy!

JP