Notification is not working with Director but work with manual script execution

Hello,

I’m facing a problem since few days and no post or topic and applied solution have worked for me.
I’m opening a new topic and hopping someone will can helm me :pensive:

So, my problem is as follow.
I have configured Icinga Director to get notification from host status (Up/Down) and all transition types.
I have created : Timeperiod, user, notification and command

When I try to force a notification by using “Send Notification” through the icingaWeb2 interface on the concerned host (to test if notification is working), I get debug and log messages regarding the command used, the user, parameters etc … with exit code 0 (meaning everything should be ok) but when I check my mailbox, I didn’t receive the notification :frowning:

Now if I’m copying and pasting the line executed for the notification command (showed on the debuglog file of icinga) directly on the terminal, I receive the e-mail notification (I’ve tried to sent it by using the icinga system account to be sure that it’s not a right issue)

debuglog :

[2022-07-28 17:29:59 +0200] notice/ApiListener: New HTTP client
[2022-07-28 17:29:59 +0200] debug/HttpUtility: Request body: '{"author":"test","comment":"toto","force":true,"host":"exemple"}'
[2022-07-28 17:29:59 +0200] notice/ApiActionHandler: Running action send-custom-notification
[2022-07-28 17:29:59 +0200] information/Checkable: Checkable 'exemple' has 1 notification(s). Checking filters for type 'Custom', sends will be logged.
[2022-07-28 17:29:59 +0200] notice/Notification: Attempting to send notifications of type 'Custom' for notification object 'exemple!host_notification'.
[2022-07-28 17:29:59 +0200] notice/Notification: Not checking notification filters for notification object 'exemple!host_notification': Notification was forced.
[2022-07-28 17:29:59 +0200] notice/Notification: Not checking notification filters for notification object 'exemple!host_notification' and user 'user': Notification was forced.
[2022-07-28 17:29:59 +0200] information/Notification: Sending 'Custom' notification 'exemple!host_notification' for user 'user'
[2022-07-28 17:29:59 +0200] debug/IcingaDB: Firing and forgetting query: 'XADD' 'icinga:history:stream:notification' '*' 'id' '833c63f99c2b296a9a164afff968e4ed39b31c37' 'environment_id' '582dcc2d064d7d9cb7d0458d15d7128840d36756' ...
[2022-07-28 17:29:59 +0200] information/HttpServerConnection: Request: POST /v1/actions/send-custom-notification (from [xxx.xx.xxx.xxx]:40224), user: root, agent: , status: OK).
[2022-07-28 17:29:59 +0200] notice/ApiListener: Relaying 'event::SetForceNextNotification' message
[2022-07-28 17:29:59 +0200] notice/ApiListener: Relaying 'event::SendNotifications' message
[2022-07-28 17:29:59 +0200] notice/ApiListener: Relaying 'event::SetForceNextNotification' message
[2022-07-28 17:29:59 +0200] notice/ApiListener: Relaying 'event::NotificationSentToAllUsers' message
[2022-07-28 17:29:59 +0200] notice/Process: Running command '/opt/icinga2checks/mail-host-notification.sh' '-d' '2022-07-28 17:29:59 +0200' '-l' 'exemple' '-n' 'exemple' '-o' 'PING OK - Packet loss = 0%, RTA = 0.12 ms' '-r' 'email@domain.com' '-s' 'UP' '-t' 'CUSTOM' '-f' 'icinga-monitoring@domain.com' '-c' 'toto': PID 686759
[2022-07-28 17:29:59 +0200] information/Notification: Completed sending 'Custom' notification 'exemple!host_notification' for checkable 'exemple' and user 'user' using command 'host_notification'.
[2022-07-28 17:29:59 +0200] notice/ApiListener: Relaying 'event::NotificationSentUser' message
[2022-07-28 17:30:00 +0200] information/HttpServerConnection: HTTP client disconnected (from [xxx.xx.xxx.xxx]:40224)
[2022-07-28 17:30:00 +0200] notice/Process: PID 686759 ('/opt/icinga2checks/mail-host-notification.sh' '-d' '2022-07-28 17:29:59 +0200' '-l' 'exemple' '-n' 'exemple' '-o' 'PING OK - Packet loss = 0%, RTA = 0.12 ms' '-r' 'email@domain.com' '-s' 'UP' '-t' 'CUSTOM' '-f' 'icinga-monitoring@domain.com' '-c' 'toto') terminated with exit code 0
[2022-07-28 17:30:00 +0200] debug/IdoMysqlConnection: Query: UPDATE icinga_hoststatus SET current_notification_number = '2',  last_notification = FROM_UNIXTIME(1659022199),  next_notification = FROM_UNIXTIME(1659022946) WHERE host_object_id = 248 AND instance_id = 1
[2022-07-28 17:30:00 +0200] debug/IdoMysqlConnection: Query: INSERT INTO icinga_notifications (contacts_notified, end_time, end_time_usec, endpoint_object_id, escalated, instance_id, long_output, notification_reason, notification_type, object_id, output, start_time, start_time_usec, state) VALUES ('1', FROM_UNIXTIME(1659022199), '964626', 246, '0', 1, '', '8', '1', 248, 'PING OK - Packet loss = 0%, RTA = 0.12 ms', FROM_UNIXTIME(1659022199), '964626', '0')

TimePeriod :

image

user :

image

Notification :

image

Command :

I’m using “mailx” and “postfix” to send notifications.
When i’m executing manually the command I receive the main notification and i see a log message in maillog but when I’m using the icingaWeb interface I have no log in maillog but everything looks find in icinga side …

I don’t know if it can be linked but when I try to show the preview of the “legacy-timeperiod” in icingaWeb2 (from timperiod include) I get the following error :

I have hidden some personals information I apologize for that, hopefully it will not impact the investigation.

Thanks for your help ! :slightly_smiling_face: