Different notification for different user for the same Service problem

Hi,
I worked now for several month with icinga2 but from time to time I run in problems :frowning:
Now I have a notification problem.
I would like to notify User_A for all Service Problems (warning, critical, unknown …) and User_B only if the Service is critical.
Any idea or best practice for this issue.

I can setup two notification, one with all states (warning, critical, unknown …) and one with only for critical. But how add these notification to the Services that in case of problems the User get the right notification? Not really clear for me.

Thanks for help
Joern

Let me try to draw the picture for you.

To get notified you start by the service which has to be checked and change the state, this has to be the same in your case.
Next step is the notification object which is defined with a state and type when a notification should be send and a user (group) it should be send to. So here you could differentiate by creating to different notification objects for User_A and User_B which differ by the state attribute.
Last step for the notification would be the user object which also has state and type to decide which notification he wants. So you can also differentiate at this level between User_A and User_B.

So what would I do? It depends why the users want different notification setups and on the scope. If User_A always wants all and User_B always only want critical, then I would do it on the user level, if it is for a very specific service I what do it by creating different notification objects.

And one last thing: I really hate if people only want critical notifications, because critical means something is broken so people are only reacting, warning means something is going to break and people can react proactively before something has an impact to a service. :wink:

Hi Dirk,
thanks for reply. The first step to create a different notification objects I was thinking about it but not sure how to implement it in the Service definition. It is possible to distinguish a state in a service definition?
And how can I decide the state or type in a user object?

Btw. The only critical notification is for my “chief”. On some Services he will only informed by critical issues. Me and my colleagues of course get warnings too :slight_smile:

You can have something like this:

apply Notification "mail-to-workers" to Service {
  import "mail-to-service"
  state = [ Warning, Unknown, Critical, OK ]
  user_groups = [ "worker" ]
  assign where service.name
}


apply Notification "mail-to-chief" to Service {
  import "mail-to-service"
  state = [ Critical ]
  users = [ "chief" ]
  assign where service.name
}

It is a very basic example, but shows you you can use the same assign rule for two different notification apply which differ by user/usergroup and state. So simple it is, but of course it gets more complicated if it is more specific.

For the attributes of the object you can also have a look at the docs https://icinga.com/docs/icinga2/latest/doc/09-object-types/#notification

Hi Dirk
thanks for the hint. Looks like that could be solved my “problem” :wink: