Notification for service doesn't work correctly

  • Version used (icinga2 --version)
ii  icinga-l10n                          1.3.0-1+debian11                                                           all          Icinga localization
ii  icinga-php-common                    1.0.0-1.buster                                                             all          Icinga PHP Common for Icinga Web 2
ii  icinga-php-library                   0.13.1-1+debian11                                                          all          Icinga PHP Library - IPL
ii  icinga-php-thirdparty                0.12.0-1+debian11                                                          all          Icinga 3rd party PHP libraries
ii  icinga2                              2.14.0-1+debian11                                                          amd64        host and network monitoring system
ii  icinga2-bin                          2.14.0-1+debian11                                                          amd64        host and network monitoring system - daemon
ii  icinga2-common                       2.14.0-1+debian11                                                          all          host and network monitoring system - common files
ii  icinga2-doc                          2.14.0-1+debian11                                                          all          host and network monitoring system - documentation
ii  icinga2-ido-mysql                    2.14.0-1+debian11                                                          amd64        host and network monitoring system - MySQL support
ii  icingacli                            2.12.1-1+debian11                                                          all          Icinga CLI
ii  icingaweb2                           2.12.1-1+debian11                                                          all          Icinga Web
ii  icingaweb2-common                    2.12.1-1+debian11                                                          all          Common files for Icinga Web and the Icinga CLI
ii  opsgenie-icinga2                     2.17.0                                                                     all          OpsGenie - Icinga2 integrations files including marid and Icinga2 scripts
ii  php-icinga                           2.12.1-1+debian11                                                          all          Icinga Web PHP library
ii  vim-icinga2                          2.14.0-1+debian11                                                          all          syntax highlighting for Icinga 2 config files in VIM
  • Operating System and version
11.8
PRETTY_NAME="Debian GNU/Linux 11 (bullseye)"
NAME="Debian GNU/Linux"
VERSION_ID="11"
VERSION="11 (bullseye)"
VERSION_CODENAME=bullseye
ID=debian
HOME_URL="https://www.debian.org/"
SUPPORT_URL="https://www.debian.org/support"
BUG_REPORT_URL="https://bugs.debian.org/"
  • Enabled features (icinga2 feature list)
Disabled features: compatlog debuglog elasticsearch gelf icingadb influxdb influxdb2 journald opentsdb perfdata statusdata syslog
Enabled features: api checker command graphite ido-mysql livestatus mainlog notification
  • Icinga Web 2 version and modules (System - About)
Icinga Web 2 Version	2.12.1
Git Commit	cd2daeb2cb8537c633d343a29eb76c54cd2ebbf2
PHP-Version	7.4.33
Git Commit Datum	2023-11-15
  • Config validation (icinga2 daemon -C)
No configuration errors.
  • If you run multiple Icinga 2 instances, the zones.conf file (or icinga2 object list --type Endpoint and icinga2 object list --type Zone) from all affected nodes

The problem is that in our config we comment out the notification for our developers with mail but the service continues to send mails for warnings or errors for that service.
Here is the definition of the variables:

apply Service "instances_api_ftp_out_queue" {
  import "check-instances-api"
  display_name = "FTP-Out Queue"
  vars.instances_api_url = "xxxxxxxxxxxxxxxxxxxxxx"
  vars.instances_api_url_path = "xxxxxxxxxxxxxxxxxxx"
  vars.instance_api_key = "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx"
  vars.notifications_mamdam = "false"
  assign where host.name == "instances-api"
}

And in icinga2web we still can see that the service is doing that notifications but the variables to not do so are also correctly set:

Benachrichtigungen
Benachrichtigungen	7 Benachrichtigungen wurden für dieses Problem versandt.
Die letzte wurde vor 21m 39s gesendet.
Kontakte	Ops, MAM / DAM, NOC Office
Kontaktgruppen	Datacenter Group, MAM / DAM Notification Group
Check-Ausführung
Befehl	check_instances_api
Check-Quelle	pr-be-ic-mas-02
Erreichbar	ja 
Letzter Check	vor 5m 47s 

Nächster Check	in 2m 7s
Check-Versuche	1/3 (hard)
Check-Ausführungsdauer	1,55s
Check-Latenz	0.0003s
Benutzerdefinierte Variablen
instance_api_key	xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
instances_api_url	xxxxxxxxxxxxxxxxxxxxxx
instances_api_url_path	xxxxxxxxxxxxxxxxx
notifications_admins	true
notifications_mamdam	false
notifications_office_monitoring_sound	true
notifications_opsgenie	false

The newest packages were installed and both master servers have been rebooted today but the problem still persists.
What can be done here?

Greetings
dcz01

Hello @dcz01!

Please specify this:

Hi @Al2Klimov

Well i just meant that we first had that notification definition on the service for all but now for each service separatly to also switch it off but that doesnt seem to work.

template Service "check-instances-api" {
  check_command = "check_instances_api"

  max_check_attempts = 3
  check_interval = 8m
  retry_interval = 5m

  vars.notifications_admins = "true"
  vars.notifications_opsgenie = "false"
  vars.notifications_office_monitoring_sound = "true"
#  vars.notifications_mamdam = "true"
}

what’s your notification apply rule?

@moreamazingnick

Hi,
Well our notification apply rule is the following:

apply Notification "mamdam_group_service" to Service {
  import "mamdam-mail-service-notification"
  user_groups = ["mamdam"]
  interval = 0
  vars.notification_logtosyslog = true

  assign where service.vars.notifications_mamdam
  ignore where match("st-*", host.name)
}

what happens if you write

vars.notifications_mamdam = false
or
vars.notifications_mamdam = true

@moreamazingnick
That was the solution.
Now it workes fine without sending a mail.
Thanks a lot.

Greetings
dcz01