Copy / Paste Preformed Notification object for director?

Probably a really daft question but I’m following the this tutorial to get basic mail alerts working https://www.unixe.de/icinga-2-icinga-director-and-notifications/

I’m at the point where I need to add the object NotificationCommand “Service Alarm By Email” to director. Is there any way of cutting and pasting the content into a file and have director pick it up from commands.conf if that is in fact the correct file? If not, any ideas which file I should be adding the content to given the list below?

I assumed there would be a single commands.conf but having looked I’ve got a few? Messed around with adding it to a couple of the files below, restarted icinga2, but thinking about it didn’t restart apache for icingaweb2? Wondering if that’s what i’ve done wrong?

root@localhost:/var/lib/icinga2/api/packages/director/localhost-1554290594-9/zones.d/localhost.domain.com# find / -name commands.conf
/var/lib/icinga2/api/packages/director/localhost-1554290594-9/zones.d/localhost.domain.com/commands.conf
/var/lib/icinga2/api/packages/director/localhost-1554290630-9/zones.d/localhost.domain.com/commands.conf
/var/lib/icinga2/api/zones/locakhost.mandogroup.com/director/commands.conf
/etc/icinga2/conf.d/commands.conf

If you work with the Icinga Director you shouldn’t change the contents of the files in /var/lib/icinga2/api/…
These are created by the Directors deployment process. So changing them will have no effect anyway or can even break your config.
Read about how the Directors deployment works it in the docs:
https://icinga.com/docs/director/latest/doc/10-How-it-works/#how-your-configuration-is-going-to-be-rendered

You have both notification commands configured in /etc/icinga2/conf.d/commands.conf
You can include that config in your /etc/icinga2/icinga2.conf with include "conf.d/commands.conf"

After this reload icinga2 and do a kickstart via the Director interface. This way the Director will import the pre-defined commands from the ITL and the command.conf

1 Like