Missing NotificationCommand mail-host-notification

Theres a “mail-host-notification” in external commands and its visible in the dropdown for the Notification Command for notification templates.
But i get an error if my notification will be applied by an rule.

[2019-08-07 21:27:19 +0200] critical/config: Error: Validation failed for object 'uap.lan!apply_mail_host_notification' of type 'Notification'; Attribute 'command': Object 'mail-host-notification' of type 'NotificationCommand' does not exist. Location: in [stage]/zones.d/master/notification_templates.conf: 2:5-2:38

Director version: 1.6.2
Icinga Web 2 version and modules: 2.7.0
Icinga 2 version: r2.10.5-1
Operating System and version: Ubuntu 18.04
Webserver, PHP versions: apache 2.4.29, php 7.2

The command came into the Director via the Directors kickstart function.

Two things I can think of now:

  • did you change the icinga2.conf to not include the /etc/icinga2/conf.d directory?
  • did you delete config files from the /etc/icinga2/conf.d directory?

Yes, /etc/icinga2/conf.d is not included.
I tought it was already parsed by the director and thus not needed anymore…

Yes and no.
There are parsed by the Director, but are placed in the “external” part of the command configuration.
Therefore the Director knows about it, but you can’t configure it with the Director. And that’s why the config files need to be always included.
Though you can omit nearly every other config file in the conf.d directory

Same goes for the commands from the ITL, I assume. If you would remove/deactivate those, the config validation would complain.

1 Like

Move the notification commands to an included save place, e.g. into /etc/icinga2/zones.d/master in the master zone being replicated to the secondary master instance. Then re-run the kickstart wizard from the Director to update the references.

Hello @dnsmichi
I think I am stumbling across a similar problem as I have described in my question here:

Problem setting up email notification (mail-host-notification)

I run into the same (?) error:

critical/config: Error: Validation failed for object 'ITSWI02!E-Mails (Hosts)' of type 'Notification'; Attribute 'command': Object 'mail-host-notification' of type 'NotificationCommand' does not exist.

… and after reading this post it seems that I am missing something which has been lost when setting up icingadirector.
Is it sufficient to move my mail-host-notification.sh script from /etc/icinga2/scripts/ to /etc/icinga2/zones.d/master ?

  • Pit

What the message tells you is that you currently use a command which is not defined.

By default the two notification commands are defined in /etc/icinga2/conf.d/commands.conf.
After running the node setup wizard the folder is not included into the configuration anymore, if not specified otherwise (include_recursive "conf.d" is commented out in /etc/icinga2/icinga2.conf)

If you want to use the default notification commands you could move the file to the zones.d folder (or quick and dirty: inlcude it in its standard location).
After that reload icinga2 and run the Director kickstart again.