Page 1 of 1

Trying to get SMS to work on Core

Posted: Thu Oct 27, 2016 3:31 pm
by rjb905
I'm trying to find a way to get the SMS alerts to fire off using Nagios Core for notify-host-by-email / notify-service-by-email commands:

Based off what I've seen from the previous nagios system that was in place here at our organization - I should be able to stick in a "second email address in my contact information" This would be [email protected] (or whatever my provider is) and then that should fire off in the notify-host-by-email OR notify-service-by-email with a text and an email.

The emails go through - no issues at all / the texts are not firing off I need to know why and how to fix this.

Here is the notify-host-by-email command I'm talking about:


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/mail -s "** $NOTIFICATIONTYPE$ Host Alert: $HOSTNAME$ is $HOSTSTATE$ **" $CONTACTEMAIL$

}

Here are the two mail entries from my postfix service -- we are using the smtp-relay service from our gmail accounts that are setup:


Oct 27 16:12:07 gu-nagios001-1 postfix/smtp[121792]: BF5CC6FC04BC: to=<my email account was here>, relay=smtp-relay.gmail.com[googles ip]:587, delay=0.65, delays=0.05/0.01/0.39/0.19, dsn=2.0.0, status=sent (250 2.0.0 OK 1477599127 z139sm1354130qkb.1 - gsmtp)
Oct 27 16:12:07 gu-nagios001-1 postfix/smtp[121792]: BF5CC6FC04BC: to=<my phone number was here@txt.att.net>, relay=smtp-relay.gmail.com[googles ip]:587, delay=0.65, delays=0.05/0.01/0.39/0.19, dsn=2.0.0, status=sent (250 2.0.0 OK 1477599127 z139sm1354130qkb.1 - gsmtp)
Oct 27 16:12:07 gu-nagios001-1 postfix/qmgr[10565]: BF5CC6FC04BC: removed

Does anyone have any ideas on this as I'm banging my head against the wall on why this wont go through - I've tested a test php file with the mail() function, that sends a sms message fine from the same nagios server.

Any ideas would be helpful - thanks for everyone's help in advance as this is one of the last pieces to take care of and then this system is up and fully functional.

Best regards,

RJB

Re: Trying to get SMS to work on Core

Posted: Thu Oct 27, 2016 4:29 pm
by dwhitfield
What version of Core are you using 4.2.2 has a notification fix. That one does not seem related, but there have been other fixes in the past that may be related.

While I'm asking questions, did you install core via distribution repos or did you compile from source? Also, what OS/version are you running? This will help us determine if this is a postfix issue or not. Right now I don't have any reason to think it's a postfix issue, but since I'm gathering info I figured I would ask.