NAME

perlaspsms


SYNOPSIS

perlaspsms [--debug] [--config conf] [--recipient] message

perlaspsms [--debug] [--config conf] [--credits]

perlaspsms [--help]


OPTIONS

--help
Print a brief help message and exit.

--debug
Print debugging output.

--config
Specify the configuration file to read. If no configuration file is specified, the script tries to read (in this order): $HOME/.perlaspsms.conf, /etc/perlaspsms.conf. If no configuration file can be read, the script terminates with an error message.

--credits
Show the credits left and quit. This does not send an SMS message.

--recipient
Recipient number the SMS should be sent to. Multiple recipients can be specified.


DESCRIPTION

perlaspsms is a script that allows sending SMS through the service provided by http://aspsms.com. Prior to sending an SMS, perlaspsms checks the number of credits left. If less than a configurable number of credits are left, perlaspsms sends a warning email.


CONFIGURATION FILE

The configuration file defines the following variables in a simple key=value format:

userkey
User name for accessing the XML interface at http://aspsms.com.

password
Password for accessing the XML interface at http://aspsms.com.

originator
String used as originator in outgoing SMS.

server
A server through with the SMS are sent. Servers are given in host:port format. If multiple server lines are given, perlaspsms will try all of them.

credits-min
If less than this number of credits are available, perlaspsps sends a warning email message.

credits-smtp, credits-mailfrom, credits-mailto, credits-subject
The SMTP server address as well as email from, to and subject for sending the warning message.


LIBRARIES

perlaspsms uses some perl libraries that might not be installed by default: Mail::Sendmail, XML::XPath. You can get these from CPAN.


INSTALLATION

Install perlaspsms by copying it somewhere in your path. Then edit the perlaspsms.conf file and copy it to your desired location (see the --config parameter above).

Note that you need a aspsms.com account in order to use perlaspsms.


INTEGRATION INTO NAGIOS

To use perlaspsms to send notifications from Nagios, use the following template:

  define command {
    command_name          notify-by-aspsms
    command_line          perlaspsms --recipient $CONTACTPAGER$ "$NOTIFICATIONTYPE$: $HOSTALIAS$/$SERVICEDESC$ is $SERVICESTATE$ ($SHORTDATETIME$)"
  }

Note that this uses the pager attribute as phone number of your contacts.


AUTHOR

Written by Oliver Hitz mailto:oliver@net-track.ch.


COPYRIGHT AND LICENSE

Copyright (C) 2005 Oliver Hitz

This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License as published by the Free Software Foundation; either version 2 of the License, or (at your option) any later version.

This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.

You should have received a copy of the GNU General Public License along with this program; if not, write to the Free Software Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.