Assign where host.groups == "exemple" doesn't not work


(Arethusa) #1

Hello everyone,

I try to do "assign where host.groups == “exemple”

So first, I create my group:

object HostGroup "exemple" {
  display_name =  "exemple"

assign where host.address == "192.168.1.1"
assign where host.address == "192.168.1.2"
assign where host.address == "192.168.1.3"
assign where host.address == "192.168.1.4"
}

That works, I have my group on Icingaweb2.

But now, I want to do it on services.conf

apply Service "service_test" {
  import "service-snmpv3"
  check_command = "snmpv3"

  vars.snmpv3_oid = "1.3.6.1.2.1.25.........."

  vars.snmpv3_units = "%"

  vars.snmpv3_warn = 75
  vars.snmpv3_crit = 85

    #assign where host.address == "192.168.1.1"
    #assign where host.address == "192.168.1.2"
    #assign where host.address == "192.168.1.3"
    #assign where host.address == "192.168.1.4"

  assign where host.groups == "exemple"
}

So I want use assign where host.groups, instead of assign where host.address

But I doesn’t work, I don’t have error, but I have nothing on icingaweb2

So I suppose the problem is whith my line: assign where host.groups == "exemple"

Any suggestions?

Thank you.


#2

One example in the documentation suggests

assign where "hostgroup-dev" in host.groups

which is similiar to the solution in this thread.


(Arethusa) #3

Thank for answer, that looks good, in this exemple, I have to do:

apply Service "service_test" {
  import "service-snmpv3"
  check_command = "snmpv3"

  vars.snmpv3_oid = "1.3.6.1.2.1.25.........."

  vars.snmpv3_units = "%"

  vars.snmpv3_warn = 75
  vars.snmpv3_crit = 85

 assign where "exemple" in host.groups
}