openbsd-ports/net/munin/files/bgpd
sthen f03621ea64 import ports/net/munin, this was joint work with mk@ and includes
a couple of his OpenBSD-specific plugins.

Munin the monitoring tool surveys all your computers and
remembers what it saw. It presents all the information in graphs
through a web interface. Its emphasis is on plug and play
capabilities. After completing an installation a high number
of monitoring plugins will be playing with no more effort.

Using Munin you can easily monitor the performance of your
computers, networks, SANs, applications, weather measurements
and whatever comes to mind. It makes it easy to determine
"what's different today" when a performance problem crops up. It
makes it easy to see how you're doing capacity-wise on any
resources.
2009-11-17 11:11:20 +00:00

59 lines
1.3 KiB
Bash
Executable File

#!/bin/sh
#
# $OpenBSD: bgpd,v 1.1.1.1 2009/11/17 11:11:21 sthen Exp $
#
# Script to monitor OpenBGPD peers
# (c) 2007 Michael Knudsen <mk@openbsd.org>
# client-conf.d/-options:
#
# env.rsock - path to bgpd control socket
# defaults to /var/www/logs/bgpd.rsock
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
# Magic markers (optional - used by munin-config and installation
# scripts):
#
#%# family=auto
#%# capabilities=autoconf
RSOCK=${rsock}
RSOCK=${RSOCK:-/var/www/logs/bgpd.rsock}
if [ "$1" = "autoconf" ]; then
if [ -x "/usr/sbin/bgpctl" -a -S "${RSOCK}" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_args --base 1000'
echo 'graph_title BGP peering overview'
echo 'graph_vlabel prefixes'
echo 'graph_category network'
echo 'graph_info This graph shows the number of prefixes (routes) received from the currently used BGP peers.'
/usr/sbin/bgpctl -s $RSOCK sh | sed -n '2,$p' | while read p; do
peername=$(echo $p | cut -d ' ' -f1 | sed 's/[\.\-]/_/g')
echo "$peername.label $peername"
done
exit 0
fi
/usr/sbin/bgpctl -s $RSOCK sh | sed -n '2,$p'| while read p; do
peername=$(echo $p | cut -d ' ' -f1 | sed 's/[\.\-]/_/g')
value=$(echo $p | awk '{ split($7,outp,"/"); print outp[1]; }')
echo "$peername.value ${value}"
done