1
0
Fork 0
mirror of https://github.com/munin-monitoring/contrib.git synced 2025-07-21 18:41:03 +00:00

Save with UNIX line breaks

This commit is contained in:
Stig Sandbeck Mathisen 2014-10-05 20:30:52 +02:00
parent 2a638429c5
commit 632c24d0a9

View file

@ -1,118 +1,118 @@
#! /bin/ksh #! /bin/ksh
# Copyright (c) 2010, Wikimedia Deutschland # Copyright (c) 2010, Wikimedia Deutschland
# All rights reserved. # All rights reserved.
# #
# Redistribution and use in source and binary forms, with or without # Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met: # modification, are permitted provided that the following conditions are met:
# * Redistributions of source code must retain the above copyright # * Redistributions of source code must retain the above copyright
# notice, this list of conditions and the following disclaimer. # notice, this list of conditions and the following disclaimer.
# * Redistributions in binary form must reproduce the above copyright # * Redistributions in binary form must reproduce the above copyright
# notice, this list of conditions and the following disclaimer in the # notice, this list of conditions and the following disclaimer in the
# documentation and/or other materials provided with the distribution. # documentation and/or other materials provided with the distribution.
# * Neither the name of Wikimedia Deutschland nor the # * Neither the name of Wikimedia Deutschland nor the
# names of its contributors may be used to endorse or promote products # names of its contributors may be used to endorse or promote products
# derived from this software without specific prior written permission. # derived from this software without specific prior written permission.
# #
# THIS SOFTWARE IS PROVIDED BY WIKIMEDIA DEUTSCHLAND ''AS IS'' AND ANY # THIS SOFTWARE IS PROVIDED BY WIKIMEDIA DEUTSCHLAND ''AS IS'' AND ANY
# EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED # EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
# WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE # WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
# DISCLAIMED. IN NO EVENT SHALL WIKIMEDIA DEUTSCHLAND BE LIABLE FOR ANY # DISCLAIMED. IN NO EVENT SHALL WIKIMEDIA DEUTSCHLAND BE LIABLE FOR ANY
# DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES # DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
# (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; # (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
# LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND # LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
# ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT # ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS # (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
# SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. # SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
# #
# NOTE: This software is not released as a product. It was written primarily for # NOTE: This software is not released as a product. It was written primarily for
# Wikimedia Deutschland's own use, and is made public as is, in the hope it may # Wikimedia Deutschland's own use, and is made public as is, in the hope it may
# be useful. Wikimedia Deutschland may at any time discontinue developing or # be useful. Wikimedia Deutschland may at any time discontinue developing or
# supporting this software. There is no guarantee any new versions or even fixes # supporting this software. There is no guarantee any new versions or even fixes
# for security issues will be released. # for security issues will be released.
### ###
# Munin plugin to report Solaris memory usage via mdb's memstat. # Munin plugin to report Solaris memory usage via mdb's memstat.
# Must be run as root. # Must be run as root.
# #
# river@tamara.tcx.org.uk 2010-08-28 # river@tamara.tcx.org.uk 2010-08-28
#%# family=auto #%# family=auto
#%# capabilities=autoconf #%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then if [ "$1" = "autoconf" ]; then
if [ -e /usr/bin/mdb ]; then if [ -e /usr/bin/mdb ]; then
echo yes echo yes
exit 0 exit 0
else else
echo /usr/bin/mdb not found echo /usr/bin/mdb not found
exit 1 exit 1
fi fi
fi fi
if [ "$1" = "config" ]; then if [ "$1" = "config" ]; then
echo ' echo '
graph_args --base 1024 -l 0 --vertical-label Bytes graph_args --base 1024 -l 0 --vertical-label Bytes
graph_title Memory usage graph_title Memory usage
graph_category system graph_category system
graph_info This graph shows system memory use. graph_info This graph shows system memory use.
graph_order kernel anon exec cacheused zfs cachefree free graph_order kernel anon exec cacheused zfs cachefree free
kernel.label kernel kernel.label kernel
kernel.draw AREA kernel.draw AREA
kernel.info Memory used by kernel kernel.info Memory used by kernel
anon.label anon anon.label anon
anon.draw STACK anon.draw STACK
anon.info Memory used by programs anon.info Memory used by programs
exec.label exec_and_libs exec.label exec_and_libs
exec.draw STACK exec.draw STACK
exec.info Memory used by executable files and libraries exec.info Memory used by executable files and libraries
cacheused.label cacheused cacheused.label cacheused
cacheused.draw STACK cacheused.draw STACK
cacheused.info Memory used by page cache cacheused.info Memory used by page cache
zfs.label zfs zfs.label zfs
zfs.draw STACK zfs.draw STACK
zfs.info Memory used for ZFS file cache zfs.info Memory used for ZFS file cache
cachefree.label cachefree cachefree.label cachefree
cachefree.draw STACK cachefree.draw STACK
cachefree.info Free memory in cache list cachefree.info Free memory in cache list
free.label free free.label free
free.draw STACK free.draw STACK
free.info Free memory free.info Free memory
' '
exit 0 exit 0
fi fi
echo "::memstat" | mdb -k | nawk ' echo "::memstat" | mdb -k | nawk '
BEGIN { BEGIN {
pagesize='$(getconf PAGESIZE)' pagesize='$(getconf PAGESIZE)'
kernel=0 kernel=0
zfs=0 zfs=0
anon=0 anon=0
exec=0 exec=0
cache=0 cache=0
phys=0 phys=0
} }
/^Kernel/ { kernel=$2 } /^Kernel/ { kernel=$2 }
/^ZFS File Data/ { zfs=$4 } /^ZFS File Data/ { zfs=$4 }
/^Anon/ { anon=$2 } /^Anon/ { anon=$2 }
/^Exec and libs/ { exec=$4 } /^Exec and libs/ { exec=$4 }
/^Page cache/ { cacheused=$3 } /^Page cache/ { cacheused=$3 }
/^Free \(cachelist\)/ { cachefree=$3 } /^Free \(cachelist\)/ { cachefree=$3 }
/^Free \(freelist\)/ { free=$3 } /^Free \(freelist\)/ { free=$3 }
END { END {
print "kernel.value " (kernel * pagesize) print "kernel.value " (kernel * pagesize)
print "zfs.value " (zfs * pagesize) print "zfs.value " (zfs * pagesize)
print "anon.value " (anon * pagesize) print "anon.value " (anon * pagesize)
print "exec.value " (exec * pagesize) print "exec.value " (exec * pagesize)
print "cacheused.value " (cacheused * pagesize) print "cacheused.value " (cacheused * pagesize)
print "cachefree.value " (cachefree * pagesize) print "cachefree.value " (cachefree * pagesize)
print "free.value " (free * pagesize) print "free.value " (free * pagesize)
} }
' '