sending notifications to windows instant messenger
Andy Harrison
aharrison at gmail.com
Mon Jun 28 14:40:26 CEST 2004
On Fri, 25 Jun 2004 15:03:21 -0500, Neil
<neil-on-nagios at restricted.dyndns.org> wrote:
>
> Hey guys,
>
> has anyone of you successfully implemented sending of notification to a
> Windows Instant Messenger? If so, can you send some links on how I can
> implement it. I found answers in Nagios FAQ but only for AOL and Yahoo
> Messenger.
>
Likely you could retool one of the scripts for aim and others to work.
The Net::MSN perl module would probably be helpful in this.
http://search.cpan.org/~djr/Net-MSN-1.022/
I wrote this just to test sending myself an aim message. Might be a
place to start, assuming Net::OSCAR is similar to Net::MSN.
#!/usr/local/bin/perl -w
#
# Created: 09/23/03 09:29:18 EDT by Andy Harrison
#
# Send an AOL Instant Message to the specified screen name
#
# Usage:
#
# imtest.andy --sn=ScreenName --pw=Password \
# --msg=\"Some Message\" --rcpt=Recipient \
# [--v]
#
# $Id$
use strict;
use Net::OSCAR qw(:standard);
use Getopt::Long;
$SIG{CHLD} = 'IGNORE';
$SIG{PIPE} = 'IGNORE';
use vars qw( $opt_screenname $opt_passwd $opt_message $opt_recipient );
GetOptions (
'sn=s' => \$opt_screenname,
'pw=s' => \$opt_passwd,
'msg=s' => \$opt_message,
'rcpt=s' => \$opt_recipient
'v!' => \$opt_verbose
);
unless ( $opt_screenname && $opt_passwd && $opt_message ) {
die "usage: $0 --sn=ScreenName --pw=Password --msg=\"Some
Message\" --rcpt=Recipient\n";
}
my $oscar = Net::OSCAR->new;
#$oscar->loglevel(9);
$oscar->set_callback_error(
sub {
my($oscar, $connection, $error, $description, $fatal) = @_;
die "Error $error: $description\n";
}
);
$oscar->set_callback_signon_done(
sub {
my $oscar = shift;
print "Signon completed.\n" if $opt_verbose;
$oscar->send_im($opt_recipient, $opt_message)
or die ( "unable to send message\n" );
print "Message sent\n" if $opt_verbose;
$oscar->signoff or die ( "problem signing off\n" );
print "Signed off\n" if $opt_verbose;
exit;
}
);
print "Signing on...\n" if $opt_verbose;
$oscar->signon($opt_screenname, $opt_passwd) or die "Unable to sign on\n";
while(1) {
$oscar->do_one_loop;
}
print "Complete...\n" if $opt_verbose;
--
Andy Harrison
-------------------------------------------------------
This SF.Net email sponsored by Black Hat Briefings & Training.
Attend Black Hat Briefings & Training, Las Vegas July 24-29 -
digital self defense, top technical experts, no vendor pitches,
unmatched networking opportunities. Visit www.blackhat.com
_______________________________________________
Nagios-users mailing list
Nagios-users at lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/nagios-users
::: Please include Nagios version, plugin version (-v) and OS when reporting any issue.
::: Messages without supporting info will risk being sent to /dev/null
More information about the Users
mailing list