No alerts

Support forum for Nagios Core, Nagios Plugins, NCPA, NRPE, NSCA, NDOUtils and more. Engage with the community of users including those using the open source solutions.
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

No alerts

Post by jriker1 »

I setup Nagios to text me with any issues with my system. It's been rather uncommunicative lately and not because nothing is wrong. Oddly last alert I got was the 4th of July. Is there any logs that would show what alerts it thinks it's sending out so I can see if it's nagios or somewhere in between that's preventing me from getting them? For reference in the resource.cfg file have configured sending thru smtp to gmail alerts and those get set to me then as text messages.

Thanks.

JR
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: No alerts

Post by rkennedy »

Just to make sure I'm understanding properly -- your text messages are getting sent out through gmail alerts, and not Nagios, correct?

Are you able to simulate one of the messages going out over the CLI to ensure this is working properly?
Former Nagios Employee
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

Re: No alerts

Post by jriker1 »

Shoot. Something broke. Using sendEmail and getting:

Jul 10 00:22:35 nagios sendEmail[86756]: ERROR => TLS setup failed: SSL connect attempt failed because of handshake problems error:1409442E:SSL routines:SSL3_READ_BYTES:tlsv1 alert protocol version
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

Re: No alerts

Post by jriker1 »

By the way, using this sendEmail app seems to cause a lot of issues. Had to do a lot to get it working and thinking Google changed something in their mail servers that is causing these errors now. Few others complaining on the dev's site since July as well. Is there a better way to send all alerts as SMS messages to my phone without buying a service then routing thru Google?

Thanks.

JR
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: No alerts

Post by mcapra »

Could you try running sendEmail with the -o tls=no flag? That should disable TLS and show us if there's additional underlying issues.
jriker1 wrote:Is there a better way to send all alerts as SMS messages to my phone without buying a service then routing thru Google?
sendmail is another option, but comes with it's own headaches.

I've had Core use Twilio as well, but that's not "free" though they have free API keys that work for a single phone if I remember correctly.
Former Nagios employee
https://www.mcapra.com/
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

Re: No alerts

Post by jriker1 »

Thanks for the assist, I get:

Code: Select all

Jul 15 08:16:14 nagios sendEmail[77518]: NOTICE => Authentication not supported by the remote SMTP server!
Jul 15 08:16:14 nagios sendEmail[77518]: ERROR => Received:     530 5.7.0 Must issue a STARTTLS command first. 4sm460682itw.4 - gsmtp
For the test I passed:

Code: Select all

 sendEmail -o tls=no -f <gmail_email> -t <gmail_email> -s smtp.gmail.com:587 -xu <gmail_email> -xp <gmail_email_pass> -u "Hello from sendEmail" -m "How are you? I'm testing sendEmail from the command line."
Also if we assume a single recipient, could sendmail send out these alerts to a single @txt.att.net address? And talking the full message, not an abbreviated "text" message version full message like I'm getting now.
User avatar
mcapra
Posts: 3739
Joined: Thu May 05, 2016 3:54 pm

Re: No alerts

Post by mcapra »

Looks like some of the default SSL settings for sendEmail are deprecated. The underlying IO::Socket::SSL package seems to be the culprit.

You could try installing/upgrading the following perl modules from the CLI:

Code: Select all

cpan

cpan[1]> install IO::Socket::SSL
cpan[2]> install Net::SSLeay
But I was never able to get sendEmail to cooperate with GMail due to their increased security standards.

It's also worth mentioning that even modifying sendEmail to use more appropriate SSL connection libraries, I am faced with the following error:

Code: Select all

Jul 15 12:20:54 localhost sendEmail[5257]: ERROR => ERROR => SMTP-AUTH: Authentication to smtp.gmail.com:587 failed.
Meaning sendEmail also doesn't respect smtpauth protocols. So the problem is two-fold for GMail.
Former Nagios employee
https://www.mcapra.com/
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

Re: No alerts

Post by jriker1 »

I updated as you listed. There was a newer IO but same error about the version number. If I wanted to set things up to use the internal sendmail on centos and assuming I can configure it to send from Comcast, what would I need to do to get things setup? thought I used to send mail from my Linux boxes back in the day without an intermediary but not sure if I can do that.

Thanks.

JR
rkennedy
Posts: 6579
Joined: Mon Oct 05, 2015 11:45 am

Re: No alerts

Post by rkennedy »

Could you try using sendEmail in conjunction with your SMTP information provided by Comcast? Advising how to setup postfix / sendmail is a bit beyond scope for what we can provide as there are a lot of factors at play here.

Alternatively, yes, you should be able to use the built in sendmail / postfix on the linux machine to send messages locally. The built it notify-host-by-email and notify-service-by-email will do this. Depending on your OS, you might need to update the commands accordingly. You can check what your machine is using by running which mail. Then, check the path defined in those two commands for the mail service. If you see erorrs, check out /var/log/maillog to see what the issue is. Feel free to post those logs if you run into any problems.
Former Nagios Employee
jriker1
Posts: 115
Joined: Tue Dec 15, 2015 8:40 pm

Re: No alerts

Post by jriker1 »

Thanks for the reply. So been having problems as centos seems to always want to send mail to port 25 which no one uses anymore. Tried updating the relay to use 587 but if I email Comcast it tries sending it to a mx1 or mx2 Comcast URL which doesn't work anymore. Should be going to smtp.comcast.net. Not your problem. That said, did the following:

[*]touch /etc/postfix/sasl_passwd
[*]chmod 0600 /etc/postfix/sasl_passwd
[*]echo "smtp.comcast.net:587 [email protected]:password" > /etc/postfix/sasl_passwd
[*]postmap hash:/etc/postfix/sasl_passwd
[*]echo '/^([^@]*)@.*$/ [email protected]' > /etc/postfix/sender_rewrite

Edit /etc/postfix/main.cf and add:
[*]relayhost = [smtp.comcast.net]:587
[*]smtp_sasl_auth_enable = yes
[*]smtp_sasl_password_maps = hash:/etc/postfix/sasl_passwd
[*]smtp_sasl_security_options = noanonymous
[*]smtp_sasl_tls_security_options = noanonymous
[*]
[*]## -- Rewrite all sender addresses:
[*]sender_canonical_maps = regexp:/etc/postfix/sender_rewrite

yum -y install cyrus-sasl-plain

Now I can send thru sendmail using my Comcast host as the host and working. I also removed/reverted any changes the mail client I was using required. What else should I have to change/set if anything to start using the built in mail functionality with Nagios?

Should be noted I do NOT have /bin/mail installed. Not sure if I need to or can modify notify-host-by-email and notify-service-by-email to use sendmail directly? Like to limit my installs.

Thanks.

EDIT: Tried adding the below in place of the current command statements, not sure if they are accurate yet:

# 'notify-host-by-email' command definition
define command{
command_name notify-host-by-email
command_line /usr/bin/printf "%b" "Subject: $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$\n\n***** Nagios *****\n\nNotification Type: $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress: $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" | /usr/sbin/sendmail -vt $CONTACTEMAIL$
}

# 'notify-service-by-email' command definition
define command{
command_name notify-service-by-email
command_line /usr/bin/printf "%b" "Subject: $NOTIFICATIONTYPE$ Service Alert: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$\n\n***** 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" | /usr/sbin/sendmail -vt $CONTACTEMAIL$
}
Locked