2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00
contrib-munin/plugins/memory/proc_mem

41 lines
999 B
Plaintext
Raw Normal View History

2010-05-09 23:02:06 +02:00
#!/bin/sh
#
# (c) 2010, Rodrigo Sieiro <rsieiro@gmail.com>
# Based on the 'du_multidirs' plugin, written by Christian Kujau <lists@nerdbynature.de>
#
# 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'
2010-05-09 23:02:06 +02:00
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