mirror of
https://github.com/munin-monitoring/contrib.git
synced 2018-11-08 00:59:34 +01:00
Merge pull request #464 from opendbteam/master
New plugin: memory usage by user
This commit is contained in:
commit
5dcb693a27
42
plugins/processes/proc_mem_by_user
Normal file
42
plugins/processes/proc_mem_by_user
Normal file
@ -0,0 +1,42 @@
|
|||||||
|
#!/bin/sh
|
||||||
|
#
|
||||||
|
# (c) 2014, Gilles Fauvie <gfauvie@opendbteam.com>
|
||||||
|
# Based on the 'du_multidirs' plugin, written by Christian Kujau <lists@nerdbynature.de>
|
||||||
|
#
|
||||||
|
# Configure it by using the processes env var, i.e.:
|
||||||
|
#
|
||||||
|
# WARNING: SELINUX can block this plugin
|
||||||
|
#
|
||||||
|
# [proc_mem_by_user]
|
||||||
|
# env.users munin-node jprod
|
||||||
|
#
|
||||||
|
|
||||||
|
. $MUNIN_LIBDIR/plugins/plugin.sh
|
||||||
|
|
||||||
|
if [ "$1" = "autoconf" ]; then
|
||||||
|
echo yes
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
users=${users:="munin-node"}
|
||||||
|
|
||||||
|
if [ "$1" = "config" ]; then
|
||||||
|
echo 'graph_title Memory usage by process by user'
|
||||||
|
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 of one user'
|
||||||
|
|
||||||
|
for user in $users; do
|
||||||
|
echo "$user.label $user"
|
||||||
|
done
|
||||||
|
|
||||||
|
# echo "$u".warning 0
|
||||||
|
# echo "$u".critical 0
|
||||||
|
|
||||||
|
exit 0
|
||||||
|
fi
|
||||||
|
|
||||||
|
for user in $users; do
|
||||||
|
echo "$user.value " `ps u -U $user | awk 'BEGIN { sum = 0 } NR > 1 { sum += $6 }; END { print sum * 1024 }'`
|
||||||
|
done
|
Loading…
Reference in New Issue
Block a user