Page 1 of 1

Feature Request: Dynamic Assignment of Checks

Posted: Thu Mar 23, 2017 6:55 am
by mopp
Hi,

you might know Icinga2 and the Monitoring as Code approach.
I know with hostgroups you can do some kind of dynamic check assignment, but it would be nice to have more flexible options.
In Icinga2 you can do things like

Code: Select all

assign where match("*has gold support 24x7*", service.notes) && (host.vars.customer == "customer-xy" || host.vars.always_notify == true)
Or

Code: Select all

if (host.vars.environment == "dev") {
     check_interval = 30m
   } else {
     check_interval = 5m
   }
I know it will not be possible to change the way Nagios saves the configuration files, but maybe in CCM it would be possible to tag servers with DEV or PROD and CCM will automatically assign the checks which match certain criteria. So I don' t have to put the server in multiple hostgroups, I'll just tag the server with certain attributes and CCM will assign the right checks. It will speed up things in a dynamic world.

Re: Feature Request: Dynamic Assignment of Checks

Posted: Thu Mar 23, 2017 1:35 pm
by tmcdonald
I can see about having this added, but in a sense couldn't hostgroups act just like tags in this scenario? Or templates?

Re: Feature Request: Dynamic Assignment of Checks

Posted: Thu Mar 23, 2017 6:00 pm
by mopp
Of course hostgroups and templates will work, too.
At the end this monitoring as code will provide you slightly more flexibility and dynamic, e. g. it is also possible to change the the threshold based on certain rules.

Code: Select all

{ check_command = "load” host_name = ”backup.abc.com”
vars.load_warning = {{ 
if (get_time_period("backup").is_inside)
  { return 20 } else { return 5 }
}} } 
I know it is not possible to get this into Nagios without changing everything, but to add some more dynamic and flexibility would be nice.
You can close the thread