Notification Exit Code 36

[2020-12-04 10:40:45 +0100] warning/PluginNotificationTask: Notification command for object ‘Switch 120’ (PID: 29344, arguments: ‘/etc/icinga2/scripts/mail-host-notification.sh’ ‘-4’ ‘192.168.200.253’ ‘-6’ ‘’ ‘-b’ ‘’ ‘-c’ ‘’ ‘-d’ ‘2020-12-04 10:40:45 +0100’ ‘-l’ ‘Switch 120’ ‘-n’ ‘Switch 120’ ‘-o’ ‘CRITICAL - Host Unreachable (192.168.200.253)’ ‘-r’ ‘user@domain’ ‘-s’ ‘DOWN’ ‘-t’ ‘PROBLEM’ ‘-v’ ‘false’)
terminated with exit code 36, output: mail: Nachricht kann nicht gesendet werden: Prozess wurde mit einem von Null verschiedenen Status beendet

Hello everyone, if I manually hand over the command to bash via copy and past, an e-mail is sent. Only the above error message comes from the icingia2 notifications plugin. OS: Debian 10. Thanks in advance.

Hi,

A similar situation regarding your Notification Exit Code 36, there is a workaround you can find here on this post https://github.com/Icinga/icinga2/issues/7609

Let us know if you could solve the situation.
cheers,

Hi,
thanks for answer.
The (=) (==) thing was fixed in the repository.
I have now more hints:
I configured the mailutil with the debug mode:

root@nds-router:~# head -n 10 /etc/icinga2/scripts/mail-host-notification.sh


PROG="basename $0"
ICINGA2HOST="hostname"
MAILBIN=“mail --debug-level=7”


/var/log/icinga2/icinga2.log

[2020-12-10 10:02:35 +0100] warning/PluginNotificationTask: Notification command for object ‘Switch 120’ (PID: 28662, arguments: ‘/etc/icinga2/scripts/mail-host-notification.sh’ ‘-4’ ‘192.168.200.120’ ‘-6’ ‘’ ‘-b’ ‘’ ‘-c’ ‘’ ‘-d’ ‘2020-12-10 10:02:35 +0100’ ‘-l’ ‘Switch 120’ ‘-n’ ‘Switch 120’ ‘-o’ ‘PING OK - Packet loss = 0%, RTA = 2.13 ms’ ‘-r’ ‘user@domain.de’ ‘-s’ ‘UP’ ‘-t’ ‘RECOVERY’ ‘-v’ ‘false’) terminated with exit code 36, output: mail: sendmail binary: /usr/sbin/sendmail
mail: Getting auth info for UID 111
mail: source=system, name=nagios, passwd=x, uid=111, gid=117, gecos=, dir=/var/lib/nagios, shell=/usr/sbin/nologin, mailbox=/var/mail/nagios, quota=0, change_uid=1
mail: Getting auth info for UID 111
mail: source=system, name=nagios, passwd=x, uid=111, gid=117, gecos=, dir=/var/lib/nagios, shell=/usr/sbin/nologin, mailbox=/var/mail/nagios, quota=0, change_uid=1
mail: mu_mailer_send_message(): using From: nagios@domain.de
mail: Sending headers…
mail: Sending body…
mail: /usr/sbin/sendmail exited with: 78
mail: progmailer error: Prozess wurde mit einem von Null verschiedenen Status beendet
mail: Nachricht kann nicht gesendet werden: Prozess wurde mit einem von Null verschiedenen Status beendet
mail: Getting auth info for UID 111
mail: source=system, name=nagios, passwd=x, uid=111, gid=117, gecos=, dir=/var/lib/nagios, shell=/usr/sbin/nologin, mailbox=/var/mail/nagios, quota=0, change_uid=1

Icinga2 send messages with the system user: nagios

Now!
The same command by use copy and past on bash cli from log but now as system user root:

mail: sendmail binary: /usr/sbin/sendmail
mail: Getting auth info for UID 0
mail: source=system, name=root, passwd=x, uid=0, gid=0, gecos=root, dir=/root, shell=/bin/bash, mailbox=/var/mail/root, quota=0, change_uid=1
mail: Getting auth info for UID 0
mail: source=system, name=root, passwd=x, uid=0, gid=0, gecos=root, dir=/root, shell=/bin/bash, mailbox=/var/mail/root, quota=0, change_uid=1
mail: mu_mailer_send_message(): using From: root@domain.de
mail: Sending headers…
mail: Sending body…
mail: /usr/sbin/sendmail exited with: 0

With system user root is al perfect!

For delivery email i use msmtp, I think that is the part of fail.

Later more …

Hi,
I’am ready with the debugging.
It wasn’t an icinga2 fail, it was a MTA fail.
All user witch use the msmtp prog as MTA need a hidden config file named .msmtprc in /home/$USER
So I changed the /etc/passwd /var/lib/nagios in /home/nagios and cp the .msmtprc from root/

cheers,