SMS Box

Tango55-2 SMS Box Externe SMS-Box

Einrichten einer externen SMS-Box, welche Nagios-Benachrichtigungen über eine seriell angeschlossene SMS-Box versendet.

Als Hardware für den SMS-Versand wird das serielle Dual Band GSM Modem
Tango 55-2 der Firma Falcom Wireless Communication GmbH verwendet.

Die SMS-Box benötigt eine normale GSM SIM-Karte wie sie in handelsüblichen Handys verwendet wird.

Link zur Herstellerseite: http://www.falcom.de/products/modems/tango55/

Die SMS Box testen:

Das Geraet anschliessen und per minicom die Verbindung herstellen.

Die Einstellungen fuer die serielle Schnittstelle sind:
9600 bps, 8 bit, no parity bit, 1 stop bit

In der minicom Console eingeben:

AT

Sollte das Geraet kein OK zurueckgeben sind die Kabel, das Geraet oder die Einstellungen zu pruefen.

SMS Tools installieren:

Für den Versand von Nachrichten werden die SMS-Tools von http://smstools.meinemullemaus.de/ verwendet.

tar -xvzf smstools-2.2.10.tar.gz
cd smstools
make
make install

chmod 777 /var/spool/sms/*

SMSD konfigurieren:

vi /etc/smsd.conf

devices = GSM1
logfile = /var/log/smsd.log
loglevel = 7

[GSM1]
device = /dev/ttyS0
incoming = no
pin = 1234

smsd starten und Log pruefen:

/etc/init.d/sms start

vi + /var/log/smsd.log

Eine Test-SMS senden:

/usr/local/bin/sendsms 4917262xxxxxxx ‘Testsms’

Das Log pruefen, ob die SMS versendet wurde:

tail -f /var/log/smsd.log

2006-11-06 19:37:45,6, smsd: I have to send 1 short message for /var/spool/sms/checked/send_ZK7629
2006-11-06 19:37:45,6, GSM1: Sending SMS from to 0172xxxxxxx
2006-11-06 19:37:45,6, GSM1: Checking if modem is ready
2006-11-06 19:37:45,7, GSM1: -> AT^M
2006-11-06 19:37:45,7, GSM1: Command is sent, waiting for the answer
2006-11-06 19:37:45,7, GSM1: <- AT
OK
2006-11-06 19:37:45,6, GSM1: Checking if modem needs PIN
2006-11-06 19:37:45,7, GSM1: -> AT+CPIN?^M
2006-11-06 19:37:45,7, GSM1: Command is sent, waiting for the answer
2006-11-06 19:37:45,7, GSM1: <- AT+CPIN?
+CPIN: READY
OK
2006-11-06 19:37:45,6, GSM1: Checking if Modem is registered to the network
2006-11-06 19:37:45,7, GSM1: -> AT+CREG?^M
2006-11-06 19:37:45,7, GSM1: Command is sent, waiting for the answer
2006-11-06 19:37:46,7, GSM1: <- AT+CREG?
+CREG: 0,1
OK
2006-11-06 19:37:46,6, GSM1: Modem is registered to the network
2006-11-06 19:37:46,6, GSM1: Selecting PDU mode
2006-11-06 19:37:46,7, GSM1: -> AT+CMGF=0^M
2006-11-06 19:37:46,7, GSM1: Command is sent, waiting for the answer
2006-11-06 19:37:46,7, GSM1: <- AT+CMGF=0
OK
2006-11-06 19:37:46,7, GSM1: -> AT+CMGS=96^M
2006-11-06 19:37:46,7, GSM1: Command is sent, waiting for the answer
2006-11-06 19:37:46,7, GSM1: <- AT+CMGS=96
>
2006-11-06 19:37:46,7, GSM1: -> 0011000B9118ED0691C3ED341D1476A0202733C86B6C06^Z
2006-11-06 19:37:47,7, GSM1: Command is sent, waiting for the answer
2006-11-06 19:37:51,7, GSM1: <- 0011000B9118ED0691C3ED341D1476A0202733C86B6C06^Z
+CMGS: 1
OK
2006-11-06 19:37:51,5, GSM1: SMS sent, To: 0172xxxxxxxx
2006-11-06 19:37:51,6, smsd: Deleted file /var/spool/sms/checked/send_ZK7629


Einbinden der SMS-Box auf anderen Servern:

Das Verzeichnis /var/spool/sms/outgoing/ kann auch z.B. per NFS
anderen Servern zur Verfügung gestelt werden.

Zum versenden reicht es dann, ein Textfile im entsprechenden Format dort abzulegen.

Nachrichtenformat einer SMS-Nachricht

To: 4917xxxxxxxxx

Nachrichtentext ….

Nagios Kommandos zum SMS senden erstellen:

vi $NAGIOSDIR/etc/misccommands.cfg

define command {
command_name notify-by-sms
command_line /usr/local/bin/sendsms $CONTACTPAGER$ ‘$SERVICESTATE$ Alarm fuer $HOSTNAME$/$SERVICEDESC$ - Zeit: $LONGDATETIME$ - Output: $SERVICEOUTPUT$’
}

define command{
command_name host-notify-by-sms
command_line /usr/local/bin/sendsms $CONTACTPAGER$ ‘Host $HOSTALIAS$ ist $HOSTSTATE$ - Zeit: $LONGDATETIME$’
}

os