1
mirror of https://git.dn42.dev/wiki/wiki.git synced 2025-03-05 01:53:03 +01:00

Updated Services-Statistics (markdown)

This commit is contained in:
dn42 wiki 2014-01-31 00:01:22 +01:00
parent 53efad2bb9
commit 5d6231f72d

View File

@ -4,18 +4,19 @@ Please add your public statistics.
## Scripts
### Number of prefixes for collectd
**collectd.conf**
#### collectd.conf
```
LoadPlugin exec
<Plugin exec>
Exec nobody "/etc/collectd/bgp_prefixes.sh"
Exec nobody "/etc/collectd/bgp_prefixes-quagga.sh"
</Plugin>
```
collectd refuses to exec scripts as root. On Debian vtysh is compiled with PAM support: adding nobody to the quaggavty group suffices.
**bgp_prefixes.sh**
#### bgp_prefixes-quagga.sh
```
#!/bin/bash
@ -34,6 +35,34 @@ sleep $INTERVAL
done
```
#### Number of prefixes per neighbour for bird
```
#!/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
```
### munin plugin
* add the following to /etc/munin/plugin-conf.d/munin-node