No email notifications sending

Okay, thank you!

And if I make my script works, can you help me with the other?

Kevin

If I understand your problem correctly, fixing your mail setup should allow both scripts in /etc/icinga2/scripts to work correctly

Maybe I know, why is this doesn´t work.
I don´t have any contact in my hosts. I´m solving it now in my second thread.
But I still can´t figure it out. :frowning:
image

I fixed my script, script is working now, but Icinga2 doesn´t executing scripts.
In log is nothing. :frowning:

But thank you for trying to help me!

If you have any idea, please help me… :frowning:
/Kevin

Icinga2 finally can send email!!!

But problem is here…

[2020-07-13 16:14:27 +0000] information/ExternalCommandListener: Executing external command: [1594656867] SEND_CUSTOM_SVC_NOTIFICATION;Agadi01;ping;2;admin;test
[2020-07-13 16:14:27 +0000] information/Checkable: Checkable 'Agadi01!ping' has 1 notification(s). Checking filters for type 'Custom', sends will be logged.
[2020-07-13 16:14:27 +0000] information/Notification: Sending 'Custom' notification 'Agadi01!ping!notification - services' for user 'administrator'
[2020-07-13 16:14:27 +0000] information/Notification: Completed sending 'Custom' notification 'Agadi01!ping!notification - services' for checkable 'Agadi01!ping' and user 'administrator' using command 'mail-service-notification'.
[2020-07-13 16:14:27 +0000] warning/PluginNotificationTask: Notification command for object 'Agadi01!ping' (PID: 17337, arguments: '/etc/icinga2/scripts/mail-service-notification.sh') terminated with exit code 1, output: Required parameter 'LONGDATETIME' is missing.

Required parameters:
  -d LONGDATETIME ($icinga.long_date_time$)
  -e SERVICENAME ($service.name$)
  -l HOSTNAME ($host.name$)
  -n HOSTDISPLAYNAME ($host.display_name$)
  -o SERVICEOUTPUT ($service.output$)
  -r USEREMAIL ($user.email$)
  -s SERVICESTATE ($service.state$)
  -t NOTIFICATIONTYPE ($notification.type$)
  -u SERVICEDISPLAYNAME ($service.display_name$)

Optional parameters:
  -4 HOSTADDRESS ($address$)
  -6 HOSTADDRESS6 ($address6$)
  -b NOTIFICATIONAUTHORNAME ($notification.author$)
  -c NOTIFICATIONCOMMENT ($notification.comment$)
  -i ICINGAWEB2URL ($notification_icingaweb2url$, Default: unset)
  -f MAILFROM ($notification_mailfrom$, requires GNU mailutils (Debian/Ubuntu) or mailx (RHEL/SUSE))
  -v ($notification_sendtosyslog$, Default: false)

My sending line:

/usr/bin/printf "%b" "$template" | /opt/sendEmail/sendEmail.pl -f "monitoring@agadi.cz" -t $USEREMAIL -u "$NOTIFICATIONTYPE - $HOSTDISPLAYNAME - $SERVICEDISPLAYNAME is $SERVICESTATE" -d "$LONGDATETIME" -s "smtp.seznam.cz" -xu "monitoring@agadi.cz" -xp "password" -t "monitoring@agadi.cz"

Any ideas how to fix it?

That is kinda weird. The date should be the least of your worries.
What did you change relative to the default configuration?

Hi Kevin,

I have the same issue when im running the .sh script (longdatetime is missing).

What was your solution for that?

/M0nt1m