Search Exchange
Search All Sites
Nagios Live Webinars
Let our experts show you how Nagios can help your organization.Login
Directory Tree
check_traceroute.sh
99323
Meet The New Nagios Core Services Platform
Built on over 25 years of monitoring experience, the Nagios Core Services Platform provides insightful monitoring dashboards, time-saving monitoring wizards, and unmatched ease of use. Use it for free indefinitely.
Monitoring Made Magically Better
- Nagios Core on Overdrive
- Powerful Monitoring Dashboards
- Time-Saving Configuration Wizards
- Open Source Powered Monitoring On Steroids
- And So Much More!
##### Created by Joe McShinsky #####
#! /bin/bash
if [ $# -ne 3 ]
then
echo "Usage: check_traceroute.sh [host] [1st hop] [2nd hop]"
exit 3
fi
chr=`/bin/traceroute -n -N 1 --max-hops=4 $1`
chf=`echo "$chr" | grep $2 | wc -l`
chs=`echo "$chr" | grep $3 | wc -l`
fh=`echo "$chr" | head -n2 | tail -n1 | awk '{ print $2 }'`
sh=`echo "$chr" | head -n3 | tail -n1 | awk '{ print $2 }'`
out="(1st Hop = $fh) (2nd Hop = $sh)"
if [ `expr $chf + $chs` = 2 ]
then
echo "OK: $out"
exit 0
fi
if [ `expr $chf + $chs` -ne 2 ]
then
echo "CRITICAL: $out"
exit 2
fi
echo "Oops! Something Went Wrong $out"
exit 3
#! /bin/bash
if [ $# -ne 3 ]
then
echo "Usage: check_traceroute.sh [host] [1st hop] [2nd hop]"
exit 3
fi
chr=`/bin/traceroute -n -N 1 --max-hops=4 $1`
chf=`echo "$chr" | grep $2 | wc -l`
chs=`echo "$chr" | grep $3 | wc -l`
fh=`echo "$chr" | head -n2 | tail -n1 | awk '{ print $2 }'`
sh=`echo "$chr" | head -n3 | tail -n1 | awk '{ print $2 }'`
out="(1st Hop = $fh) (2nd Hop = $sh)"
if [ `expr $chf + $chs` = 2 ]
then
echo "OK: $out"
exit 0
fi
if [ `expr $chf + $chs` -ne 2 ]
then
echo "CRITICAL: $out"
exit 2
fi
echo "Oops! Something Went Wrong $out"
exit 3
Reviews (0)
Be the first to review this listing!