[Xymon] FW: http ping in a script
Knox, Wesley
wesley.knox at siemens.com
Wed Nov 23 19:31:51 CET 2011
This worked like a charm. Thank you kind sir. KISS is always the best solution. Thanks for saving me from my own over-thinking!
From: Larry Barber [mailto:lebarber at gmail.com]
Sent: Wednesday, November 23, 2011 8:49 AM
To: Knox, Wesley
Subject: Re: [Xymon] http ping in a script
It would likely be easier to substitute 'curl -I' for the ping in your script, then process the output from the curl command.
Thanks,
Larry Barber
On Tue, Nov 22, 2011 at 3:58 PM, Knox, Wesley <wesley.knox at siemens.com<mailto:wesley.knox at siemens.com>> wrote:
So I have a script which monitors 3 ip's behind an l2l tunnel and I only get a red face if ALL 3 are unreachable. The script looks like so:
#!/bin/sh
BBHTAG=VPN # What we put in bb-hosts to trigger this test
COLUMN=$BBHTAG # Name of the column, often same as tag in bb-hosts
$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"
#... do the test, perhaps modify COLOR and MSG
COLOR=green # By default, everything is OK
MSG="All is OK"
HOSTS="172.200.129.226 172.34.55.66 172.202.94.226"
PINGCNT=3 # number of times to ping
STATUS="bad"
for host in $HOSTS
do
ping -c $PINGCNT $host
if [[ $? == 0 ]]
then
STATUS="ok"
fi
done
if [ $STATUS != "ok" ];then
COLOR="red"
MSG="Tunnel is down"
fi
$BB $BBDISP "status $MACHINE.$COLUMN $COLOR `date`
${MSG}
"
Done
****************************************************************************************************
The script works fine form most of my tunnels, but some clients don't allow ping on the network, and on top of that an even better check would be to hit 3 diff sites that are on those ips for the host for example http://172.66.11.33/hello/imhere.gif. Is there a simple way to motify the script above to use these full http host rather than the singular ip? I see in hobbitlaunch.cfg the bbnet entry which is responsible for the http test looks like this
[bbnet]
ENVFILE /home/hobbit/server/etc/hobbitserver.cfg
NEEDS hobbit
CMD bbtest-net --report --ping --checkresponse --timeout=30
LOGFILE $BBSERVERLOGS/bb-network.log
INTERVAL 5m
Do I need to make mine look somewhat like this so I can use the bbtest-net cmd within my script instead of just ping? I know its kind of a long wordy question and much help to anyone who can offer insight.
Wesley Knox
Systems Administration
BT | Retail & Commercial Systems
SIEMENS Industry, Inc.
7004 Bee Caves Road
Building Two, Suite 200
Austin, TX 78746
P: 512-306-9400 ext. 255<tel:512-306-9400%20ext.%20255>
C: 512-364-3720<tel:512-364-3720>
Wesley.knox at siemens.com<mailto:Wesley.knox at siemens.com>
usa.siemens.com/rcs<http://usa.siemens.com/rcs>
CONFIDENTIALITY NOTICE: This message, together with any attachments, is intended only for the use of the individual or entity to which it addresses and may contain information that is legally privileged, confidential and exempt from disclosure. If you are not the intended recipient, you are hereby notified that any dissemination, distribution, or copying of this message, or any attachment, is strictly prohibited. If you have received this message in error, please immediately notify the original sender and delete this message, along with any attachments from your computer.
_______________________________________________
Xymon mailing list
Xymon at xymon.com<mailto:Xymon at xymon.com>
http://lists.xymon.com/mailman/listinfo/xymon
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.xymon.com/pipermail/xymon/attachments/20111123/ee446a01/attachment.html>
More information about the Xymon
mailing list