3
# Plugin to monitor memory usage by type.
8
# autoconf (optional - only used by munin-config)
10
# $Log: memory_types.in,v $
11
# Revision 1.1.1.1 2006/06/04 20:53:57 he
12
# Import the client version of the Munin system monitoring/graphing
13
# tool -- project homepage is at http://munin.sourceforge.net/
15
# This package has added support for NetBSD, via a number of new plugin
16
# scripts where specific steps needs to be taken to collect information.
18
# I also modified the ntp_ plugin script to make it possible to not
19
# plot the NTP poll delay, leaving just jitter and offset, which IMO
20
# produces a more telling graph.
25
# Magic markers (optional - only used by munin-config and some
26
# installation scripts):
29
#%# capabilities=autoconf
31
if [ "$1" = "autoconf" ]; then
32
if [ -x /sbin/sysctl ]; then
33
if /sbin/sysctl hw.pagesize > /dev/null 2>&1; then
46
PAGESIZE=`/sbin/sysctl -n hw.pagesize`
47
MEMSIZE=`vmstat -s | awk '/pages managed/ { print $1 }'`
48
MEMMAX=`echo 2k $PAGESIZE $MEMSIZE '*p' | dc`
50
if [ "$1" = "config" ]; then
51
echo 'graph_args --base 1024 -l 0 --vertical-label Bytes --upper-limit '$MEMMAX
52
echo 'graph_title Memory usage by category'
53
echo 'graph_category system'
54
echo 'graph_info This graph shows how the machine uses its memory.'
56
echo 'graph_order exec anon file kernel free'
58
echo 'exec.label exec'
59
echo 'exec.info memory for cached executables'
62
echo 'anon.label anon'
63
echo 'anon.info anonymous memory'
64
echo 'anon.draw STACK'
66
echo 'file.label file'
67
echo 'file.info memory for cached non-executable files'
68
echo 'file.draw STACK'
70
echo 'kernel.label kernel'
71
echo 'kernel.info memory used by the kernel'
72
echo 'kernel.draw STACK'
74
echo 'free.label free'
75
echo 'free.info free memory'
76
echo 'free.draw STACK'
81
vmstat -s | awk -v bpp=$PAGESIZE '
82
/pages managed$/ { managed = $1; }
83
/pages free$/ { free = $1; print "free.value " $1 * bpp; }
84
/anonymous pages$/{ anon = $1; print "anon.value " $1 * bpp; }
85
/cached file pages$/{ file = $1; print "file.value " $1 * bpp; }
86
/cached executable pages$/{ exec = $1; print "exec.value " $1 * bpp; }
87
END { kernel = managed - anon - file - exec - free;
88
print "kernel.value " kernel * bpp; }'