Hello together,
I am busy migration my configuration to Icinga2.

I would like to define default values within my service definition, but
beeing able to override these with host variables.

I wrote myself a custom function for this:

globals.get_host_default = function(key, default) {

  if ( key ) {
    return key
  } else {
    return default
  } 

}

Which is then applied to the service via this apply set:

apply Service "ssh_enforce_load" {
    import "generic-service"

    check_command = "ssh_enforce"
    display_name = "Load via SSH"

    vars.command = "load"

    vars.param1 = get_host_default(host.vars.load_warn", "10,9,8")
    vars.param2 = get_host_default(host.vars.load_crit", "25,20,15") 

    assign where host.vars.os == "Linux"
}

This works fine, for any strings and integers. Unfortunatly there are
checks where the value might be a boolean false. 
Is there a chance for the custom function to check if the value is set
like if (isset(?)) ?
I could build another custom function taking care for the boolean
special case, but I would like to keep this generally usable for all
types of parameters. Is this possible, or might there be an easier
solution for this?


Kind regards

Dirk
_______________________________________________
icinga-users mailing list
icinga-users@lists.icinga.org
https://lists.icinga.org/mailman/listinfo/icinga-users

Reply via email to