====== Cisco IP Sla ======
^ Author | [[ pk21@hotmail.com | Peter Kok ]] |
^ Compatibility | Xymon 4.3.0 |
^ Requirements | net-snmp-utils |
^ Download | None |
^ Last Update | 2013-04-16 |
===== Description =====
this check will test the status of the ip sla command on cisco equipment to locate connectivity issues in a network. It was created especially to test the icmp-echo option but other tests will probably also work.
See screenshot for the output of the test:
{{:monitors:ip-sla-screenshot.jpg?200|}}
===== Installation =====
=== Server side ===
Copy paste the script to $BBHOME/ext/ip-sla.sh
Don´t forget to change the COMMUNITY variable if needed!
Add the lines below to your hobbitlaunch.cfg
[sla]
ENVFILE $BBHOME/etc/hobbitserver.cfg
CMD $BBHOME/ext/ip-sla.sh
LOGFILE $BBSERVERLOGS/ip-sla.log
INTERVAL 5m
Configure a cisco device with an ip sla check
conf t
ip sla 3
icmp-echo 172.16.1.2
threshold 200
tag iBGP
ip sla schedule 3 life forever start-time now
Now all you have to do is configure ip sla on your cisco equipment and add the tag //sla// after the host you want to monitor in your bb-hosts file
===== Source =====
==== ip-sla.sh ====
#!/bin/bash
#
# Author: Peter Kok(pk21@hotmail.com)
# Description: this check will test the status of the ip sla command on cisco equipment to locate connectivity issues in a network. It was created especially to test the icmp-echo option but other tests will probably also work.
#
# An example of a icmp-echo test below. You can configure a tag so xymon can use is to describe what is being tested:
# ip sla 3
# icmp-echo 172.16.1.2
# threshold 200
# tag iBGP
# ip sla schedule 3 life forever start-time now
#
# the check will display "Index: 3 RTT: 1 Threshold: 200 Status: ok Tag: iBGP" in xymon
#
BBHTAG=sla # What we put in bb-hosts to trigger this test
COLUMN=$BBHTAG # Name of the column, often same as tag in bb-hosts
COMMUNITY=public
$BBHOME/bin/bbhostgrep $BBHTAG | while read L
do
set $L # To get one line of output from bbhostgrep
HOSTIP="$1"
MACHINEDOTS="$2"
MACHINE=`echo $2 | $SED -e's/\./,/g'`
COLOR=green
MSG="$BBHTAG status for host $MACHINEDOTS"
declare -a STATUSCODES=('other' 'ok' 'disconnected' 'overThreshold' 'timeout' 'busy' 'notConnected' 'dropped' 'sequenceError' 'verifyError' 'applicationSpecific' 'dnsServerTimeout' 'tcpConnectTimeout' 'httpTransactionTimeout' 'dnsQueryError' 'httpError' 'error')
for INDEX in `/usr/bin/snmpwalk -c $COMMUNITY -v2c $HOSTIP 1.3.6.1.4.1.9.9.42.1.2.1.1.4|awk '{ print $1 }'|awk -F\. '{ print $10 }'`
do
RTT=$(/usr/bin/snmpget -c $COMMUNITY -v2c $HOSTIP 1.3.6.1.4.1.9.9.42.1.2.10.1.1.$INDEX|awk '{ print $4 }')
TAG=$(/usr/bin/snmpget -c $COMMUNITY -v2c $HOSTIP 1.3.6.1.4.1.9.9.42.1.2.1.1.3.$INDEX|awk -F\" '{ print $2 }')
STATUS=$(/usr/bin/snmpget -c $COMMUNITY -v2c $HOSTIP 1.3.6.1.4.1.9.9.42.1.2.10.1.2.$INDEX|awk '{ print $4 }')
THRESHOLD=$(/usr/bin/snmpget -c $COMMUNITY -v2c $HOSTIP 1.3.6.1.4.1.9.9.42.1.2.1.1.5.$INDEX|awk '{ print $4 }')
CCOLOR="green"
if [ "$STATUS" == 0 ] && [ "$COLOR" != "red" ]
then
CCOLOR="yellow"
if [ "$COLOR" != "red" ]
then
COLOR=yellow
fi
elif [ "$STATUS" == 1 ]
then
CCOLOR="green"
if [ "$COLOR" != "red" ] && [ "$COLOR" != "yellow" ]
then
COLOR=green
fi
else
COLOR=red
CCOLOR="red"
fi
STATUSTRANSLATED=${STATUSCODES[$STATUS]}
MSG=$(echo -e "$MSG\n Index: $INDEX\tRTT: $RTT\tThreshold: $THRESHOLD\tStatus: $STATUSTRANSLATED\tTag: $TAG")
done
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`
${MSG}
"
done
exit 0
===== Known Bugs and Issues =====
===== To Do =====
Couldn´t get graphs to work
===== Credits =====
Written by Peter Kok(pk21@hotmail.com)
===== Changelog =====
* **2014-04-16**
* Initial release