Hi everyone
I want to ask for your help in order to understand a very strange behaviour of the notifications.
Checking /var/log/icinga2/debug.log
I noticed that some notification are sent correctly and some aren’t, even if they are linked to the same problem, same host or same service, and nothing has changed in between!
I left the system running with default check_interval (so every half an hour) at night, so nobody changed nothing in that time, because nobody was working, and still some notifications are sent and some aren’t.
The error regarding an host is reported like this on /var/log/icinga2/debug.log
(the error regarding a service is very similar):
[2020-10-06 06:29:02 +0200] warning/PluginNotificationTask: Notification command for object ‘hostname’ (PID: 9780, arguments: ‘/etc/icinga2/scripts/mail-host-notification.sh’ ‘-4’ ‘ip address’ ‘-6’ ‘’ ‘-b’ ‘’ ‘-c’ ‘’ ‘-d’ ‘2020-10-06 06:29:01 +0200’ ‘-f’ ‘sender’ ‘-l’ ‘hostname’ ‘-n’ ‘hostname’ ‘-o’ ‘output’ ‘-r’ ‘receiver’ ‘-s’ ‘state’ ‘-t’ ‘notification type’ ‘-v’ ‘false’) terminated with exit code 1, output: + …
I replaced some information with general information. The output is always different: sometimes it is part of the body of the email, sometimes it is “detecting MIME Type…”. The email doesn’t have attachments.
The exit code 1 in /etc/icinga2/scripts/mail-host-notification.sh
happens only in these two situations:
if [ -z “
which $MAILBIN
” ] ; then
echo “$MAILBIN not found in $PATH. Consider installing it.”
exit 1
fiFunction helpers
Usage() {
cat << EOFRequired parameters:
-d LONGDATETIME ($icinga.long_date_time$)
-l HOSTNAME ($host.name$)
-n HOSTDISPLAYNAME ($host.display_name$)
-o HOSTOUTPUT ($host.output$)
-r USEREMAIL ($user.email$)
-s HOSTSTATE ($host.state$)
-t NOTIFICATIONTYPE ($notification.type$)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)EOF
}Error() {
if [ “$1” ]; then
echo $1
fi
Usage;
exit 1;
}
I checked and $MAILBIN is present in $PATH.
These checks are referred to two different satellites.
Icinga2 version on master: r2.12.0-1
Icinga2 version on satellite1: r2.12.0-1
Icinga2 version on satellite2: r2.12.0-1
If anyone knows something, it would help me understand this problem so much!