check_bird2_oneshot: Adding OSPF ExStart check

This commit is contained in:
Alarig Le Lay 2021-02-24 13:56:21 +01:00
parent 9d570c7385
commit a71ae17ae2
Signed by: alarig
GPG key ID: 7AFE62C6DF8BCDEC

View file

@ -1,6 +1,6 @@
#!/bin/sh #!/bin/sh
# Copyright 2019 alarig <alarig@grifon.fr> # Copyright 2021 alarig <alarig@grifon.fr>
# #
# BSD-3-Clause licence # BSD-3-Clause licence
# #
@ -85,6 +85,16 @@ test_route_limit() {
fi fi
} }
test_exstart_neigh() {
exstart_neighbors="$(${birdc} \
show ospf neighbors ${protocol_name} | grep -c ExStart)"
if [ "${exstart_neighbors}" -gt 0 ]; then
printf "${protocol_name} has " >> ${DIR}/WARNING.txt
printf "${exstart_neighbors} ExStart " >> ${DIR}/WARNING.txt
printf "neighbors\n" >> ${DIR}/WARNING.txt
fi
}
# path expansion for birdc and sudo of FreeBSD # path expansion for birdc and sudo of FreeBSD
PATH="$PATH:/usr/local/sbin/:/usr/local/bin/" PATH="$PATH:/usr/local/sbin/:/usr/local/bin/"
@ -148,6 +158,7 @@ for protocol in $(find ${DIR} -type f); do
# https://gitlab.labs.nic.cz/labs/bird/blob/master/proto/ospf/ospf.c#L532 # https://gitlab.labs.nic.cz/labs/bird/blob/master/proto/ospf/ospf.c#L532
Running) Running)
test_route_limit test_route_limit
test_exstart_neigh
;; ;;
Alone) Alone)
printf "${protocol_name} is in ${STATE} state\n" >> \ printf "${protocol_name} is in ${STATE} state\n" >> \