I have successfully gotten the email notifications nailed down and they are sending out without any issues.
I need to now be able to send out SMS messages as well as the email alerts. We have the option to send out @vtext.com (for Verizon) and @txt.att.net for our AT&T phones (they are the two provider our organization uses. I have setup a test .php page, sent out an email to both providers using this test page on the same server I'm using for nagios and it is working without an issue.
I try to tie the cell phone numbers as second emails or separate contacts in the contacts.cfg file and its a no go. The email sends out no issues, however the text is no where to be found.
I'm using the notify-host-by-email and notify-service-by-email commands for both items and I'm putting in <number>@vtext.com as my contacts email address.
If anyone has any ideas please throw them over - I've searched and tried multiple things that have not worked for me over the last two days and I have to get this rolling.
Thanks for everyones help in advance - much appreciated.
RJB
Trying to send SMS (e.g. @vtext.com) for alerts in nagios.
-
- Former Nagios Staff
- Posts: 4583
- Joined: Wed Sep 21, 2016 10:29 am
- Location: NoLo, Minneapolis, MN
- Contact:
Re: Trying to send SMS (e.g. @vtext.com) for alerts in nagio
There is a tutorial on using a SMS gateway at https://exchange.nagios.com/directory/M ... ns/details
However, it sounds like you are able to use the carrier email addresses. I am a little confused. Are you just saying that you can send SMS emails but you can't send SMS emails from Nagios? Thanks in advance for the clarification.
However, it sounds like you are able to use the carrier email addresses. I am a little confused. Are you just saying that you can send SMS emails but you can't send SMS emails from Nagios? Thanks in advance for the clarification.
Last edited by dwhitfield on Tue Nov 01, 2016 9:59 am, edited 1 time in total.
Reason: about to able
Reason: about to able
Re: Trying to send SMS (e.g. @vtext.com) for alerts in nagio
dwhitfield - thanks for the reply:
Just to clear up the confusion:
- I can run the notify-host-by-email / notify-service-by-email commands - no issues -- the emails are going through no problem.
- With the SMS / Texting, while troubleshooting what was happening. I created a php file - sendsms.php -- the contents of that file is:
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "nagios@erdts.org";
$to = "4845027904@txt.att.net";
$subject = "Nagios Alert";
$message = "Test Message";
mail($to,$subject,$message, $headers);
echo $message;
- When I incorporate the file (sendsms) - into the notify-service-by-sms it kicks off a text message, however it just obviously prints out "Test Message" for the message and nothing about the service or host that the issue is happening on.
How can I get the variables that these items are tied to incorporated into this simple php script, as this is the only way that I have found to kick off SMS / Text messages.
Thanks.
RJB.
Just to clear up the confusion:
- I can run the notify-host-by-email / notify-service-by-email commands - no issues -- the emails are going through no problem.
- With the SMS / Texting, while troubleshooting what was happening. I created a php file - sendsms.php -- the contents of that file is:
ini_set( 'display_errors', 1 );
error_reporting( E_ALL );
$from = "nagios@erdts.org";
$to = "4845027904@txt.att.net";
$subject = "Nagios Alert";
$message = "Test Message";
mail($to,$subject,$message, $headers);
echo $message;
- When I incorporate the file (sendsms) - into the notify-service-by-sms it kicks off a text message, however it just obviously prints out "Test Message" for the message and nothing about the service or host that the issue is happening on.
How can I get the variables that these items are tied to incorporated into this simple php script, as this is the only way that I have found to kick off SMS / Text messages.
Thanks.
RJB.
Re: Trying to send SMS (e.g. @vtext.com) for alerts in nagio
You could either take your $1 $2 $3, or create variables in PHP and pass this over the CLI. You can pass any of the macros from this URL - https://assets.nagios.com/downloads/nag ... olist.html
For example -
This would pass those two variables to your PHP script as $1 and $2 which you could then pass in the $message field.
At a quick glance, the usual rejection by @vtext.com is due to an invalid FQDN, but your /var/log/maillog would tell you more information about it.
For example -
Code: Select all
my-notification-command
$USER1$/myscript.php $HOSTNAME$ $HOSTADDRESS$
At a quick glance, the usual rejection by @vtext.com is due to an invalid FQDN, but your /var/log/maillog would tell you more information about it.
Former Nagios Employee