[icinga-users] Overriding Ping4 thresholds

Michael Friedrich Michael.Friedrich at netways.de
Sun Nov 15 12:48:58 CET 2015


> On 12 Nov 2015, at 21:14, Lance Reed <reed.r.lance at gmail.com> wrote:
>
> I suspect my question has been answered multiple times in the past,
> but I am not easily finding answers so here goes.
>
> I have multiple remote locations that use VPNs, so ping latency can
> often go failure high and I get alerts on hosts and ping4 checks (the
> default checks).
>
> We use multiple custom vars for things like location, and environment etc.
> Because of this it was easy to setup in each hosts file created via
> puppet to override hostalive.
>
> e.g.
>
> object Host "somehost.abcd.com" {
>      import "generic-host"
> ...
>  vars.ping_wrta = "500"
>  vars.environment = "abcd"
>  vars.customer_monitored = "true"
>  vars.customer = "abcd"
>  vars.ping_cpl = "30"
> }
>
>
> That works well.  However the default service checks are using default
> attributes for ping4 which are not modified.
>
> I am wondering what people use to override default values for existing
> service checks that get applied.
> Or do I have to modify what type of check gets used in my host object
> and make sure the correct one is used much like hostalive.  I'd prefer
> not to have any more Custom Vars added to each host object if
> possible.

I’d personally set these thresholds inside the service apply rules, and use the assign where/ignore where expressions to selectively apply certain services with different thresholds. Similar to what Thomas already posted.

A different approach might also be to add conditionals inside your service apply rules, for example:

apply Service “ping4” {
  check_command = “ping4”

  if (host.vars.customer == “abcd”) {
    vars.ping_cpl = 50
  } else if (host.vars.customer == “efgh”) {
    vars.ping_cl = 30
  } else { //default
    vars.ping_cpl = 40
  }

  assign where host.address
}

Service apply rules may access all host configuration attributes, so you’re not bound to custom variables here. One could also match against the host name, or its display_name.

Kind regards,
Michael


-- 
Michael Friedrich, DI (FH)
Senior Developer

NETWAYS GmbH | Deutschherrnstr. 15-19 | D-90429 Nuernberg
Tel: +49 911 92885-0 | Fax: +49 911 92885-77
GF: Julian Hein, Bernd Erk | AG Nuernberg HRB18461
http://www.netways.de | Michael.Friedrich at netways.de

** OSMC 2015 - November - netways.de/osmc **
** OSDC 2016 - April – netways.de/osdc **


More information about the icinga-users mailing list