Projet

Général

Profil

Paste
Télécharger au format
Statistiques
| Branche: | Révision:

root / plugins / arp / arp_bsd_ @ e10e386b

Historique | Voir | Annoter | Télécharger (1,43 ko)

1
#!/bin/sh
2
#
3
# Wildcard-plugin to monitor arp on interfaces. To monitor an
4
# interface, link arp_bsd_<interface> to this file. E.g.
5
#
6
#    ln -s /usr/local/share/munin/plugins/arp_bsd_ /usr/local/etc/munin/plugins/arp_bsd_vlanX
7
#
8
# ...will monitor arp on interface vlanX.
9
#
10
# Any device found in /sbin/ifconfig can be monitored.
11
#
12
# Bugs : This plugins has been tested extensively on FreeBSD only
13
#
14
# Author : Luc Duchosal <luc.duchosal (at) arcantel (dot) ch>
15
#
16
# Magic markers (optional - used by munin-config and some installation
17
# scripts):
18
#
19
#%# family=auto
20
#%# capabilities=autoconf suggest
21

    
22

    
23
INTERFACE=`basename $0 | sed 's/^arp_bsd_//g'`
24

    
25
if [ "$1" = "autoconf" ]; then
26
        if [ -x /sbin/ifconfig ]; then
27
                echo yes
28
                exit 0
29
        else
30
                echo "no (/sbin/ifconfig not found)"
31
                exit 0
32
        fi
33
fi
34

    
35
if [ "$1" = "suggest" ]; then
36
        if [ -x /sbin/ifconfig ]; then
37
                /sbin/ifconfig -a | /usr/bin/grep -E '^[a-z]' | /usr/bin/awk -F\: '{print $1;}'
38
                exit 0
39
        else
40
                exit 1
41
        fi
42
fi
43

    
44
if [ "$1" = "config" ]; then
45

    
46
        echo "graph_title $INTERFACE arp"
47
        echo 'graph_args --base 1000'
48
        echo 'graph_vlabel arp per ${graph_period}'
49
        echo 'graph_category network'
50
        echo 'arp.label arp'
51
        exit 0
52
fi
53

    
54
/usr/sbin/arp -an | /usr/bin/grep $INTERFACE  | /usr/bin/wc -l | /usr/bin/awk '{ print "arp.value", $1;}'