Adding case where there is no import route limit
This commit is contained in:
parent
68e01fdb74
commit
36ac6fa3d2
|
@ -1,3 +1,6 @@
|
|||
# nrpe-bird
|
||||
|
||||
Collection of scripts used to monitor bird sessions and route limits
|
||||
Collection of scripts used to monitor bird sessions and route limits
|
||||
|
||||
It’s not well tested against bird2 yet, but using -4 for either IPv4 and IPv6
|
||||
should be sufficient.
|
||||
|
|
17
check_bgp
17
check_bgp
|
@ -99,11 +99,26 @@ STATE="$($birdc show protocol ${SESSION} | \
|
|||
|
||||
ROUTE_LIMIT_IN="$($birdc show protocol all ${SESSION} | \
|
||||
awk '/Receive limit/ { print $3 }')"
|
||||
|
||||
# Test if we are on a bird2
|
||||
if [ -z ${ROUTE_LIMIT_IN} ]; then
|
||||
ROUTE_LIMIT_IN="$($birdc show protocol all ${SESSION} | \
|
||||
awk '/Import limit/ { print $3 }')"
|
||||
fi
|
||||
|
||||
# There is no import limit, so no ratio either
|
||||
if [ -z ${ROUTE_LIMIT_IN} ]; then
|
||||
RATIO_IN=0
|
||||
fi
|
||||
|
||||
ROUTES_IMPORTED="$($birdc show protocol all ${SESSION} | grep 'Routes:' | \
|
||||
sed -Ee '/imported/{ s/^.* ([0-9]+) imported.*$/\1/; p;}' -e d)"
|
||||
ROUTE_HIT_IN="$($birdc show protocol all ${SESSION} | \
|
||||
grep -E 'Receive limit:.*HIT')"
|
||||
RATIO_IN=$(echo "(${ROUTES_IMPORTED}*100)/${ROUTE_LIMIT_IN}" | bc)
|
||||
|
||||
if [ ! -z ${ROUTE_LIMIT_IN} ]; then
|
||||
RATIO_IN=$(echo "(${ROUTES_IMPORTED}*100)/${ROUTE_LIMIT_IN}" | bc)
|
||||
fi
|
||||
|
||||
ROUTE_HIT_OUT="$($birdc show protocol all ${SESSION} | \
|
||||
grep -E 'Export limit:.*HIT')"
|
||||
|
|
Loading…
Reference in a new issue