mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-09-14 22:58:40 +00:00
ALL keyword
Add ALL keyword to count cpu use of all users. May be a dirty hack, but not sure how to do this otherwise...
This commit is contained in:
parent
7f94d4d68e
commit
19ca132a46
1 changed files with 6 additions and 0 deletions
|
@ -7,6 +7,8 @@
|
||||||
# [cpubyuser]
|
# [cpubyuser]
|
||||||
# env.USERS root yann
|
# env.USERS root yann
|
||||||
#
|
#
|
||||||
|
# If env.USERS is set to ALL, count all logged in users.
|
||||||
|
#
|
||||||
# root and yann being a list of the users to monitor.
|
# root and yann being a list of the users to monitor.
|
||||||
# You need to also make sure that awk is installed
|
# You need to also make sure that awk is installed
|
||||||
#
|
#
|
||||||
|
@ -70,6 +72,10 @@ if [ "$1" = "config" ]; then
|
||||||
exit
|
exit
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
if [ "$USERS" = "ALL" ]; then
|
||||||
|
USERS=$( w | awk '{ print $1 }' )
|
||||||
|
fi
|
||||||
|
|
||||||
top -b -n 1 | tail -n +8 | \
|
top -b -n 1 | tail -n +8 | \
|
||||||
awk -v USERS="$USERS" '
|
awk -v USERS="$USERS" '
|
||||||
{ if ($2 != "USER") CPU_USER[$2]+=$9 }
|
{ if ($2 != "USER") CPU_USER[$2]+=$9 }
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue