Notifications are not received

Hi all,
I recently installed and set up icinga2 with graphite and all is working fine. Now the only issue I have is with the notification. I have configured icinga2 for notification but I dont receive emails. Kindly see the error log below.

[2019-05-28 14:09:15 +0200] warning/PluginNotificationTask: Notification command for object ‘MITSEWI1001.ad.mattesit.com’ (PI D: 8284, arguments: ‘/etc/icinga2/scripts/mail-host-notification.sh’ ‘-4’ ‘10.100.100.222’ ‘-6’ ‘’ ‘-b’ ‘administrator’ ‘-c’ ‘dddd’ ‘-d’ ‘2019-05-28 14:09:15 +0200’ ‘-l’ ‘MITSEWI1001.ad.mattesit.com’ ‘-n’ ‘DOMAINE-CONTROLLER-1’ ‘-o’ ‘PING OK - Packet loss = 0%, RTA = 0.25 ms’ ‘-r’ ‘hamagba@gmail.com’ ‘-s’ ‘UP’ ‘-t’ ‘CUSTOM’ ‘-v’ ‘false’) terminated with exit code 1, output: mail not found in $PATH. Consider installing it.

Please who knows what the problem could be ?

Regards

Hi,

depending on your distribution, you need to install a local MTA (mail transfer agent) e.g. postfix, exim or sendmail.

You can test mail sending with echo "Test body" | mail -s "Subject" mail@example.com

Greetz

1 Like

Hi, sendmail is installed and I can send mail to gmail but hotmail is being blocked though. In the mail group I have added my gmail account because I can receive a test email in my gmail account when using test mail. But I don’t receive any notification from
icinga on my gmail.

Regards

Hi,
I use Ubuntu 18 and sendmail is installed and I can send mail to gmail but mails to hotmail is being blocked though. In the users.conf. I have added my gmail account because I can receive a test email in my gmail account when using test mail. But I don’t receive any notification from icinga2 on my gmail.

Maybe the user nagios has not set the right $PATH.
The message is generated from the mail-host-notification.sh script. You can try to set the full path to the MAILBIN manually in this script.

Hi,
I found out that when I can send a test mail from my computer using th sendmail command and not the mail command, could this have a a hand in this problem. Also i can only use the sendmail command with the sudo account, it doesn’nt work with the non sudo account.

Hi all,
I just installed the mailutils and now I can get notifications. But only on my gmail… The emails that I got innmy Gmail account is also in my Spam folder. Please who knows how I can enable sending notifications also on hotmail and exchange emails too

Regards

This issue is out of scope for Icinga but what is probably happening is that your server gets a very high score for spaminess and thus Hotmail blocks emails completely and Gmail sends them to Spam.

You need to either increase the mail servers reputation or use another server as relay.

means icinga (mail-host-notification.sh to be exact) finds no executable called mail to send mails.

Thank you Roland,
Now I have fixed this, but the only problem now is that Icinga notifications can’t be sent to hotmails or outlook mails so to say any mail that is related to microsoft. It can only be sent to gmail and yahoo mails. The log file of mail when I sent a test mail to Microsoft related emails (Hotmail, outlook) reads

" ctladdr=root@localhost.domain (0/0), delay=00:00:01, xdelay=00:00:01, mailer=esmtp, pri=120392, relay=hotmail-com.olc.protection.outlook.com. [104.47.6.33], dsn=5.0.0, stat=Service unavailable
May 29 10:08:30 localhost sm-mta[16561]: x4T88TQq016559: x4T88UQq016561: DSN: Service unavailable
"

Please do you have an idea why mails are not sent to hotmails.

Regards

It’s going to be off-topic here, hence, I’d assume it deprecated here. Just as a hint, my guess is about sender mail address and/or reverse hostname resolution.

Hotmail and other free email providers have protection against spammers in place. This is also true for using their mail service as relay, same applies to Gmail for example. There’s sort of rate limiting and also mis-trust against root@localhost and other obviously CLI generated sender addresses and domains.

The best and safest way to send emails is your own public mail server, which serves under the MX record in your domain and even has additional SPF records set in DNS. Once your mails are sent by such a trusted source, it is easier to send emails. One problem though - if your mail server doesn’t behave, it will get blacklisted. So own protection against spammers is required.

Likely your company already has such a mail server, be it MS Exchange or Postfix with Dovecot or similar. Such can be configured as relay from your Icinga server’s mail transfer agent (MTA).

Cheers,
Michael