Skip to content

Commit

Permalink
added a bgp montioring tool
Browse files Browse the repository at this point in the history
  • Loading branch information
Yornik Heyl committed Jun 22, 2017
1 parent 4937bf5 commit f043e0b
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 0 deletions.
1 change: 1 addition & 0 deletions build.txt
Original file line number Diff line number Diff line change
Expand Up @@ -67,5 +67,6 @@ check_ssl-cert 1.0
check_topology-latency.rb 1.0
check_graphite-metric 1.0
check_oom-killer.rb 0.1.2
check_bgp 1.0

# vim: set ts=2 sw=2 et : #
24 changes: 24 additions & 0 deletions check_bgp
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
#!/bin/bash
# Script to monitor BGP conections.
# MIT License Copyright (c) [2017] [Yornik Heyl] (yornik@yornik.nl)

# helper function by Dave Simons
die () {
RETVAL=$1
shift
echo $@
exit $RETVAL
}

status_string=$(vtysh -c 'show ip bgp neighbors'| awk '/Description: '$1'/,/BGP state/' | sed -n -e 's/^.*BGP state = //p' )

if [ -z "$status_string" ]; then
die 2 "[UNKNOWN] BGP conection with $1 is not cofigured "
fi


if echo "$status_string" |grep --quiet Established ;then
die 0 "[OK] BGP conection with $1 is up"
else
die 2 "[FAIL] BGP conection with $1 is down in state $status_string"
fi

0 comments on commit f043e0b

Please sign in to comment.