azubi: I would like to add my script for nagios monitoring.
this script is used as an escalationhanlder and create a call to the standby-guy's to wake them up if they didn't hear the last few SMS. :twisted:
Here we go (quick and dirty as usual):
#!/bin/bash
#
# this script is used to make a call instead of sending a sms as a eventhandler
# this scrip will also translate/convert the message to an sms-conform format
# Because this script is used as an HOST and SERVICE - handler, both should be covered.
#
# location : /usr/local/nagios/libexec/eventhanlder/make_call.sh
#
# v0.1 - write this script - azubi- 07.12.2009
# Variables
DESTINATION="/var/spool/sms/outgoing"
#DESTINATION="/var/tmp"
TIMESTAMP=`date +%d_%m_%Y_%H_%M`
TELNO="$1"
FILENAME=`< /dev/urandom tr -dc A-Z0-9 | head -c6`
LOGFILE="/var/log/nagios_calls.log"
TMPFILE1=/var/tmp/tmpfile1
# Cleanup
if [ -e $TMPFILE1 ]; then
rm $TMPFILE1
fi
# function
call_pikett()
{
echo "To: $TELNO" > $TMPFILE1
echo "Voicecall: yes" >> $TMPFILE1
echo "" >> $TMPFILE1
echo "TONE: 5 #,#,#" >> $TMPFILE1
}
# let's go and log
call_pikett
echo "***********************" >> $LOGFILE
echo "$TIMESTAMP" >> $LOGFILE
cat $TMPFILE1 >> $LOGFILE
mv $TMPFILE1 $DESTINATION/send_${FILENAME}
|
azubi: Hi keke
thank you for your hint. Now I understand how it works.
This was the solution:
/var/spool/sms/outgoing # vi send_a12345
To: 123456789
Voicecall: yes
TONE: 5 #,#,#
|
azubi: Hi keke
I tried as you suggested.
here is the code which I'm using for sending :
/etc/nagios # sendsms
Destination: 123456789
Text: Voicecall: yes TONE: 5 #,#,#
and here is the output from the logfile :
2009-12-04 09:41:03,5, smsd: Moved file /var/spool/sms/outgoing/send_E29761 to /var/spool/sms/checked
2009-12-04 09:41:04,6, GSM1: I have to send 1 short message for /var/spool/sms/checked/send_E29761
2009-12-04 09:41:04,6, GSM1: Sending SMS from to 123456789
2009-12-04 09:41:04,6, GSM1: Checking if modem is ready
2009-12-04 09:41:04,7, GSM1: -> AT
2009-12-04 09:41:04,7, GSM1: Command is sent, waiting for the answer
2009-12-04 09:41:04,7, GSM1: <- OK
2009-12-04 09:41:04,6, GSM1: Pre-initializing modem
2009-12-04 09:41:05,7, GSM1: -> ATE0+CMEE=1
2009-12-04 09:41:05,7, GSM1: Command is sent, waiting for the answer
2009-12-04 09:41:05,7, GSM1: <- OK
2009-12-04 09:41:05,6, GSM1: Checking if modem needs PIN
2009-12-04 09:41:05,7, GSM1: -> AT+CPIN?
2009-12-04 09:41:05,7, GSM1: Command is sent, waiting for the answer
2009-12-04 09:41:05,7, GSM1: <- +CPIN: READY OK
2009-12-04 09:41:06,7, GSM1: -> AT+CSQ
2009-12-04 09:41:06,7, GSM1: Command is sent, waiting for the answer
2009-12-04 09:41:06,7, GSM1: <- +CSQ: 31,99 OK
2009-12-04 09:41:06,6, GSM1: Checking if Modem is registered to the network
2009-12-04 09:41:06,7, GSM1: -> AT+CREG?
2009-12-04 09:41:06,7, GSM1: Command is sent, waiting for the answer
2009-12-04 09:41:07,7, GSM1: <- +CREG: 0,1 OK
2009-12-04 09:41:07,6, GSM1: Modem is registered to the network
2009-12-04 09:41:07,6, GSM1: Selecting PDU mode
2009-12-04 09:41:07,7, GSM1: -> AT+CMGF=0
2009-12-04 09:41:07,7, GSM1: Command is sent, waiting for the answer
2009-12-04 09:41:07,7, GSM1: <- OK
2009-12-04 09:41:07,7, GSM1: -> AT+CMGS=40
2009-12-04 09:41:07,7, GSM1: Command is sent, waiting for the answer
2009-12-04 09:41:08,7, GSM1: <- >
2009-12-04 09:41:08,7, GSM1: -> ( PDU REMOVED )
2009-12-04 09:41:08,7, GSM1: Command is sent, waiting for the answer
2009-12-04 09:41:11,7, GSM1: <- +CMGS: 225 OK
2009-12-04 09:41:11,5, GSM1: SMS sent, Message_id: 225, To: 123456789, sending time 7 sec.
2009-12-04 09:41:11,6, GSM1: Deleted file /var/spool/sms/checked/send_E29761
unfortunally, I recive only a sms.
kind regards
azubi
|
azubi: OpenSuSE 11.1:
Smsd v3.1.6:
Siemens TC35i Terminal :
Hi
I would like to send voicecall trough or with nagios.
Sending sms works fine.
If I try to send voicecalls, the cellphone receive only sms.
Here is my config-file :
devices = GSM1
logfile = /var/log/smsd.log
loglevel = 7
outgoing = /var/spool/sms/outgoing
autosplit = 3
# eventhandler= /usr/local/bin/sms_incoming.pl
# whitelist = /etc/sms-users
# sent = /var/spool/sms/sent
[GSM1]
# device = /dev/ttyS0
# device = /dev/ttyUSB0
device = /dev/serial-server
incoming = no
cs_convert = yes
pin = 1234
mode = new
baudrate = 57600
rtscts = no
voicecall_vts_list = yes
voicecall_ignore_modem_response = yes
So, what did I miss, or what did I wrong ?
Kind regards
azubi
|