~ubuntu-branches/ubuntu/lucid/munin/lucid

« back to all changes in this revision

Viewing changes to plugins/node.d.netbsd/memory_types.in

  • Committer: Bazaar Package Importer
  • Author(s): Holger Levsen, Stig Sandbeck Mathisen, Tom Feiner
  • Date: 2010-01-14 12:10:51 UTC
  • mfrom: (8.1.13 sid)
  • Revision ID: james.westby@ubuntu.com-20100114121051-6xovy6hqfh1wrl0u
Tags: 1.4.3-2
[ Stig Sandbeck Mathisen ]
* Add versioned dependency for librrds-perl.
  If used with librrds-perl 1.2 or older, the font path is wrong.

[ Tom Feiner ]
* Update watch file.
* Add patch from munin ticket #828, to suppress "occasional" unknown 
  states to avoid alerts. Thanks to Steve Wilson for the patch!
* Removed asterisks from NEWS.Debian and rewrite as non bulleted list, as
  advised by the developers reference.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
#! /bin/sh
 
2
#
 
3
# Plugin to monitor memory usage by type.
 
4
#
 
5
# Parameters:
 
6
#
 
7
#       config   (required)
 
8
#       autoconf (optional - only used by munin-config)
 
9
#
 
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/
 
14
#
 
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.
 
17
#
 
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.
 
21
#
 
22
#
 
23
#
 
24
#
 
25
# Magic markers (optional - only used by munin-config and some
 
26
# installation scripts):
 
27
#
 
28
#%# family=auto
 
29
#%# capabilities=autoconf
 
30
 
 
31
if [ "$1" = "autoconf" ]; then
 
32
    if [ -x /sbin/sysctl ]; then
 
33
        if /sbin/sysctl hw.pagesize > /dev/null 2>&1; then
 
34
                echo yes
 
35
                exit 0
 
36
        else
 
37
                echo no
 
38
                exit 0
 
39
        fi
 
40
    else
 
41
        echo no
 
42
        exit 0
 
43
    fi
 
44
fi
 
45
 
 
46
PAGESIZE=`/sbin/sysctl -n hw.pagesize`
 
47
MEMSIZE=`vmstat -s | awk '/pages managed/ { print $1 }'`
 
48
MEMMAX=`echo 2k $PAGESIZE $MEMSIZE '*p' | dc`
 
49
 
 
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.'
 
55
 
 
56
        echo 'graph_order exec anon file kernel free'
 
57
 
 
58
        echo 'exec.label exec'
 
59
        echo 'exec.info memory for cached executables'
 
60
        echo 'exec.draw AREA'
 
61
 
 
62
        echo 'anon.label anon'
 
63
        echo 'anon.info anonymous memory'
 
64
        echo 'anon.draw STACK'
 
65
 
 
66
        echo 'file.label file'
 
67
        echo 'file.info memory for cached non-executable files'
 
68
        echo 'file.draw STACK'
 
69
 
 
70
        echo 'kernel.label kernel'
 
71
        echo 'kernel.info memory used by the kernel'
 
72
        echo 'kernel.draw STACK'
 
73
 
 
74
        echo 'free.label free'
 
75
        echo 'free.info free memory'
 
76
        echo 'free.draw STACK'
 
77
 
 
78
        exit 0
 
79
fi
 
80
 
 
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; }'