SMS Alerts Via Gammu
Sean McAfee
smcafee at collaborativefusion.com
Mon Jul 7 15:35:45 CEST 2008
Gammu's site is down now, but can it take the message's contents as the
final argument?
I had something similar happen to me using SMS Server Tools 3. Using
the printf from within Nagios resulted in the sendsms utility hanging
and waiting for an EOF, never actually sending the message. By adding
the notification as an argument (instead of relying on piping), it began
to send:
define command{
command_name notify-service-by-sms
command_line /usr/local/bin/sendsms $CONTACTPAGER$ "**
$NOTIFICATIONTYPE$ Service Alert: $SERVICEDESC$ is $SERVICESTATE$ **"
}
Sean McAfee
System Engineer
Collaborative Fusion, Inc.
smcafee at collaborativefusion.com
412-422-3463 x 4025
5849 Forbes Avenue
Pittsburgh, PA 15217
****************************************************************
IMPORTANT: This message contains confidential information
and is intended only for the individual named. If the reader of
this message is not an intended recipient (or the individual
responsible for the delivery of this message to an intended
recipient), please be advised that any re-use, dissemination,
distribution or copying of this message is prohibited. Please
notify the sender immediately by e-mail if you have received
this e-mail by mistake and delete this e-mail from your system.
E-mail transmission cannot be guaranteed to be secure or
error-free as information could be intercepted, corrupted, lost,
destroyed, arrive late or incomplete, or contain viruses. The
sender therefore does not accept liability for any errors or
omissions in the contents of this message, which arise as a
result of e-mail transmission.
****************************************************************
Dj Lien wrote:
> I've got Nagios 3.0.2 working on Ubuntu 8.04 & the email alerting part
> is working fine.
>
> I've decided to add SmS functionality, so installed Gammu & have got
> this working. If I run :-
>
> /usr/bin/printf "This is a test" | /usr/bin/gammu --sendsms TEXT
> 1234567890
>
> from the terminal (replace 1234567890 with a correct number) I can
> send TxT messages fine.
>
> I added these lines to the COMMANDS.CFG
>
> # 'notify-host-by-sms' command definition
> define command{
> command_name notify-host-by-sms
> command_line /usr/bin/printf "***** Nagios *****\n\nNotification Type:
> $NOTIFICATIONTYPE$\nHost: $HOSTNAME$\nState: $HOSTSTATE$\nAddress:
> $HOSTADDRESS$\nInfo: $HOSTOUTPUT$\n\nDate/Time: $LONGDATETIME$\n" |
> /usr/bin/gammu --sendsms TEXT $CONTACTPAGER$
> }
>
>
> # 'notify-service-by-sms' command definition
> define command{
> command_name notify-service-by-sms
> command_line /usr/bin/printf "***** 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/gammu --sendsms TEXT $CONTACTPAGER$
> }
>
> & this line to the CONTACTS.CFG
>
> define contact{
> contact_name Lien
> alias Lien
> service_notification_period 24x7
> host_notification_period 24x7
> service_notification_options w,u,c,r,f,s
> host_notification_options d,u,r,f,s
> service_notification_commands notify-host-by-sms
> host_notification_commands notify-service-by-sms
> email *******@***********
> pager 1234567890
> }
>
> I get the email alerts fine & if I look in the NAGIOS.LOG file it has
> tried to run the SmS command
>
> [1214991948] SERVICE NOTIFICATION: Lien;Server;Drive Space
> C;WARNING;notify-host-by-sms;c:\ - total: 5.82 Gb - used: 5.13 Gb
> (88%) - free 0.69 Gb (12%)
>
> But I get no text message. I've enabled login on Gammu & there is
> nothing in the log, so I'm wondering if it's something to do with
> Nagios & the way I've set it up. Can anyone point me in the right
> direction of where I should be looking next. I did logon as the
> 'Nagios' account & test the printf | gammu command works without SUDO.
> I've also shortened the command line, just in case Gammu did not like
> the way it was formulated, to
>
> command_line /usr/bin/printf "***** Nagios *****" | /usr/bin/gammu
> --sendsms TEXT 0123456789
>
> & still no message. Is there another log I can look at/enable so I can
> see any errors.
>
> ------------------------------------------------------------------------
> Find out how to make Messenger your very own TV! Try it Now!
> <http://clk.atdmt.com/UKM/go/101719648/direct/01/>
> ------------------------------------------------------------------------
>
> -------------------------------------------------------------------------
> Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
> Studies have shown that voting for your favorite open source project,
> along with a healthy diet, reduces your potential for chronic lameness
> and boredom. Vote Now at http://www.sourceforge.net/community/cca08
> ------------------------------------------------------------------------
>
> _______________________________________________
> Nagios-users mailing list
> Nagios-users at lists.sourceforge.net
> https://lists.sourceforge.net/lists/listinfo/nagios-users
> ::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
> ::: Messages without supporting info will risk being sent to /dev/null
-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list