R: R: Send SMS in Linux
Marco Borsani
m.borsani at it.net
Mon Nov 28 10:26:31 CET 2005
Well,
I am testing sendsms with nagios.... In the nagios.log seems that the
notification has been sended
------------------------------------
[1133168191] SERVICE NOTIFICATION:
test_sms;10.212.12.5 at test;10.212.12.5tcp1;CRITICAL;notify-by-sms;Connection
refused by host
------------------------------------
But no SMS was arrived !
test_sms is a contact used to send sms
If I run sendsms manually (like sendsms 39329... "test messaged" ) all will
run correctly!
Any idea ?
-}-----Messaggio originale-----
-}Da: Stefano Coletta [mailto:creator at mindcreations.com]
-}Inviato: venerdì 25 novembre 2005 18.32
-}A: Marco Borsani
-}Cc: 'NAGIOS'
-}Oggetto: Re: R: [Nagios-users] Send SMS in Linux
-}
-}Marco Borsani wrote:
-}
-}>Thanks a lot!
-}>
-}>I am testing communication between radiomodem and smstools
-}(but not on
-}>the nagios server), and looks like good.
-}>I have installed smstools on the nagios server, so I need to send
-}>directly SMS trought this server.
-}>
-}>I have to finish all tests without the radiomem connected
-}(it is broken).
-}>Do you think that command like follow could be ok?
-}>
-}>define command{
-}> command_name notify-by-sms
-}> command_line /usr/local/bin/sendsms
-}$CONTACTPAGER$ "Service:
-}>$SERVICEDESC$\nHost: $HOSTALIAS$\nState:
-}$SERVICESTATE$.\n$OUTPUT$\nDate:
-}>$SHORTDATETIME$"
-}> }
-}>
-}>
-}Yes, you can use this command but the sendnagiossms script is
-}useful to strip a bit the sms message text, like ping with a
-}lot of zeros.
-}Maybe you can create a new script to satisfy your needs
-}retaining the old "stripping" functionality.
-}
-}>I hope to use sendsms command directly (without a file like
-}sendnagiossms).
-}>
-}>I like sendsms very much (if it will work like I hope!), so
-}I'd like to
-}>install/compile on HP-UX too, but I receive an error like:
-}>---------------------------------------------------------
-}>gmake install
-}>cd src && gmake -
-}>gmake[1]: Entering directory `/var/DEPOT/smstools-1/src'
-}>cc -D NOSTATS -c -o extras.o extras.c
-}>(Bundled) cc: "extras.h", line 21: warning 5: "const" will
-}become a keyword.
-}>(Bundled) cc: "extras.h", line 21: error 1000: Unexpected
-}symbol: "char".
-}>(Bundled) cc: "extras.h", line 21: warning 5: "const" will
-}become a keyword.
-}>(Bundled) cc: "extras.h", line 21: warning 5: "const" will
-}become a keyword.
-}>(Bundled) cc: "extras.h", line 21: warning 5: "const" will
-}become a keyword.
-}>(Bundled) cc: error 2017: Cannot recover from earlier
-}errors, terminating.
-}>gmake[1]: *** [extras.o] Error 1
-}>gmake[1]: Leaving directory `/var/DEPOT/smstools-1/src'
-}>gmake: *** [compile] Error 2
-}>-----------------------------------------------------------
-}>When I compile Nagios with gmake I have no problems!
-}>
-}>
-}I can't help you compiling on HP-UX, I've no HP-UX here :)
-}
-}Bye!
-}
-}
-}
-}>Regards
-}>Marco
-}>
-}>
-}>-}-----Messaggio originale-----
-}>-}Da: Stefano Coletta [mailto:creator at mindcreations.com]
-}>-}Inviato: giovedì 24 novembre 2005 17.18
-}>-}A: Marco Borsani
-}>-}Cc: NAGIOS
-}>-}Oggetto: Re: [Nagios-users] Send SMS in Linux -} -}Use the
-}SMS Server
-}>Tools -}http://smstools.meinemullemaus.de/
-}>-}
-}>-}Add this to the misccommands.cfg
-}>-}
-}>-}define command {
-}>-}command_name notify-by-sms
-}>-}command_line /bin/echo
-}"/usr/local/bin/sendnagiossms
-}>-}$CONTACTPAGER$ \"$NOTIFICATIONTYPE$: Service $SERVICEDESC$ on
-}>-}$HOSTALIAS$ is $SERVICESTATE$ ($OUTPUT$) - °$DATETIME$\"" | -}ssh
-}>yourhost } -} -}Replace yourhost with your SMS host where
-}you have to
-}>install -}SMS Server tools.
-}>-}Note: $CONTACTPAGER has to include country prefix number.
-}>-}
-}>-}Establish an ssh key trust between nagios user on the
-}nagios -}host
-}>and the relative user on the sms server so it will not -}ask for a
-}>password.
-}>-}
-}>-}Then add the command /usr/local/bin/sendnagiossms on the
-}SMS server:
-}>-}
-}>-}#!/bin/sh
-}>-}OLD_MSG_NODATE=`echo $2 | cut -d° -f 1` -}OLD_DATE=`echo
-}$2 | cut -d°
-}>-f 2` -}NEW_DATE=`date -d "$OLD_DATE" +"%e-%b %H:%M"` -}
-}>-}TEXT="$OLD_MSG_NODATE$NEW_DATE"
-}>-}STRIPPED_TEXT=`echo $TEXT | sed -f
-}/usr/local/bin/sendnagiossms.sed`
-}>-} -}/usr/local/bin/sendsms $1 "$STRIPPED_TEXT"
-}>-}
-}>-}and the file for sed /usr/local/bin/sendnagiossms.sed -}
-}>-}s/000000/0/g -}s/00000/0/g -}s/°//g -} -}Once you have tested that
-}>SMS Server tools is properly -}installed try configuring
-}Nagios to send
-}>sms using this -}command instead of notify-by-email -} -}Enjoy -}
-}>-}Marco Borsani wrote:
-}>-}
-}>-}>I all !
-}>-}>
-}>-}>I should configure Nagios (on a RedHat Ent 3.0) to send
-}SMS, using a
-}>-}>radiomoden connected on a serial port.
-}>-}>
-}>-}>May someone give me an help ?
-}>-}>
-}>-}>I suppose that a script/programm is necessary to this
-}-}porpuse, is
-}>it true?
-}>-}>
-}>-}>How do you send SMS from Nagios?
-}>-}>
-}>-}>Thanks a lot.
-}>-}>
-}>-}>Marco
-}>-}>
-}>-}>
-}>-}>
-}>-}>-------------------------------------------------------
-}>-}>This SF.net email is sponsored by: Splunk Inc. Do you
-}grep -}through
-}>log -}>files for problems? Stop! Download the new AJAX
-}search engine
-}>that -}>makes searching your log files as easy as surfing the web.
-}>-}DOWNLOAD SPLUNK!
-}>-}>http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
-}>-}>_______________________________________________
-}>-}>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 -}> -}> -} -}
-}>-}--
-}>-}Stefano Coletta
-}>-}
-}>-}http://www.mindcreations.com
-}>-}
-}>
-}>
-}>
-}
-}
-}--
-}Stefano Coletta
-}
-}http://www.mindcreations.com
-}
-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems? Stop! Download the new AJAX search engine that makes
searching your log files as easy as surfing the web. DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_idv37&alloc_id865&op=click
_______________________________________________
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