Icinga / icinga2

The core of our monitoring platform with a powerful configuration language and REST API.
https://icinga.com/docs/icinga2/latest
GNU General Public License v2.0
2.03k stars 579 forks source link

apply Notification "new-version" to Host doesn't seem to work #6349

Closed poing closed 6 years ago

poing commented 6 years ago

I created a new notification, based on an existing and working version. But it's not sending notifications, also IcingaWeb2 does not list any Contacts or Contactgroups when the new notification is applied to the Host.

Here is the working version, that my version is based on:

object Host "TEST" {
  import "generic-host"
  vars.os = "CUSTOM"
  address = "192.168.0.1"

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

apply Notification "mail-icingaadmin" to Host {
  import "mail-host-notification"
  user_groups = host.vars.notification.mail.groups
  users = host.vars.notification.mail.users
  assign where host.vars.notification.mail
}

In my version, below, I changed mail to afterhours.

object Host "TEST" {
  import "generic-host"
  vars.os = "CUSTOM"
  address = "192.168.0.1"

  vars.notification["afterhours"] = {
    groups = [ "icingaadmins" ]
  }
}

apply Notification "afterhours-icingaadmin" to Host {
  import "mail-host-notification"
  user_groups = host.vars.notification.afterhours.groups
  users = host.vars.notification.afterhours.users
  // period = "not_used_for_this_test"
  assign where host.vars.notification.afterhours
}

Expected Behavior

icinga2 daemon --validate = PASS mail-icingaadmin notifications are sent when applied to the TEST Host. afterhours-icingaadmin notifications are sent when applied to the TEST Host.

Current Behavior

icinga2 daemon --validate = PASS mail-icingaadmin notifications are sent when applied to the TEST Host. afterhours-icingaadmin notifications are NOT sent when applied to the TEST Host.

Possible Solution

Steps to Reproduce (for bugs)

  1. Create new Notification as shown above
  2. Apply to a Host
  3. icinga2 daemon --validate
  4. systemctl restart icinga2
  5. Create an alarm for the specified Host

Context

I am trying to create a Notification that's only sent during weekends, holidays, and outside of working hours. Where the Notification uses period to determine when notifications are sent.

In the example above, period is NOT used. Since I am having issues with creating a simple new Notification without applying any TimePeriod settings.

Your Environment

Copyright (c) 2012-2017 Icinga Development Team (https://www.icinga.com/) License GPLv2+: GNU GPL version 2 or later http://gnu.org/licenses/gpl2.html This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law.

Application information: Installation root: /usr Sysconf directory: /etc Run directory: /run Local state directory: /var Package data directory: /usr/share/icinga2 State path: /var/lib/icinga2/icinga2.state Modified attributes path: /var/lib/icinga2/modified-attributes.conf Objects path: /var/cache/icinga2/icinga2.debug Vars path: /var/cache/icinga2/icinga2.vars PID path: /run/icinga2/icinga2.pid

System information: Platform: CentOS Linux Platform version: 7 (Core) Kernel: Linux Kernel version: 3.10.0-862.3.2.el7.x86_64 Architecture: x86_64

Build information: Compiler: GNU 4.8.5 Build host: unknown

* Operating System and version:

CentOS Linux release 7.5.1804 (Core)

* Enabled features (`icinga2 feature list`):

Disabled features: command compatlog debuglog elasticsearch gelf graphite influxdb livestatus opentsdb perfdata statusdata syslog Enabled features: api checker ido-mysql mainlog notification

* Icinga Web 2 version and modules (System - About):
* Config validation (`icinga2 daemon -C`):

information/cli: Icinga application loader (version: r2.8.4-1) information/cli: Loading configuration file(s). information/ConfigItem: Committing config item(s). information/ApiListener: My API identity: i2m1.tmtj.invite-comm.jp warning/ApplyRule: Apply rule 'ping6' (in /etc/icinga2/conf.d/services.conf: 34:1-34:21) for type 'Service' does not match anywhere! information/ConfigItem: Instantiated 1 ApiListener. information/ConfigItem: Instantiated 3 Zones. information/ConfigItem: Instantiated 2 Endpoints. information/ConfigItem: Instantiated 1 FileLogger. information/ConfigItem: Instantiated 2 ApiUsers. information/ConfigItem: Instantiated 1 UserGroup. information/ConfigItem: Instantiated 2 NotificationCommands. information/ConfigItem: Instantiated 29 Notifications. information/ConfigItem: Instantiated 209 CheckCommands. information/ConfigItem: Instantiated 1 IcingaApplication. information/ConfigItem: Instantiated 5 Hosts. information/ConfigItem: Instantiated 2 HostGroups. information/ConfigItem: Instantiated 1 Downtime. information/ConfigItem: Instantiated 6 TimePeriods. information/ConfigItem: Instantiated 1 User. information/ConfigItem: Instantiated 3 ServiceGroups. information/ConfigItem: Instantiated 26 Services. information/ConfigItem: Instantiated 1 ScheduledDowntime. information/ConfigItem: Instantiated 1 CheckerComponent. information/ConfigItem: Instantiated 1 IdoMysqlConnection. information/ConfigItem: Instantiated 1 NotificationComponent. information/ScriptGlobal: Dumping variables to file '/var/cache/icinga2/icinga2.vars' information/cli: Finished validating the configuration file(s).

* 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.

/*

object Endpoint NodeName { }

object Endpoint "i2m2.tmtj.invite-comm.jp" { host = "172.24.12.202" }

object Zone "master" { endpoints = [ "i2m1.tmtj.invite-comm.jp", "i2m2.tmtj.invite-comm.jp" ] }

object Zone "global-templates" { global = true }

object Zone "director-global" { global = true }

dnsmichi commented 6 years ago

This sounds like a configuration problem, or you did not reload the configuration yet. Nothing which I would consider a bug, for such questions please head over to the community channels such as https://monitoring-portal.org

poing commented 6 years ago

I have reloaded the configuration, restarting icinga2 is listed as one of the steps to reproduce.

It could be a configuration problem, if I do not understand the documentation about variables likehost.vars.notification. But as mentioned, the configuration verification passes, I switch between the working and not working multiple times.

poing commented 6 years ago

I provided steps to reproduce, yet this issue was classified as a 'question'.

dnsmichi commented 6 years ago

Renaming the issue doesn't help much here, please avoid such behaviour in the future.

There's more hints in the troubleshooting docs for debugging notifications not being sent. That's what I'd suggest to do in the first place prior to reporting a bug.

poing commented 6 years ago

And classifying a detailed BUG with instructions as configuration question, doesn't help me resolve the issue.

dnsmichi commented 6 years ago

We're not in kindergarden here, let's just stick to your question. I'm closing here, feel free to join the community channels as suggested.