~ubuntu-branches/ubuntu/gutsy/munin/gutsy

« back to all changes in this revision

Viewing changes to node/node.d.linux/if_err_.in

  • Committer: Bazaar Package Importer
  • Author(s): Tore Anderson
  • Date: 2004-05-21 20:51:19 UTC
  • Revision ID: james.westby@ubuntu.com-20040521205119-oz8bllbjp9hs80ig
Tags: upstream-0+1.0.0pre5
ImportĀ upstreamĀ versionĀ 0+1.0.0pre5

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#!/bin/sh
 
2
#
 
3
# Wildcard-plugin to monitor network interfaces. To monitor an
 
4
# interface, link if_err_<interface> to this file. E.g.
 
5
#
 
6
#    ln -s /usr/share/munin/node/plugins-auto/if_err_ /etc/munin/node.d/if_err_eth0
 
7
#
 
8
# ...will monitor eth0.
 
9
#
 
10
# Any devince found in /proc/net/dev can be monitored. Examples include
 
11
# ipsec*, eth*, irda* and lo. Please note that vlans and aliases cannot
 
12
# be monitored with this plugin.
 
13
#
 
14
# $Log: if_err_.in,v $
 
15
# Revision 1.1  2004/01/02 18:50:01  jimmyo
 
16
# Renamed occurrances of lrrd -> munin
 
17
#
 
18
# Revision 1.1.1.1  2004/01/02 15:18:07  jimmyo
 
19
# Import of LRRD CVS tree after renaming to Munin
 
20
#
 
21
# Revision 1.3  2003/11/07 22:12:50  jimmyo
 
22
# Changed deprecated plugin options
 
23
#
 
24
# Revision 1.2  2003/11/07 17:43:16  jimmyo
 
25
# Cleanups and log entries
 
26
#
 
27
#
 
28
#
 
29
# Magic markers (optional - used by munin-config and some installation
 
30
# scripts):
 
31
#
 
32
#%# family=auto
 
33
#%# capabilities=autoconf suggest
 
34
 
 
35
HOSTNAME=$FQDN
 
36
INTERFACE=`basename $0 | sed 's/^if_err_//g'`
 
37
 
 
38
if [ "$1" = "autoconf" ]; then
 
39
        if [ -r /proc/net/dev ]; then
 
40
                echo yes
 
41
                exit 0
 
42
        else
 
43
                echo "no (/proc/net/dev not found)"
 
44
                exit 1
 
45
        fi
 
46
fi
 
47
 
 
48
if [ "$1" = "suggest" ]; then
 
49
        if [ -r /proc/net/dev ]; then
 
50
                grep eth /proc/net/dev | cut -f1 -d: | sed 's/ //g'
 
51
                exit 0
 
52
        else
 
53
                exit 1
 
54
        fi
 
55
fi
 
56
 
 
57
if [ "$1" = "config" ]; then
 
58
        echo "host_name $HOSTNAME"
 
59
        echo "graph_order rcvd trans" 
 
60
        echo "graph_title $INTERFACE errors"
 
61
        echo 'graph_args --base 1000'
 
62
        echo 'graph_vlabel packets in (-) / out (+)'
 
63
        echo 'rcvd.label packets per min'
 
64
        echo 'rcvd.type COUNTER'
 
65
        echo 'rcvd.graph no'
 
66
        echo 'rcvd.cdef rcvd,8,*'
 
67
        echo 'rcvd.warning 1'
 
68
        echo 'trans.label packets per min'
 
69
        echo 'trans.type COUNTER'
 
70
        echo 'trans.negative rcvd'
 
71
        echo 'trans.cdef trans,8,*'
 
72
        echo 'trans.warning 1'
 
73
        exit 0
 
74
fi;
 
75
 
 
76
grep $INTERFACE /proc/net/dev | cut -f2 -d: | awk "{ print \"rcvd.value \" \$3 \"\ntrans.value \" \$11}"
 
77