Handle bird error
This commit is contained in:
parent
dc63fecbbd
commit
be36973ccc
|
@ -92,8 +92,13 @@ DIR="$(mktemp -d '/tmp/nrpe-bird.XXXX')"
|
||||||
# ${DIR}/bgp_protocols_up.txt
|
# ${DIR}/bgp_protocols_up.txt
|
||||||
|
|
||||||
# The sed removes the first two lines (BIRD 2.0.2 ready and Name Proto blah)
|
# The sed removes the first two lines (BIRD 2.0.2 ready and Name Proto blah)
|
||||||
birdc 'show protocols all' | sed '1,2d;$d' | \
|
birdc 'show protocols all' 2>${DIR}/bird-err | sed '1,2d;$d' | \
|
||||||
awk -v RS= -v DIR=$DIR '{print > (DIR "/" $1 ".txt")}'
|
awk -v RS= -v DIR=$DIR '{print > (DIR "/" $1 ".txt")}'
|
||||||
|
if [ $? != 0 ]; then
|
||||||
|
printf "ERROR: $(cat ${DIR}/bird-err)\n"
|
||||||
|
rm -r ${DIR}
|
||||||
|
exit 2
|
||||||
|
fi
|
||||||
|
|
||||||
for protocol in $(cat ${CONF_IGNORE_FILE}); do
|
for protocol in $(cat ${CONF_IGNORE_FILE}); do
|
||||||
rm "${DIR}/${protocol}.txt"
|
rm "${DIR}/${protocol}.txt"
|
||||||
|
|
Loading…
Reference in a new issue