From 7171ec327ec5b9aeba4f6f366f4b80c5432b1e3e Mon Sep 17 00:00:00 2001 From: Rodrigo Sieiro Date: Sun, 9 May 2010 23:02:06 +0200 Subject: [PATCH] Initial version --- plugins/other/proc_mem | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) create mode 100755 plugins/other/proc_mem diff --git a/plugins/other/proc_mem b/plugins/other/proc_mem new file mode 100755 index 00000000..899d4b69 --- /dev/null +++ b/plugins/other/proc_mem @@ -0,0 +1,40 @@ +#!/bin/sh +# +# (c) 2010, Rodrigo Sieiro +# Based on the 'du_multidirs' plugin, written by Christian Kujau +# +# Configure it by using the processes env var, i.e.: +# +# [proc_mem] +# env.processes munin-node apache2 +# + +. $MUNIN_LIBDIR/plugins/plugin.sh + +if [ "$1" = "autoconf" ]; then + echo yes + exit 0 +fi + +processes=${processes:="munin-node"} + +if [ "$1" = "config" ]; then + echo 'graph_title Memory usage by process' + echo 'graph_args --base 1024 -l 0' + echo 'graph_vlabel Bytes' + echo 'graph_category processes' + echo 'graph_info This graph shows the memory usage of several processes' + + for proc in $processes; do + echo "$proc.label $proc" + done + +# echo "$u".warning 0 +# echo "$u".critical 0 + + exit 0 +fi + +for proc in $processes; do + echo "$proc.value " `ps u -C $proc | awk 'BEGIN { sum = 0 } NR > 1 { sum += $6 }; END { print sum * 1024 }'` +done