Luca Ferrari wrote:
Hi,
did anybody configured a kind of software for getting information about the
server status (raid, disk space, etc.) thru SMS on a mobile phone? If so,
could you tell me which software have you used and how you configured it (or
where I can find some information)?
Thanks,
Luca
Hi,
I hope this reply is not too late... But anyway, here is the solution.
(all this is short description, but anyway you have to use /dev/brain ;)
Components:
1 Nokia's DLR-3P Cable
1 Nokia 6110i Cell Phone
1 PC with serial port + Linux
Instructions:
Connect everything as needed, and go to: www.mwiacek.com
Download latest gammu from there, compile and install.
Read gammu's docs on how to setup it with --smsd option
Install Nagios (if you want) or make any other simple monitoring script.
Create cgi like this (it's simple and possible buggy - but does his work):
----------------------------
#!/usr/local/bin/perl -w
use CGI;
sub clear_it($) {
my $var = shift;
if ($var =~ /[^0-9\+]/g) {
print "<SCRIPT LANGUAGE=\"javascript\">alert('Illegal number entered!'); history.back();</script>";
} else {
return $var;
}
}
$q = new CGI;
my $to = $q->param('to');
my $msg = $q->param('msg');
my $val = $q->param('validity');
print $q->header(-type => 'text/html',
-cost => 'Three smackers',
-annoyance_level => 'high',
-complaints_to => 'some@xxxxxxxxxxxxxxxx',
-destination => "$to");
$to = &clear_it($to);
# SET THESE TO REFLECT YOUR PATHS
$inbox = "/var/spool/sms/inbox";
$outbox = "/var/spool/sms/outbox";
$sent = "/var/spool/sms/sent";
$error = "/var/spool/sms/error";
$tmp = "/tmp/OUTA_\+".$to."_$$.txt";
print $q->start_html('Simple Script');
print $q->hr; print "Got: $to $msg $val -> $tmp"; print $q->br; print $q->hr;
print $q->end_html;
if (! -z $msg) {
open (MESS, ">$tmp") || die("Can\'t open $tmp: $?");
print MESS "$msg";
close MESS;
`mv $tmp $outbox`;
}
--------------------
put it in cgi-bin dir on SAME PC where gammu installed and running.
then...
try this from linux cmd line:
/usr/bin/curl -s -S SMS_SCRIPT_URL -d "to=<your_cell_number>&msg=message_you_want_to_send&validity=max"
or
just create file with content you want to send in /var/spool/sms/outbox in form of:
OUTA_+COUNTRYCELLPHONENUMBER_PRIORITY.txt
( Example: echo "Hehe, it worked" > /var/spool/sms/outbox/OUTA_+97254xxxxxx_01.txt )
and it will be sent asap.
Wait for your sms to arrive ;)
Hope that helps.
Best Regards,
ASA
-
: send the line "unsubscribe linux-admin" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html