Send your cell phone SMS system alert messages.



SMSSend is a program used to send SMS messages over the network via command line in linux. It is licensed unto the GNU General License.

I recently aimed to integrate this into Zabbix remote monitoring software. I had a hell of a time finding the software because its original page, here, has some sort of apache configuration error and does not load. Thankfully, I found the source files needed on a mirror. For the sake of anyone else looking for this file, you can download it locally here:

http://systembash.com/source/smssend-3.5.tar.gz
http://systembash.com/source/skyutils-2.9.tar.gz

You will need to install that particular version of skyutils first, before compiling smssend.

Also, since the site is down, you can not grab the versions of the .sms that you need for certain providers. However, I used google cache to grab the one for clickatell and re-formatted the file to look right. Since it was not so obvious how to do this, I will paste clickatell.sms for you:

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
## SkySMS provider file - http://www.clickatell.com
## # Version 0.1
# by Steve Herrell
# Error codes :
# 1 -> General failure

NbParams 6
%Login : Your Login
%Password Hidden : Your Password
%ApiID Hidden : Your API ID
%Sender : The API Name
%Tel : Where it's going to
%Message Size=160 Convert : Your message

GetURL https://api.clickatell.com/http/sendmsg
Params from=\%Sender%&user=\%Login%&password=\%Password%&api_id=\%ApiID%&to=\%Tel%&text=\%Message%
Search ID:
PrintMsg message sent
Else
ErrorMsg 1 error sending message
GO

You then use this file (you can place in /usr/local/share/smssend/ which is the default location of the rest of the scripts) and then call this file using this syntax:

1
smssend clickatell.sms <Username> <Password> <API_ID> <API NAME> <Your Cell Phone Number> "Hello World"

If all goes well, you now have a text message that says “hello world”.

Note: Some of you, like me, may think that using your phones email address is a better (free) way to send alerts. You may be right. But my opinion is that adding e-mail into the mix adds an extra layer of uncertainty in actually receiving the message. I have had messages delayed for days that were sent via e-mail. Sending via SMS should be a more direct way to receive your urgent alerts.

Note 2: Don’t forget that you need to have internet connectivity to send SMS messages this way. The only way to have your server send an SMS message while being offline is by having a GSM Modem attached to it. Zabbix can talk directly with this modem to send your page.

  • Hi,

    There is a slight bug in with the above clickatell.sms script.

    The line:

    Params from=%Sender%&user=%Login%&password=%Password%&api_id=%ApiID%&to=%Tel%&text=%Message%

    needs to be

    Params from=%Sender%&user=%Login%&password=%Password%&api_id=%ApiID%&to=%Tel%&text=%Message%

    Else it doesn’t catch the correct var’s from the CLI.

    (smssend Version 3.4)

  • Hi,

    There is a slight bug in with the above clickatell.sms script.

    The line:

    Params from=%Sender%&user=%Login%&password=%Password%&api_id=%ApiID%&to=%Tel%&text=%Message%

    needs to be

    Params from=\%Sender%&user=\%Login%&password=\%Password%&api_id=\%ApiID%&to=\%Tel%&text=\%Message%

    Else it doesn’t catch the correct var’s from the CLI.

    (smssend Version 3.4)

  • Alex:

    This script seems to work with me. I believe depending on your system type you might need to escape the variables – but on CentOS it works like a charm how it is set up. Note to anyone trying this, if you have problems try using it with the escape slashes.

  • Alex:

    This script seems to work with me. I believe depending on your system type you might need to escape the variables – but on CentOS it works like a charm how it is set up. Note to anyone trying this, if you have problems try using it with the escape slashes.

  • Hans

    Hi, I’m trying to get this to work; I’m not a coder, and do not understand how to use this. Should I enter the %values in the clickatell.sms file, or pass them as command line arguments. I’ve tried both without success so far. E.g. changing the NbParams6 values, aswell as trying to run it like “smssend login password API.. “. I would be grateful if anyone could explain a bit more in detail howto.

  • Hans

    Hi, I’m trying to get this to work; I’m not a coder, and do not understand how to use this. Should I enter the %values in the clickatell.sms file, or pass them as command line arguments. I’ve tried both without success so far. E.g. changing the NbParams6 values, aswell as trying to run it like “smssend login password API.. “. I would be grateful if anyone could explain a bit more in detail howto.