Different notification options for same service depending on host

Hi there,

Say I’m running the built in swap check on two different machines - one one machine I want to know at all times whether swap is being used (and therefore page me for it) and for the other machine I don’t really care, but maybe it should send me an email notification in work hours. This is also the case for a number of different services that should run on all hosts - but depending on the host group they should have different notification policies

How would I go about setting something like this up - what would be the best practice for this setup?

Thanks very much,

Will.

Hi,

either you create 2 notification apply rules where the assign where expression matches either one or the other.

  assign where "linux-servers" in host.groups

  assign where "linux-servers" !in host.groups

Or you’ll go with conditional statements inside the apply rule itself.

  if ("linux-servers" in host.groups) {
    period = "24x7"
  } else {
    period = "workhours"
  }

If this doesn’t work, you can also move the period to the user level and only set the users or user_groups array to specific notification apply rules.

Cheers,
Michael

That’s great, thank you for your help!