An error appears when trying to deploy a valid notification template using the Director

Hello all,

I’ve configured notifications using Icinga Directory, but no e-mail is being sent. I’ve created a TimePeriod with Mon - Sun 24x7, I’ve created a User template that applies this template, Sends Notifications is enabled and all states have been selected.I’ve defined a user that inherits this template, has a valid e-mail address configured and I’ve configured a Notification Template with the user specified, mail-host-notification configured, Time Period and all states set, but whenever I try to apply a rule I’m receiving the following error:

[2019-02-15 14:23:29 +0100] information/cli: Icinga application loader (version: r2.10.2-1)
[2019-02-15 14:23:29 +0100] information/cli: Loading configuration file(s).
[2019-02-15 14:23:29 +0100] information/ConfigItem: Committing config item(s).
[2019-02-15 14:23:29 +0100] information/ApiListener: My API identity:
[2019-02-15 14:23:29 +0100] critical/config: Error: Validation failed for object ‘!Base Monitoring’ of type ‘Notification’; Attribute ‘command’: Object ‘mail-host-notification’ of type ‘NotificationCommand’ does not exist.
Location: in [stage]/zones.d/ 2:5-2:38
[stage]/zones.d/ template Notification “Base” {
[stage]/zones.d/ command = “mail-host-notification”
[stage]/zones.d/ interval = 1h
[stage]/zones.d/ period = “24x7”

[2019-02-15 14:23:29 +0100] critical/config: 1 error

as shown in the log your notify command wasnt created properly.
d u checked to send the mail directly from the host via ssh session with all your parameters set up ?

1 Like

Dear Christian,

I haven’t defined any parameters for icinga2 I though it’d accept from localhost and set-up postfix to forward mails from localhost to a relay host (ISP). Where can I define the mail parameters for icinga?

Sorry for all the questions, but I’m still getting used to icinga (used nagios in the past)


have you defined the director-templates as a global zone ?

Did you import external configured commands via the kickstart wizard, but then decided to disable conf.d includion in icinga2.conf?



Yes they are by default.

Dear Michael,

These were imported automatically when setting it up initially through the wizard, but yes I’ve disabled the conf.d configuration as I ran the node wizard after, as I’ve got a Master -> Satellite -> Agent setup.

How can I create the mail-host-notification object? Is there any global configuration or default reference that I can use :slight_smile:

Update: I’ve found the file with: object NotificationCommand “mail-host-notification” {
command = [ ConfigDir + “/scripts/” ]

But how can I get this safely back into icinga without including this dir and destroying my installation :smiley:

You can include single .conf files in the /etc/icinga2/icinga2.conf file:
include "conf.d/commands.conf"

Thank you for the reply. This resolved the issue, but now I’m receiving the following error when testing:

[2019-03-13 12:16:47 +0100] information/cli: Icinga application loader (version: r2.10.2-1) [2019-03-13 12:16:47 +0100] information/cli: Loading configuration file(s). [2019-03-13 12:16:47 +0100] information/ConfigItem: Committing config item(s). [2019-03-13 12:16:47 +0100] information/ApiListener: My API identity: [2019-03-13 12:16:47 +0100] critical/config: Error: Validation failed for object ‘!Google Public DNS Server’ of type ‘Notification’; Attribute ‘states’: State filter is invalid. Location: in [stage]/zones.d/ 5:5-5:35 [stage]/zones.d/ [stage]/zones.d/ assign where host.address == “” [stage]/zones.d/ states = [ Critical, Down, OK ] ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ [stage]/zones.d/ users = [ “monitoring” ] [stage]/zones.d/ } [2019-03-13 12:16:47 +0100] critical/config: 1 error

Update: Solved, a host can only have an Up and Down state of course :smiley:

Please don’t edit the topics with the [solved] prefix, marking the reply as solution is sufficient. The topic lists highlight this, and the search takes this into account too. More here.

Understood and will not do so anymore. My apologies for the inconvenience. It’s just something I’m used to from the Gentoo forums.

1 Like