Setting Host Variable to Service Output Value

(Stephen Sumrall) #1

I’m collecting SNMP information in several services. I’d like to have that information as part of the host object, too, for creating dependencies. Using Director I’ve unsuccessfully tried to set a variable in the host object to the output from the service. I have successfully queried the value in the console using the command below but cannot get it to work in Director.

ICINGA2_API_PASSWORD=MyPassword icinga2 console --connect ‘https://root@localhost:5665/’ --eval ‘get_service(“”, “SO-Check-SNMP-systemRacName”).last_check_result.output’
"SNMP OK - \”Rack JB007\” "

My ultimate goal is to create host-to-host dependencies between endpoints and their respective router.

What options do I have for setting a variable on the host object to the service output using Director?

icinga2 - The Icinga 2 network monitoring daemon (version: r2.10.5-1)

System information:
Platform: Red Hat Enterprise Linux Server
Platform version: 7.6 (Maipo)
Kernel: Linux
Kernel version: 3.10.0-957.21.2.el7.x86_64
Architecture: x86_64

Build information:
Compiler: GNU 4.8.5