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 85 86 87 88 89 90 91
|
#!/bin/sh
#
# Plugin to monitor CPU usage.
#
# Usage: Place in /etc/munin/node.d/ (or link it there using ln -s)
#
# Parameters understood:
#
# config (required)
# autoconf (optional - used by munin-config)
#
# $Log$
# Revision 1.4 2004/11/21 00:17:12 jimmyo
# Changed a lot of plugins so they use DERIVE instead of COUNTER.
#
# Revision 1.3 2004/05/20 19:02:38 jimmyo
# Set categories on a bunch of plugins
#
# Revision 1.2 2004/04/30 16:43:00 jimmyo
# Cleaned up Solaris plugins.
#
# Revision 1.1 2004/01/02 18:50:01 jimmyo
# Renamed occurrances of lrrd -> munin
#
# Revision 1.1.1.1 2004/01/02 15:18:07 jimmyo
# Import of LRRD CVS tree after renaming to Munin
#
# Revision 1.2 2003/11/07 17:43:16 jimmyo
# Cleanups and log entries
#
#
#
# Magic markers - optional - used by installation scripts and
# munin-config:
#
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /usr/bin/kstat ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo 'graph_title Paging Out'
echo 'graph_order pgout pgpgout pgfree scan'
echo "graph_args --base 1000"
echo 'graph_category system'
echo 'pgout.label pgout'
echo 'pgout.draw LINE2'
echo 'pgout.type DERIVE'
echo 'pgout.min 0'
echo 'pgout.max 1000000000'
echo 'pgpgout.label pgpgout'
echo 'pgpgout.draw LINE2'
echo 'pgpgout.type DERIVE'
echo 'pgpgout.min 0'
echo 'pgpgout.max 1000000000'
echo 'pgfree.label pgfree'
echo 'pgfree.draw LINE2'
echo 'pgfree.type DERIVE'
echo 'pgfree.min 0'
echo 'pgfree.max 1000000000'
echo 'scan.label scan'
echo 'scan.draw LINE2'
echo 'scan.type DERIVE'
echo 'scan.min 0'
echo 'scan.max 1000000000'
exit 0
fi
kstat -p -c misc -m cpu_stat -s '/^(pgout|pgpgout|dfree|scan)$/' | sed -e 's/.*://' | awk '
BEGIN {
map["pgout"] = "pgout"
map["pgpgout"] = "pgpgout"
map["dfree"] = "pgfree"
map["scan"] = "scan"
}
length(map[$1]) > 0 {
sum[map[$1]] += $2
}
END {
for (item in sum) {
print item ".value", sum[item]
}
}'
|