summaryrefslogtreecommitdiff
path: root/sysutils/munin-node/files/node/node.d.netbsd/irqstats.in
blob: 4643a6407ce0e06123336c0eec0c055841febf81 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#! /bin/sh
# 
# Plugin to monitor the individual interrupt sources.
#
# Usage: Link or copy into /etc/munin/node.d/
#
# $Log: irqstats.in,v $
# Revision 1.1.1.1  2006/06/04 20:53:57  he
# Import the client version of the Munin system monitoring/graphing
# tool -- project homepage is at http://munin.sourceforge.net/
#
# This package has added support for NetBSD, via a number of new plugin
# scripts where specific steps needs to be taken to collect information.
#
# I also modified the ntp_ plugin script to make it possible to not
# plot the NTP poll delay, leaving just jitter and offset, which IMO
# produces a more telling graph.
#
#
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#
#%# family=auto
#%# capabilities=autoconf

if [ "$1" = "autoconf" ]; then
    if [ -x /usr/bin/vmstat ]; then
	echo yes
	exit 0
    else
	echo no
	exit 1
    fi
fi

intr_sources () {
    /usr/bin/vmstat -i | awk '
/^interrupt/ { next; }
/^Total/ { next; }
{
    s=substr($0, 1, 24);
    gsub(" *$", "", s);
    gsub(" ", "_", s);
    print s;
}
'
}

# If run with the "config"-parameter, give out information on how the
# graphs should look. 
 
if [ "$1" = "config" ]; then

    echo 'graph_title Individual interrupts'
    echo 'graph_args --base 1000 -l 0'
    echo 'graph_vlabel interrupts / ${graph_period}'
    echo 'graph_category system'
    echo -n 'graph_order '
    for i in `intr_sources`; do
	echo -n ' intr_'${i}
    done
    echo

    for i in `intr_sources`; do
#	echo 'intr_'${i}'.draw LINE'
	echo 'intr_'${i}'.label' `echo $i | sed -e 's/_/ /g'`
	echo 'intr_'${i}'.info Interrupt' `echo $i | sed -e 's/_/ /g'`
	echo 'intr_'${i}'.type DERIVE'
	echo 'intr_'${i}'.min 0'
    done
    exit 0
fi

/usr/bin/vmstat -i | awk '
/^interrupt/ { next; }
/^Total/ { next; }
/[0-9]/{
    s=substr($0, 1, 24);
    gsub(" *$", "", s);
    gsub(" ", "_", s);
    print "intr_" s ".value " $(NF-1);
}
'