0

I am new to icinga. I would like to divide my hosts into groups let say host_group_1 and host_group_2. Then I want to send notifications to different users_group, let say users_group_1, and users_group_2.

So all the notifications from host_group_1 should goes to users_group_1 and host_group_2 notifications should go to users_group_2. Which files I need to modify to achieve this? I tried to divide hosts like os= group_1 and group_2.

But in the node, how can I define that the this host belongs to group_1 ; so that I can later use this tag in the icinga master.

Zoe
  • 27,060
  • 21
  • 118
  • 148

1 Answers1

0

We are doing this by setting a variable in the host/service definition. Inside the notification you can trigger on this variable.

apply Service "ssh" {
  vars.group = "1"
}
object Host "sw1" {
  vars.group = "1"
}
object Notification "notify1" {
  user_groups = xxx
  // or
  users = [
     "userA",
     "userB"
  ]
  assign where host.var.group == "1" || service.vars.group == "1"
}
object Notification "notify2" {
  user_groups = yyy
  // or
  users = [
     "userC",
     "userD"
  ]
  assign where host.var.group == "1" || service.vars.group == "1"
}
iptizer
  • 1,088
  • 1
  • 10
  • 19