From a71ae17ae21eabbe71f09e63274848fdce1c4e7b Mon Sep 17 00:00:00 2001 From: Alarig Le Lay Date: Wed, 24 Feb 2021 13:56:21 +0100 Subject: [PATCH] check_bird2_oneshot: Adding OSPF ExStart check --- check_bird2_oneshot | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/check_bird2_oneshot b/check_bird2_oneshot index ba0e78f..053f792 100755 --- a/check_bird2_oneshot +++ b/check_bird2_oneshot @@ -1,6 +1,6 @@ #!/bin/sh -# Copyright 2019 alarig +# Copyright 2021 alarig # # BSD-3-Clause licence # @@ -85,6 +85,16 @@ test_route_limit() { 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="$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 Running) test_route_limit + test_exstart_neigh ;; Alone) printf "${protocol_name} is in ${STATE} state\n" >> \