Page 2 of 2

Re: Failed to Start Nagios service

Posted: Fri Dec 14, 2018 8:30 am
by Ravikimt
I am getting this output after running this command "which sendEmail" in both the machines.

Code: Select all

/usr/bin/sendEmail

Re: Failed to Start Nagios service

Posted: Fri Dec 14, 2018 10:19 am
by tgriep
What it could be is that the smtp.office365.com server is blocking the new nagios server from forwarding emails through it so you would have to go to them to see if there is some sort of filter they need to adjust.

Re: Failed to Start Nagios service

Posted: Thu Jan 10, 2019 12:24 am
by Ravikimt
Hi @tgriep , We have change the settings in smtp.office365.com and allowed all traffic which is coming from our Nagios Server.

But still we are facing the same issue, I want to add one more thing here we have deployed this Nagios application on Azure cloud and we are running Ubuntu 18.04 LTS OS top of that.

Please help me here ASAP.

Re: Failed to Start Nagios service

Posted: Thu Jan 10, 2019 3:48 pm
by tgriep
Are you seeing the same error as before?
NOTICE => Authentication not supported by the remote SMTP server!
ERROR => Received: 530 5.7.57 SMTP; Client was not authenticated to send anonymous mail during MAIL FROM [BYAPR11CA0100.namprd11.prod.outlook.com]
Do you see any errors in this log file?

Code: Select all

/var/log/sendEmail
Can you run this test command as root on the Nagios server without it failing? Replace everything between the <> with valid data.

Code: Select all

/usr/bin/sendEmail -s <SMTP Server> -xu <username> -xp <password> -t <to email address> -f <From email address> -l /var/log/sendEmail -u "Test Subject" -m "Test Email"

Re: Failed to Start Nagios service

Posted: Fri Jan 11, 2019 5:02 am
by Ravikimt
I have fixed the issue. The problem was TLS while triggering the alert we have to use this option in you command.cfg file -o "tls=yes" .

Code: Select all

define command{
        command_name    notify-host-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/bin/sendEmail -o "tls=yes" -s $USER7$ -xu $USER5$ -xp $USER6$ -t $CONTACTEMAIL$ -f $USER5$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n\nNote: This is an automated message that is system generated so please do not reply to this email. For any queries write to 'tech.support@tredence.com'"
        }
# 'notify-service-by-email' command definition

Code: Select all

define command{
        command_name    notify-service-by-email
        command_line    /usr/bin/printf "%b" "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$" | /usr/bin/sendEmail -o "tls=yes" -s $USER7$ -xu $USER5$ -xp $USER6$ -t $CONTACTEMAIL$ -f $USER5$ -l /var/log/sendEmail -u "** $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ **" -m "***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\n\nService: $SERVICEDESC$\nHost: $HOSTALIAS$\nAddress: $HOSTADDRESS$\nState: $SERVICESTATE$\n\nDate/Time: $LONGDATETIME$\n\nAdditional Info:\n\n$SERVICEOUTPUT$\n\nNote: This is an automated message that is system generated so please do not reply to this email. For any queries write to 'tech.support@tredence.com'"
   }

After making the changes in command.cfg file I got below error.

Code: Select all

 ERROR => No TLS support!  SendEmail can't load required libraries. (try installing Net::SSLeay and IO::Socket::SSL)
I installed both the packages "Net::SSLeay" and "IO::Socket::SSL" by using below command.

Code: Select all

sudo cpan 

Code: Select all

install Net::SSLeay  

Code: Select all

install IO::Socket::SSL 
It fixed the problem for me.

Re: Failed to Start Nagios service

Posted: Fri Jan 11, 2019 11:10 am
by tgriep
Glad you have fixed the email issue and reported back what you did. I'll lock the post as solved for you but feel free to post any new questions in the future.