# Missing NotificationCommand mail-host-notification

**URL:** <https://community.icinga.com/t/missing-notificationcommand-mail-host-notification/1927>\
**Category:** Icinga Director\
**Created:** [August 7, 2019, 8:05pm UTC](https://community.icinga.com/t/missing-notificationcommand-mail-host-notification/1927 "2019-08-07T20:05:24Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![bewue](https://community.icinga.com/user_avatar/community.icinga.com/bewue/32/1019_2.png) [@bewue](https://community.icinga.com/u/bewue)\
**Post date:** [August 7, 2019, 8:05pm UTC](https://community.icinga.com/t/missing-notificationcommand-mail-host-notification/1927/1 "2019-08-07T20:05:24Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![log1c](https://community.icinga.com/user_avatar/community.icinga.com/log1c/32/2071_2.png) [@log1c](https://community.icinga.com/u/log1c)\
**Post date:** [August 8, 2019, 6:10am UTC](https://community.icinga.com/t/missing-notificationcommand-mail-host-notification/1927/2 "2019-08-08T06:10:20Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![bewue](https://community.icinga.com/user_avatar/community.icinga.com/bewue/32/1019_2.png) [@bewue](https://community.icinga.com/u/bewue)\
**Post date:** [August 8, 2019, 8:22pm UTC](https://community.icinga.com/t/missing-notificationcommand-mail-host-notification/1927/3 "2019-08-08T20:22:45Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![log1c](https://community.icinga.com/user_avatar/community.icinga.com/log1c/32/2071_2.png) [@log1c](https://community.icinga.com/u/log1c)\
**Post date:** [August 9, 2019, 5:58am UTC](https://community.icinga.com/t/missing-notificationcommand-mail-host-notification/1927/4 "2019-08-09T05:58:14Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dnsmichi](https://community.icinga.com/user_avatar/community.icinga.com/dnsmichi/32/7721_2.png) [@dnsmichi](https://community.icinga.com/u/dnsmichi)\
**Post date:** [August 9, 2019, 3:13pm UTC](https://community.icinga.com/t/missing-notificationcommand-mail-host-notification/1927/5 "2019-08-09T15:13:34Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![glober](https://community.icinga.com/letter_avatar_proxy/v4/letter/g/67e7ee/32.png) [@glober](https://community.icinga.com/u/glober)\
**Post date:** [May 18, 2022, 2:45pm UTC](https://community.icinga.com/t/missing-notificationcommand-mail-host-notification/1927/6 "2022-05-18T14:45:30Z")

</div>

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)

> [@Problem setting up email notification (mail-host-notification)](https://community.icinga.com/t/problem-setting-up-email-notification-mail-host-notification/9857):
>
> Hello, I am currently configuring email notification on an Icinga 2 server, but run into a problem on the final step. After spending lots of hours troubleshooting, I hope that I can get some external input as I have no clue what exactly is the problem. To begin with: I have made sure that the server itself is able to sent outbound email from the CLI. Therefore I have configured mutt as root and run the following command to check if its working: /usr/bin/printf "This is the body text" | mut…

I run into the same (?) error:

```auto
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

---

<div class="post-metadata">

**Author:** ![log1c](https://community.icinga.com/user_avatar/community.icinga.com/log1c/32/2071_2.png) [@log1c](https://community.icinga.com/u/log1c)\
**Post date:** [May 23, 2022, 11:51am UTC](https://community.icinga.com/t/missing-notificationcommand-mail-host-notification/1927/7 "2022-05-23T11:51:11Z")

</div>

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.
