Dynamic notification periods?

I’m trying to implement a dynamic notification scheme in Icinga2, and failing to come up with something useful :frowning:

We have a 6-person team that are on-call 1 week each.

Depending on the specific hosts SLA the notifications are only supposed to be created within certain TimePeriods.

During working hours the whole group is supposed to receive pages.

Outside of working hours only the person on duty is supposed to receive pages.

I’ve gotten as far as assigning Hosts to SLA-Specific HostGroups and assiging appropriate TimePeriods to the Hosts and Services belonging to those Hosts (I think) - by way of assign where.

I’ve also defined a couple of UserGroups, 1 for the whole team, and 1 for the currently on-call User.

But, for the life of me, I can’t figure out how to set up notifications to only get sent during the appropriate TimePeriods :-/

I hope to get some help/inspiration here :slight_smile:

Notifications don’t depend as much on hosts and services but on the consumer of the events.
So you have a notification methods (the notification objects) with specific filter capabilities and additional filters per assigned user objects. Maybe this is obvious to you but I stumbled in the past over what part does what and which filter works a certain way on which object. Update 03-monitoring-basics.md · Icinga/icinga2@34b8fe8 · GitHub

For complex setups you could also handle the logic in the notification scripts or use a specialized external tool.

1 Like

Thanks for the info :slight_smile:

Unfortunately it doesn’t seem to bring me any closer to figuring out how to set up things so that SLA-specific TimePeriods are observed?

as Rivad already said: handle the logic inside the notification script.
the notification script gets executed every time but only if datetime->now() is inside your sla slot it will send out an email to all
to implement the on duty part do the same, implement a logic that fetches the persons email on-duty.