Email Notification : Director Way


I know this topic is beaten to death - but Still I am not able to figure out where I am making mistake.

In External Command there is no mail / notification option. Ideally it should have been

So i created the command

I created a template

I created the apply rule. Note I want to send email for any service whose name starts with XXX_

My icinga is a distributed architecture. I am expecting the mail-notification script will be executed from my Master Server and not from clients or satellites
But the script itself is not being called


why you want to create a notification-plugin command? If you made a kickstart in the director, you should be able to create a notification template with all options and on this you can built you notification. see screenshot

1 Like

That is exactly I was also expecting - but I do not get it even after kickstart run import

And yes my icinga2.conf has
// Including Command Notification for Wizard to detect the sript automatically
include “conf.d/commands.conf”

Hi, so that’s a little bit strange. So do you have at the menu point director -> commands-> external commands a command notification?
In this menu point you should have many check_commands and also mail-host and mail-service notification.

Did you restart/reload Icinga2 after running the node wizard/changing the icinga2.conf?

Give me a brick to break my head. No i did not restart. I got it.

But still it won’t call the script on the primary master server

Created the template - “note” zone = master (my Master server zone) is that OK?

Apply Rule where Single Service Name starts with XXX_

Afaik this is not necessary, as notifications are sent by the master by default.

The only time I use the cluster zone setting is on host templates to assign hosts to a satellite zone.
All other templates have this setting untouched and thus are saved in the director-global zone, so every zone can use those templates.

Thank You Log1c
I removed the zone settings

My Apply Rules is -> Any Single Service which whose name starting with XXX_*

But somehow the email script is not getting executed

Did you check the log around the time you are expecting the notifications?
How does the history of the service look like? Is there an indication of the notification not being sent?

How is the user configured?

I know the script itself is not called when a new alert is raised as i have added the below line in the script itself to push in a separate text file that I am executing…

echo "date I am executing" > /var/log/icinga2/notification.log

Notfication user template

If this is all, you are missing the states/types for which the user(s) should be notified.
You have to set those on the notification and the user level.

1 Like

Ahh Ok. I thought everything is to be selected only at notification. Now selected

script still won’t execute

What does the log and the service history of a service with XXX_ say?

You know what my apply rules was incorrect.

It should be -> service.display_name = XXX_* and not service.display_name in XXX_*

As always thank you log1c for your help and pushing me in the right direction

Please take the time to check the “Solution” checkbox on the post that solved your problem. This way you give kudos and show others that you don’t need any more help

I didn’t look that close on the screenshot :wink:

1 Like