2015-01-01 20:34:15 +01:00
|
|
|
# Statistics
|
2015-06-01 15:38:50 +02:00
|
|
|
|
|
|
|
|
|
|
|
## IRC
|
|
|
|
|
|
|
|
Channel statistics for #dn42@hackint are available at: https://dev.0l.dn42/stats/.
|
2015-01-01 20:34:15 +01:00
|
|
|
|
|
|
|
## Scripts
|
|
|
|
|
|
|
|
### Number of prefixes for collectd
|
|
|
|
|
|
|
|
#### collectd.conf
|
|
|
|
|
2021-05-31 20:23:59 +02:00
|
|
|
````
|
2015-01-01 20:34:15 +01:00
|
|
|
LoadPlugin exec
|
|
|
|
<Plugin exec>
|
|
|
|
Exec nobody "/etc/collectd/bgp_prefixes-quagga.sh"
|
|
|
|
</Plugin>
|
2021-05-31 20:23:59 +02:00
|
|
|
````
|
2015-01-01 20:34:15 +01:00
|
|
|
|
|
|
|
collectd refuses to exec scripts as root. On Debian vtysh is compiled with PAM support: adding nobody to the quaggavty group suffices.
|
|
|
|
|
|
|
|
#### bgp_prefixes-quagga.sh
|
|
|
|
|
2021-05-31 20:23:59 +02:00
|
|
|
````sh
|
2015-01-01 20:34:15 +01:00
|
|
|
#!/bin/bash
|
|
|
|
|
|
|
|
INTERVAL=10
|
|
|
|
HOSTNAME=dn42.hq.c3d2.de
|
|
|
|
|
|
|
|
while true; do
|
|
|
|
n4=$(vtysh -d bgpd -c "show ip bgp"|grep Total|sed -e 's/Total number of prefixes //')
|
|
|
|
n6=$(vtysh -d bgpd -c "show ipv6 bgp"|grep Total|sed -e 's/Total number of prefixes //')
|
|
|
|
|
|
|
|
echo "PUTVAL $HOSTNAME/quagga-bgpd/routes-IPv4 interval=$INTERVAL N:$n4"
|
|
|
|
echo "PUTVAL $HOSTNAME/quagga-bgpd/routes-IPv6 interval=$INTERVAL N:$n6"
|
|
|
|
|
|
|
|
sleep $INTERVAL
|
|
|
|
done
|
2021-05-31 20:23:59 +02:00
|
|
|
````
|
2015-01-01 20:34:15 +01:00
|
|
|
|
|
|
|
#### Number of prefixes per neighbour for bird
|
|
|
|
|
2021-05-31 20:23:59 +02:00
|
|
|
````sh
|
2015-01-01 20:34:15 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
# Collectd script for collecting the number of routes going through each
|
|
|
|
# BGP neighour. Works for bird.
|
|
|
|
#
|
|
|
|
# See https://dn42.net/Services-Statistics
|
|
|
|
|
|
|
|
INTERVAL=60
|
|
|
|
HOSTNAME=mydn42router
|
|
|
|
[ -n "$COLLECTD_HOSTNAME" ] && HOSTNAME="$COLLECTD_HOSTNAME"
|
|
|
|
|
|
|
|
while true
|
|
|
|
do
|
|
|
|
birdc 'show protocols "*"' | grep ' BGP' | cut -d ' ' -f 1 | while read neighbour
|
|
|
|
do
|
|
|
|
nbroutes=$(birdc "show route protocol $neighbour primary count" | grep -v 'BIRD' | cut -d ' ' -f 1)
|
|
|
|
echo "PUTVAL $HOSTNAME/bird-bgpd/routes-$neighbour interval=$INTERVAL N:$nbroutes"
|
|
|
|
done
|
|
|
|
# FIXME: we probably count non-BGP routes here
|
|
|
|
totalroutes=$(birdc "show route primary count" | grep -v 'BIRD' | cut -d ' ' -f 1)
|
|
|
|
echo "PUTVAL $HOSTNAME/bird-bgpd/routes-all interval=$INTERVAL N:$totalroutes"
|
|
|
|
sleep $INTERVAL
|
|
|
|
done
|
2021-05-31 20:23:59 +02:00
|
|
|
````
|
2015-01-01 20:34:15 +01:00
|
|
|
|
|
|
|
### munin plugin
|
|
|
|
* add the following to /etc/munin/plugin-conf.d/munin-node
|
|
|
|
|
2021-05-31 20:23:59 +02:00
|
|
|
````
|
2015-01-01 20:34:15 +01:00
|
|
|
[quagga_bgp]
|
|
|
|
user root
|
2021-05-31 20:23:59 +02:00
|
|
|
````
|
2015-01-01 20:34:15 +01:00
|
|
|
|
|
|
|
* place the script as quagga_bgp in /etc/munin/plugins
|
|
|
|
|
2021-05-31 20:23:59 +02:00
|
|
|
````sh
|
2015-01-01 20:34:15 +01:00
|
|
|
#!/bin/sh
|
|
|
|
#
|
|
|
|
#
|
|
|
|
# Munin Plugin to show quagga bgp4 routes
|
|
|
|
|
|
|
|
# Standard Config Section Begin ##
|
|
|
|
if [ "$1" = "autoconf" ]; then
|
|
|
|
echo yes
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ "$1" = "config" ]; then
|
|
|
|
|
|
|
|
echo 'graph_title Quagga BGP4 Routes'
|
|
|
|
echo 'graph_args --base 1000 -l 0'
|
|
|
|
echo 'graph_scale yes'
|
|
|
|
echo 'graph_vlabel Received routes via BGP4'
|
|
|
|
echo 'graph_category Network'
|
|
|
|
echo 'bgproutes.label Routes'
|
|
|
|
echo 'graph_info Route information provided by quagga daemon via vtysh'
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
# Standard Config Section End ####
|
|
|
|
|
|
|
|
# Measure Section Begin ##########
|
|
|
|
data=($(vtysh -c "show ip bgp"|grep Total|cut -d" " -f5))
|
|
|
|
|
|
|
|
if [ "$data" = "" ]; then
|
|
|
|
echo bgproutes.value 0
|
|
|
|
else
|
|
|
|
echo bgproutes.value $data
|
|
|
|
fi
|
|
|
|
# Measure Section ##########
|
2021-05-31 20:23:59 +02:00
|
|
|
````
|
2015-01-01 20:34:15 +01:00
|
|
|
* restart munin-node
|