Re-notification interval based on time period


Say you have a notification apply rule defined with interval set to 1h. I would like to change the re-notification interval based on current time being within defined timeperiod. Something like this

if current_time is within 9to5 timeperiod; then
interval = 1h
interval = 0

I tried to use two separate notification apply rules but it tat approach has it problems. Is this doable using single notification apply statement and some kind of condition?

I have not tried this use case but perhaps you can get it to work similar to time dependent thresholds for services.

Haven’t tried it but maybe:

apply Notification "notification-name" to Host {
    import "some-notification"
    users = ["username"]

    interval = {
       if (get_time_period("9to5Timeperiod").is_inside) {
          return 1
       } else {
          return 0

     assign where something

Am unsure if you need to return ‘1h’, but I know 0 works without an ‘h’

It would need {{ and }} for returning a lambda so it is executed on every access of the interval.

And 0 works because durations are only a special form of number so without a unit it is in second, so it would result in interval 1s which is perhaps to much spam! :wink:

But except from this, this was what I had in mind.

Thank you! I’ll give it a try and report back :slight_smile: