Cannot increase interval notifications

Hi,

I have a a check that “checks apt packages” and I’m trying to increase the notification interval to 24h but it seems that I still get the 30min notifications.

Apply Service Configuration

apply Service "apt_critical-by_ssh" {
  import "generic-service"

template “generic-service”

template Service "generic-service" {
  max_check_attempts = 5
  check_interval = 5m
  retry_interval = 2m

  enable_notifications = true

  vars.notification["mail"] = {
    groups = [ "MY_GROUP" ]
  }
}

Template notification

template Notification "apt-service-notification" {
  interval = 24h

  command = "mail-service-notification"

  states = [ OK, Warning, Critical, Unknown ]
  types = [ Problem, Acknowledgement, Recovery, Custom,
            FlappingStart, FlappingEnd,
            DowntimeStart, DowntimeEnd, DowntimeRemoved ]

  period = "24x7"
}

Apply Notification

apply Notification "mail-icingaadmin" to Service {
  import "mail-service-notification"
  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users

  assign where host.vars.notification.mail && (service.name != "apt_critical-by_ssh" || service.name != "apt")
}

apply Notification "apt-upgrade_notifications" to Service {
  import "apt-service-notification"

  user_groups = ["MY_GROUP"]
  assign where service.name == "apt_critical-by_ssh" || service.name == "apt"
}

Please describe your problem as detailed as possible and don’t forget to use a meaningful title :slight_smile:
We also have a markdown formatting guide to help you make your topics more readable!

  • Version used: r2.13.2-1
  • Operating System and version: Debian Buster
  • Enabled features (icinga2 feature list): Enabled features: api checker graphite ido-mysql mainlog notification perfdata
  • Config validation (icinga2 daemon -C): Validation is OK

Can someone help?

I’m not sure why the service is still sending notifications every 30 minutes

Thanks in advance!

You have a logic error in your configuration:

The (service.name != "apt_critical-by_ssh" || service.name != "apt") part is always true, so this rule still applies everywhere where host.vars.notification.mail is set.

So that should either be

assign where host.vars.notification.mail && !(service.name == "apt_critical-by_ssh" || service.name == "apt")

or

assign where host.vars.notification.mail && service.name != "apt_critical-by_ssh" && service.name != "apt"

(Ahhh, de Morgan strikes again - or, rather, he missed… :-))