Thursday, February 24, 2011

Configuring Xymon for SMS Server Tools 3

I have done SMS configurations for a variety of monitoring tools in the past.  Nagios is one of them, however in this post we wont be dealing with nagios or any of those stuff related to nagios.  What we will be configuring is xymon/hobbit monitor to work with sms server tools 3.  If you notice, documentation from these two technologies are almost too stiff-straightforward and you have to do more than just read the man pages to get things done. 

The fun side in this tutorial is this; you will be re-using old and existing equipment to get the job done.  In my case I used an HSDPA modem to act as my SMS modem.  After that you will need an SMS gateway software to glue the entire project. 

Lets dig down to the details:

1. Configure your xymon server for mail notification alerts.  If you get alerts after a good configuration then you are ready to move foward with the next steps.

2. Download and install SMS Server Tools 3 http://smstools3.kekekasvi.com/packages/smstools3-3.1.14.tar.gz

3. Configure your modem to be detected by your system, it doesn't matter what NIX variant you are using.  In my case I used CentOS 5.5 to install and configure my HSDPA modem Huawei Technologies Co., Ltd. E220 HSDPA Modem / E270 HSDPA/HSUPA Modem.  It usually comes with a virtual cdrom and storage that can be detected by your system.  The goal here is remove those you dont need for you to use it only as a communication device.

4. Once you have installed SMS Server Tools 3 you will need to edit this file smsd.conf which can be located at /etc/smsd.conf and edit this line:
device=/dev/ttyS0 to device=/dev/ttyUSB1, save the file.

5. If you can see these lines from your tail log, it means you are doing good. 

$sudo /usr/bin/tail -f /var/log/smsd.log
2011-02-24 21:16:13,6, GSM1: Checking device for incoming SMS
2011-02-24 21:16:13,6, GSM1: Checking if modem is ready
2011-02-24 21:16:13,7, GSM1: -> AT
2011-02-24 21:16:13,7, GSM1: Command is sent, waiting for the answer
2011-02-24 21:16:13,7, GSM1: <- OK
2011-02-24 21:16:13,6, GSM1: Pre-initializing modem
2011-02-24 21:16:14,7, GSM1: -> ATE0+CMEE=1;+CREG=2
2011-02-24 21:16:14,7, GSM1: Command is sent, waiting for the answer
2011-02-24 21:16:14,7, GSM1: <- OK
2011-02-24 21:16:14,7, GSM1: -> AT+CSQ
2011-02-24 21:16:14,7, GSM1: Command is sent, waiting for the answer
2011-02-24 21:16:14,7, GSM1: <- +CSQ: 15,99 OK
2011-02-24 21:16:14,6, GSM1: Signal Strength Indicator: (15,99) -83 dBm (Good), Bit Error Rate: not known or not detectable
2011-02-24 21:16:14,6, GSM1: Checking if Modem is registered to the network

6. Test the sendsms binary, send a text message:  /usr/local/bin/sendsms 091781000102,  you should receive an sms message from your server.

7. Now you need to define the checks you need this will normally be equaivalent to the one you set for you email notification alerts In my case heres how it looks like:

SCRIPT /usr/local/bin/textalert FORMAT=sms
the "textalert" command is a simple bash script (or any scripting language you prefer would suffice) that handles the actual "sendsms" binary that actually sends out the messages. 

Done.  In the next post I will discuss escalations and other modifications necessary to make xymon work as you expect it to be.

This has been reposted to: http://www.howtoforge.com/node/6096

No comments:

Post a Comment