monitoring - How to declare a variable and reuse it in icinga2 hosts section? -
for use below config icinga2 host server work:
vars.health_check["my_module1"]={ host = "health_check_server_url" module = "my_module1" } vars.health_check["my_module2"]={ host = "health_check_server_url" module = "my_module2" }
the problem see have redeclare same host address. when put host address outside of service below, not work , reloading of icinga2
fails:
end_url = "health_check_server_url" vars.health_check["my_module1"]={ host = "$end_url$" module = "my_module1" } vars.health_check["my_module2"]={ host = "$end_url$" module = "my_module2" }
i tried use vars.end_url
again same scenario. how should declare variable in icinga2
.
you can use host's address $address$ if host's address url resolves should work like:
end_url = "health_check_server_url" vars.health_check["my_module1"]={ host = "$address$" module = "my_module1" } vars.health_check["my_module2"]={ host = "$address$" module = "my_module2" }
have looked icinga2 director?. it's handy , host configs more managed. also, monitoring-portal.org resource icinga community.
if use director can make clone of command , set arguments variables $end_url$ create field. can add field template(import) , enter once there.
for example use method snmp community strings. have field $snmp_community$ attached our templates. in command need community use variable. how icinga2 knows our lan distro's community strings, , if need change change once.
Comments
Post a Comment