[rancid] Re: OAM Ping scripts?
Ed Ravin
eravin at panix.com
Sat Mar 1 14:25:57 UTC 2008
On Thu, Feb 28, 2008 at 06:44:57PM -0500, Ed Ravin wrote:
> Has anyone automated performing OAM ping on an interface? It seems like
> a natural fit for RANCID...
It wasn't so hard to do, it turned out. Here's some sample shell code.
Assuming that "routercmd" runs the requested command on the appropriate
command line, and $VPI and $VCI have the VPI/VCI of the circuit you want
to OAM ping:
# determine the ATM subinterface
routerout=$(routercmd "show atm pvc" | perl -n -e "print \$1, \"\\n\" if /^(\\S+)\\s+\\S+\\s+$VPI\\s+$VCI\\s/")
# 1 2 3 4
# 6/0.1438 54 0 1438 PVC SNAP UBR 1536 UP
if [ -z "$routerout" ]
then
echo "cannot get data from router - check your VPI/VCI and try again"
exit 25
fi
pingcmd="ping atm interface ATM${routerout} $VPI $VCI end-loopback"
echo $pingcmd
routercmd "$pingcmd"
More information about the Rancid-discuss
mailing list