#!/usr/bin/perl # # This is the Vola.it SMS alert plugin for mon (http://www.kernel.org/software/mon/) # # In order to setup this correctly, have a look at http://www.danieleduca.it/smsmon.php # # Version 0.2 # # Author # Daniele Duca (daniele[-at-]danieleduca.it) # # Changelog # 07/02/05 - Plugin rewritten in Perl due some bugs found in the shell script version (0.2) # 03/02/05 - First release written in shell script. (0.1) $VOLAUID="Your-VOLA-Userid"; $VOLAPASS="Your-VOLA-Password"; $LOGFILE="/var/log/sms.warn.log"; $SMS="-MON%20($wday%20$mon%20$day%20$tm)%20-%20Service%20$opt_s%20down%20on%20host%20$summary"; use Getopt::Std; use Text::Wrap; use HTTP::Lite; getopts ("S:s:g:h:t:l:u"); $summary=; chomp $summary; $mobile = join (',', @ARGV); $summary = $opt_S if (defined $opt_S); $t = localtime($opt_t); ($wday,$mon,$day,$tm) = split (/\s+/, $t); $http = new HTTP::Lite; open(LOGFILE, ">> $LOGFILE"); print LOGFILE "($wday $mon $day $tm) - Now Warning $mobile (Host: $summary - Service: $opt_s)\n"; $req = $http->request("http://sms.vola.it/cgi/volasms_gw.php?UID=$VOLAUID&PWD=$VOLAPASS&CMD=1&DEST=$mobile&MSG=$SMS") or die "Unable to get document: $!"; print LOGFILE $http->body(); close LOGFILE;