From OpenNMS
Contents |
Polling XMPP service
I've used the General Purpose Poller (and monitor) configured as described on the main page to confirm availability of a XMPP instant messaging service. Specifically, I'm using OpenFire. Here is how it is done.
capsd-configuration.xml
....
<protocol-plugin protocol="XMPP" class-name="org.opennms.netmgt.capsd.plugins.GpPlugin" scan="on" user-defined="true">
<property key="script" value="/opt/monitoring_scripts/xmppTimeout.sh" />
<property key="banner" value="</stream:stream>"/> <!-- Confirm this is what your server gives you, I've seen other things -->
<property key="timeout" value="3000" />
<property key="retry" value="1" />
</protocol-plugin>
....
poller-configuration.xml
....
<service name="XMPP" interval="300000" user-defined="true" status="on">
<parameter key="script" value="/opt/monitoring_scripts/xmppTimeout.sh"/>
<parameter key="banner" value="</stream:stream>"/>
<parameter key="retry" value="1"/>
<parameter key="timeout" value="3000"/>
<parameter key="rrd-repository" value="/opt/opennms/share/rrd/response" /> <!-- confirm this is what your server gives you-->
<parameter key="ds-name" value="XMPP" />
</service>
....
....
<monitor service="XMPP" class-name="org.opennms.netmgt.poller.monitors.GpMonitor" />
....
Throttling Wrapper
- This is dependent on a recent version of GNU coreutils which has the timeout command.
#! /bin/bash
timeout=1;
hostname=foo;
while [ $# -gt 0 ]; do
case $1 in
--timeout)
timeout=$2
shift
;;
--hostname)
hostname=$2
shift
;;
*)
#echo $1
shift
;;
esac
done
#echo "timeout: "$timeout;
#echo "hostname: "$hostname;
timeout $timeout ./xmppTest.sh $hostname
Testing XMPP health
- This allows us to send a valid message to the XMPP server, and get the results; which we test against the banner configuration in poller-configuration.xml. This is in the xmppTest.sh file referred to by the timeout wrapper.
#! /bin/bash exec 3<>/dev/tcp/$1/5222 echo -e "<stream:stream to="$1" xmlns="jabber:client" xmlns:stream="http://etherx.jabber.org/streams">\r\n\r\n" >&3 cat <&3






