Use external script to send IMs (Nagios)

I am trying to configure Nagios to send notifications via IM. I downloaded the nagios jabber plugin (written in perl using Net::Jabber::Message), but can not make it send an IM using my Openfire 3.4.2 server (RHEL4)

If I use the script below with authentication enabled, I get “No SASL mechanism found”. I then removed the authentication and changed Anonymous Login to be enabled ( Permitted Clients is set to All Clients). Now the script completes, but I get no IM.

Any Ideas what the problem is / how to make this work?

The script being used is:

#!/usr/bin/perl
use strict;
use Net::Jabber qw(Client) ;
use Net::Jabber qw(Message) ;
use Net::Jabber qw(Protocol) ;
use Net::Jabber qw(Presence) ;
use Getopt::Std ;
… omitting 200+ lines that set all the variables used below …
$connection = Net::Jabber::Client->new( debuglevel=>2, debugfile=>“/tmp/debug.log”, debugtime=>1);
$connection->Connect( “hostname” => $sender_host,“port” => $sender_port, “ssl” => $use_ssl ) or die
“Cannot connect ($!)\nhostname: $sender_host\nport: $sender_port\nsender JID:$sender_jid\n\n”;
#@result = $connection->AuthSend( “username” => $sender_uid,“password” =>
#$sender_pw,“resource” => $sender_resource, “ssl” => $use_ssl );
#if ($result[0] ne “ok”) {
#die “Ident/Auth with server failed: $result[0] - $result[1]\n”;
#}
$message = Net::Jabber::Message->new();
$message->SetMessage( “to” => $recipient_jid,
“subject” => $message_subject,
“type” => “normal”,
“body” => $alert_message,
“ssl” => $use_ssl);
$connection->Send($message);
sleep($max_wait);
$connection->Disconnect();
exit;

The output from the connection makes it look like the message was sent. But no IM is received.

/tmp/debug.log

Alert: Alert Message
Time: Wed, 13 Feb 10:21:04 UTC: -8.00
User: twells
Host: gv-adm-mon1


Beg-Summary–


test test test


End-Summary


</body><subject>Monitor Alert</subject></message>)
XML::Stream: Send: (<message to=‘twells@im.banskerv.com’ type=‘normal’><body>
Alert: Alert Message
Time: Wed, 13 Feb 10:21:04 UTC: -8.00
User: twells
Host: gv-adm-mon1


Beg-Summary


test test test


End-Summary–


</body><subject>Monitor Alert</subject></message>)
XML::Stream: Send: (</stream:stream>)
XML::Stream: SetCallBacks: tag(node) func(CODE(0xa3fe82c))
XMPP::Conn: Disconnect: bye bye

The Openfire Debug log shows the following error:

2008.02.13 10:37:24 ConnectionHandler:
java.io.IOException: Connection reset by peer
at sun.nio.ch.FileDispatcher.read0(Native Method)
at sun.nio.ch.SocketDispatcher.read(SocketDispatcher.java:21)
at sun.nio.ch.IOUtil.readIntoNativeBuffer(IOUtil.java:233)
at sun.nio.ch.IOUtil.read(IOUtil.java:206)
at sun.nio.ch.SocketChannelImpl.read(SocketChannelImpl.java:236)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.read(SocketIoProcessor.j ava:218)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.process(SocketIoProcesso r.java:198)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$400(SocketIoProce ssor.java:45)
at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProce ssor.java:485)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)
2008.02.13 10:37:24 ConnectionHandler:
java.io.IOException: Broken pipe
at sun.nio.ch.FileDispatcher.write0(Native Method)
at sun.nio.ch.SocketDispatcher.write(SocketDispatcher.java:29)
at sun.nio.ch.IOUtil.writeFromNativeBuffer(IOUtil.java:104)
at sun.nio.ch.IOUtil.write(IOUtil.java:75)
at sun.nio.ch.SocketChannelImpl.write(SocketChannelImpl.java:334)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcesso r.java:414)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.doFlush(SocketIoProcesso r.java:332)
at org.apache.mina.transport.socket.nio.SocketIoProcessor.access$500(SocketIoProce ssor.java:45)
at org.apache.mina.transport.socket.nio.SocketIoProcessor$Worker.run(SocketIoProce ssor.java:488)
at org.apache.mina.util.NamePreservingRunnable.run(NamePreservingRunnable.java:51)
at java.util.concurrent.ThreadPoolExecutor$Worker.runTask(ThreadPoolExecutor.java: 885)
at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:907)
at java.lang.Thread.run(Thread.java:619)