Koozali.org: home of the SME Server

Simple Commandline SMS

Offline ReetP

  • *
  • 3,942
  • +6/-0
Simple Commandline SMS
« on: June 09, 2008, 04:10:46 PM »
Hi,

Just notes to myself really, but thought I would post here in case they were useful to anyone else :-)

I have a VOIPStunt account and had installed NAGIOS monitoring for a few machines and wanted to add some form of simple SMS alerting as an experiment. Wasn't bothered with hooking up a phone, com ports et al and using one of the more complicated bits of software around. Yes, if the Nagios host goes down, I'm in trouble, But this was just an experiment for a bit of fun really.

I looked around for something that might work with my current 'provider' and after a bit of googling saw pySMSsend (http://pysmssend.sourceforge.net/) which hooks into several providers. I thought that VOIPStunt looked similar to VOIPBuster which it supports (pretty sure it is one company owning several lookalikes) and thought I would try it.

Sure enough, it did :-)

Details of what I did are as follows :


Installing PySMSSend to send SMS messages from the commandline


yum install python-tools (not 100% sure if this is necessary, but I was desperately trying to get the 'mechanize' bit installed at the time and wondered if it was included !)

Grab a copy of pysmssend from pysmssend.sourceforge.net or http://hwoarang.silverarrow.gr/wp-content/distfiles/pysmssend-1.35.tar.gz

Grab a copy of http://wwwsearch.sourceforge.net/mechanize/ or http://wwwsearch.sourceforge.net/mechanize/src/mechanize-0.1.7b.tar.gz

Extract mechanize to a temporary folder and run python ez_setup.py THEN run /usr/bin/easy_install mechanize

(EasyInstall : http://peak.telecommunity.com/DevCenter/EasyInstall#installing-easy-install)

Extract pysmssend  to a temporary folder and run python install.sh

If you have a different provider (I was using VoipStunt which is the same as VoipBuster and others) you can manually change the config files accordingly.

I just added in VOIPStunt and copied the VOIPBuster lines changing the URL where necessary.

To send an SMS from the command line we just need to type :

pysmssend -a your_provider -u login_name -p password -n number "your text you want to send"

All I have to do now is add it in to my Nagios  :-?

If anyone wants to know any more then please ask, though I am no tech head........... I could bung up a Howto if need be ?

B. Rgds
John

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline HomePlayer

  • ***
  • 55
  • +0/-0
Re: Simple Commandline SMS
« Reply #1 on: June 09, 2008, 04:41:29 PM »
great, you just beat me to it, not that i am a tech head.
if just the great minds here would share there light on it,

thanks

Offline ReetP

  • *
  • 3,942
  • +6/-0
Re: Simple Commandline SMS
« Reply #2 on: June 09, 2008, 05:30:37 PM »
I don't *THINK* it affects anything on a standard system. Neither do I know whether it could be 'packaged' or not, or whether it's worth doing ?

Or just a Howto ?

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation

Offline dgs

  • ***
  • 63
  • +0/-0
Re: Simple Commandline SMS
« Reply #3 on: June 10, 2008, 04:11:55 AM »
This looks good!
However I'd like to consider adapting it to a local GSM engine as an alternative (or as an addition to) using an internet based SMS service. You lose your internet connection and you will not receive warnings of the outage.

Offline ReetP

  • *
  • 3,942
  • +6/-0
Re: Simple Commandline SMS
« Reply #4 on: June 10, 2008, 11:26:17 AM »
This looks good!
However I'd like to consider adapting it to a local GSM engine as an alternative (or as an addition to) using an internet based SMS service. You lose your internet connection and you will not receive warnings of the outage.

I think that has been done before :
http://forums.contribs.org/index.php?topic=38504.0
http://forums.contribs.org/index.php?topic=38708.0

Based on http://smstools3.kekekasvi.com/

I just did this as a bit of an experiment and for some fun really. There are two main limitations :

1. Your monitoring server goes down (a problem with whatever software you have installed !)
2. Your Internet connection goes down.


I'm sure it could be adapted further than the standard install but there are other tools that might be better suited as above.

This can be used for pretty well any sort of warning - not just outages. I'm sure there are people with greater minds than mine that can see some possibilities with it ! I would quite like to hook mine into a RAID check and possibly a fan/temp check for the various machines that I monitor. It could be installed on each one.

I guess the other way to look at it is if you have an online server and install it there...............

...
1. Read the Manual
2. Read the Wiki
3. Don't ask for support on Unsupported versions of software
4. I have a job, wife, and kids and do this in my spare time. If you want something fixed, please help.

Bugs are easier than you think: http://wiki.contribs.org/Bugzilla_Help

If you love SME and don't want to lose it, join in: http://wiki.contribs.org/Koozali_Foundation