Silence Notification for Service

I am tired of hearing every 30 minutes that there are 3 packages available for upgrade (0 critical updates).

To try and silence the apt check I added the following to notifications.conf:

apply Notification "notify-once" to Service {
  import "mail-service-notification"
  interval = 0
  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users
  assign where service.name == "apt"
}

I still get emails, but now every 2 hours.

How do I completely silence this check?

Hello,

just acknowledge the service or put enable_notification = false to the apt service.
if you have multiple notifications rule, make sure that the service apt is ignored by the other rules.

Regards,
Caarsten

1 Like
interval = 0

should silence your check after the first notification. Could it be that there are some changes like changing from warning to critical?

To completely silence it, do as @anon66228339 suggested.

1 Like

Thanks.

There are no state changes, it’s been apt on services is WARNING! for the past few weeks.

enable_notification = false on apt.conf prevents icinga2 from restating.

Can you show us an error message you get when trying to restart? Or show the output icinga2 daemon -C on the host where it refuses to restart?

1 Like
[2019-02-14 09:59:24 -0700] information/cli: Icinga application loader (version: r2.10.2-1)
[2019-02-14 09:59:24 -0700] information/cli: Loading configuration file(s).
[2019-02-14 09:59:24 -0700] information/ConfigItem: Committing config item(s).
[2019-02-14 09:59:24 -0700] information/ApiListener: My API identity: services
[2019-02-14 09:59:24 -0700] critical/config: Error: Attribute 'enable_notification' does not exist.
Location: in /etc/icinga2/conf.d/apt.conf: 4:3-4:29
/etc/icinga2/conf.d/apt.conf(2):   import "generic-service"
/etc/icinga2/conf.d/apt.conf(3):   check_command = "apt"
/etc/icinga2/conf.d/apt.conf(4):   enable_notification = false
                                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^
/etc/icinga2/conf.d/apt.conf(5):   assign where host.name == NodeName
/etc/icinga2/conf.d/apt.conf(6): }

[2019-02-14 09:59:24 -0700] critical/config: 1 error

You’re missing an ‘s’ here, it is enable_notifications in plural form. All available service object attributes can be found here.

Cheers,
Michael

Lol that fixed it. Thanks for the help everyone.

For future reference, how do I make a service notify only once at state change?

Notification object - interval = 0.