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

Plugin-Gallery: Get better 2nd level headings

Review of category "system"
This commit is contained in:
dipohl 2017-02-24 23:54:53 +01:00
parent 54a91c13a4
commit 7fdb4741fe
27 changed files with 18 additions and 12 deletions

64
plugins/memory/kmemsum Executable file
View file

@ -0,0 +1,64 @@
#!/bin/sh
# Kernel Memory usage stats.
# Author: alex@trull.org
#
# Based on the short script at http://wiki.freebsd.org/ZFSTuningGuide (20080820)
#
# Parameters:
#
# config (required)
# autoconf (optional - only used by munin-config)
#
# Magic markers (optional - only used by munin-config and some
# installation scripts):
#%# family=auto
#%# capabilities=autoconf
if [ "$1" = "autoconf" ]; then
if [ -x /sbin/sysctl ]; then
/sbin/sysctl vm.kmem_size_max > /dev/null
if [ $? = "0" ]; then
echo yes
exit 0
else
echo no
exit 1
fi
else
echo no
exit 1
fi
fi
TEXT=`kldstat | tr a-f A-F | awk 'BEGIN {print "ibase=16"}; NR > 1 {print $4}' | bc | awk '{a+=$1}; END {print a}'`
DATA=`vmstat -m | sed 's/K//' | awk '{a+=$3}; END {print a*1024}'`
TOTAL=`echo $DATA $TEXT | awk '{print $1+$2}'`
MAX=`sysctl vm.kmem_size_max | awk '{print $2}'`
if [ "$1" = "config" ]; then
echo 'graph_args --base 1024 -l 0 --vertical-label Bytes'
echo 'graph_title Kernel Memory usage'
echo 'graph_category system'
echo 'graph_info This graph shows kmem usage.'
echo 'graph_order text data'
echo 'text.label text'
echo 'text.info kmem text'
echo 'text.draw AREA'
echo 'data.label data'
echo 'data.info kmem data'
echo 'data.draw STACK'
echo 'total.label total'
echo 'total.info kmem total'
echo 'total.draw LINE'
echo 'max.label max'
echo 'max.info kmem max'
echo 'max.draw LINE2'
exit 0
fi
echo "text.value $TEXT"
echo "data.value $DATA"
echo "total.value $TOTAL"
echo "max.value $MAX"

View file

@ -0,0 +1,64 @@
#!/bin/sh
# Julien Francoz CoCoZ <julien@francoz.net>
# graph memory usage detail for a process using /proc/$PID/status
# create a link to this plugin with the syntax proc_yourprocessname_status
# example : proc_master_status pour postfix master process
cmd=`basename "$0"`
process=`echo "$cmd"| cut -d'_' -f 2`
pid=`pgrep -o -x "$process"`
#echo $pid
if [ "$1" = "autoconf" ]; then
if [ -r /proc/$pid/status ]; then
echo yes
exit 0
else
echo no
exit 1
fi
fi
if [ "$1" = "config" ]; then
echo "graph_title Memory usage for process $process"
echo "graph_order VmExe VmLib VmStk VmData VmRSS VmSize"
echo 'graph_vlabel Ko'
echo 'graph_scale no'
echo "graph_info This graph display memory usage for a process"
echo 'graph_category processes'
echo 'graph_period second'
echo 'VmExe.label VmExe'
echo 'VmExe.draw AREA'
echo "VmExe.info The size of the executable segment"
echo 'VmLib.label VmLib'
echo 'VmLib.draw STACK'
echo 'VmLib.info The size of the library code'
echo 'VmStk.label VmStk'
echo 'VmStk.draw STACK'
echo 'VmStk.info The stack size'
echo 'VmLck.label VmLck'
echo 'VmLck.draw STACK'
echo 'VmLck.info The amount of locked memory'
echo 'VmData.label VmData'
echo 'VmData.draw STACK'
echo 'VmData.info The size of the Data segment'
echo 'VmRSS.label VmRSS'
echo 'VmRSS.draw LINE2'
echo 'VmRSS.info The amount of memory mapped in RAM ( instead of swapped out)'
echo 'VmSize.label VmSize'
echo 'VmSize.draw LINE2'
echo 'VmSize.info The size of the virtual memory allocated to the process'
exit 0
fi
cat /proc/$pid/status |grep -E '^Vm' | sed -e 's/:/.value/' -e 's/\s\+kB$//' -e 's/\s\+/ /'