Skip to content
This repository has been archived by the owner on Apr 16, 2018. It is now read-only.

[dev.icinga.com #11366] Objects need an option to insert user-defined code #349

Open
icinga-migration opened this issue Mar 13, 2016 · 1 comment

Comments

@icinga-migration
Copy link

This issue has been migrated from Redmine: https://dev.icinga.com/issues/11366

Created by dagobert on 2016-03-13 11:27:31 +00:00

Assignee: (none)
Status: New
Target Version: (none)
Last Update: 2016-07-30 21:17:54 +00:00 (in Redmine)


In many objects one can have more sophisticated logic that is influencing its behaviour.

The following is an example of if statements that change the outcome of a notification depending on other values.

apply Notification "host-mail-noc" to Host {
  import "mail-host-notification"

  // replace interval inherited from `mail-host-notification` template with new notfication interval set by a host custom attribute
  if (host.vars.notification_interval) {
    interval = host.vars.notification_interval
  }

  // same with notification period
  if (host.vars.notification_period) {
    period = host.vars.notification_period
  }

  // Send SMS instead of email if the host's custom attribute `notification_type` is set to `sms`
  if (host.vars.notification_type == "sms") {
    command = "sms-host-notification"
  } else {
    command = "mail-host-notification"
  }

  user_groups = [ "noc" ]

  assign where host.address
}

It would be nice and fairly easy to add an option that is "printed unchanged" by the template.

@icinga-migration
Copy link
Author

Updated by buzzdeee on 2016-07-30 21:17:54 +00:00

Hi,

I was just to open another ticket, then I saw this, I really would like to have a generic way to add functionality like this.
I.e. where I need it is in the checkcommands, for example to use functions as values for the parameters, for example to create stuff like this:

...
    "--ssl" = {
                set_if = "$have_ssl$"
              }
...

In the "current" state of art, it creates things like:

"--ssl" = "{\n set_if=$ssl$\n }\n"

that breaks the whole command.

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
None yet
Development

No branches or pull requests

1 participant