HELP SENDING SMS

Ryan Bowlby rbowlby83 at yahoo.com
Fri Aug 21 00:05:47 CEST 2009


>
>From: Eduardo Barreto <lecb79 at gmail.com>
>To: nagios-users at lists.sourceforge.net
>Sent: Thursday, August 20, 2009 2:23:31 PM
>Subject: [Nagios-users] HELP SENDING SMS
>
>>Hi All,
>
>>Does anyone could help on this one? The thing is, I've connected my
>monitor (nagios) with a gsm modem through serial port and created a
>script to send sms to notify manager of status from some hosts and
>services. The script access kermit and from it sends the message,
>follow below the script:
>
>>(-------------------------SCRIPT SMS ---------------------------)
>>#!/usr/bin/kermit +
>>#.no := \%1
>>#.msg := \%2
>>set line /dev/ttyS0
>>set carrier-watch off
>>set speed 9600
>>output at\13
>>wait 2
>>output at+cmgf=1\13
>>wait 2
>>output at+cmgs=\%1 \13
>>wait 2
>>output \%2 \26
>>exit
>>(-------------------------SCRIPT SMS ---------------------------)
>
>>I've called this script as sms, put it on this path
>(/usr/local/nagios/sms), on manual way I just need to do like that
>/usr/local/nagios/sms 'mobile phone'  ' text message ', the script
>works just nice, after that test, the next step was to setting it in
>Nagios (/usr/local/nagios/etc/objects/command.cfg)
>
>>define command{
>>    command_name notify-host-by-sms
>>    command_line /usr/local/nagios/sms $PAGER$ "Host:$HOSTNAME$ - State:$HOSTSTATE$"
>>          }
>
>>define command{
>>    command_name notify-by-sms
>>    command_line /usr/local/nagios/sms $PAGER$ "Host:$HOSTNAME$ - State:$SERVICEDESC$ - State:$SERVICESTATE$'
>>          }
>
>>After set it, looked to at the Nagios log and it advise me that some
>notifications are been sending through sms but I dont received it,



Try outputting to a file using echo and verify the results are what you expected. Also, try running it manually as user nagios (if you haven't already). Lastly, nagios debugging mode can help.


 su nagios -c "/usr/local/nagios/sms mobile phone  text message "

define command{
    command_name notify-host-by-sms
    #command_line /usr/local/nagios/sms $PAGER$ "Host:$HOSTNAME$ - State:$HOSTSTATE$"
      command_line /bin/echo $PAGER$ "Host:$HOSTNAME$ - State:$HOSTSTATE$" >> /var/spool/nagios/smsresults.tmp
          }

define command{
    command_name notify-by-sms
    #command_line /usr/local/nagios/sms $PAGER$ "Host:$HOSTNAME$ - State:$SERVICEDESC$ - State:$SERVICESTATE$'
    command_line /bin/echo $PAGER$ "Host:$HOSTNAME$ - State:$SERVICEDESC$ - State:$SERVICESTATE$' >> /var/spool/nagios/smsresults.tmp
          }


      

------------------------------------------------------------------------------
Let Crystal Reports handle the reporting - Free Crystal Reports 2008 30-Day 
trial. Simplify your report design, integration and deployment - and focus on 
what you do best, core application coding. Discover what's new with 
Crystal Reports now.  http://p.sf.net/sfu/bobj-july
_______________________________________________
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