Options for Nagios Sending SMS Messages

Martin Edge martinedge at kbs.net.au
Mon Apr 28 09:18:39 CEST 2003


We bought a device called a Phillips Twister GSM Modem..

Bit of perl, and I was talking fine.. 

Got a logic script (below) that talks to an object (SMS.pm) I wrote
that uses CU and Expect.. (the object is attached)

Might give you a good starting point, not the best code, but it works :)

Input:
./send.pl "You have received a message!" "+61439367205" 

Martin


----------<logic script > -------------------------
#!/usr/bin/perl

BEGIN {
        push(@INC, "/usr/local/web/monitor.kbs.net.au/sendsms/");
}

use SMS;

sub main {
        my $sms = new SMS;
        my $message = $ARGV[0];
        my $number = $ARGV[1];

	  # track the message for fun
        open(FILE, ">>/tmp/pager.tmp");
        print FILE localtime(time()).": $number - $message\n";
        close(FILE);

        # Connect
        if ($sms->ExpectConnect()) {
                if ($sms->sendSMS($message, $number)) {
                        print "Send Successfully\n";
                } else {
                        print "Failed sending :( \n";
                }
        } else {
                print "Couldn't connect to serial device!\n";
        }
}

main();

---------- </logic script> -------------------------------

-----Original Message-----
From: nagios-users-admin at lists.sourceforge.net [mailto:nagios-users-
admin at lists.sourceforge.net] On Behalf Of Gary MacMinn
Sent: Monday, 28 April 2003 4:11 PM
To: nagios-users at lists.sourceforge.net
Subject: [Nagios-users] Options for Nagios Sending SMS Messages


Hi All,

>From an Australian point of view, what options do I have for getting 
>Nagios to report issues to my mobile via SMS?

Any thoughts appreciated,

Gary MacMinn
Network Support Engineer
Department of Emergency Services =================================
+61 7 3109 5084
+61 7 3247 8665 (fax)
=================================
gmacminn at emergency.qld.gov.au
=================================
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SMS.pm.txt
URL: <https://www.monitoring-lists.org/archive/users/attachments/20030428/5c839e7b/attachment.txt>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: SMS.pm.txt
URL: <https://www.monitoring-lists.org/archive/users/attachments/20030428/5c839e7b/attachment-0001.txt>


More information about the Users mailing list