From 19ca132a4688ff921766a8ff9e18c746c76faa36 Mon Sep 17 00:00:00 2001 From: rkarlsba Date: Fri, 28 Aug 2015 12:07:04 +0200 Subject: [PATCH] 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... --- plugins/system/cpubyuser | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/plugins/system/cpubyuser b/plugins/system/cpubyuser index 424bc2cf..c2522233 100755 --- a/plugins/system/cpubyuser +++ b/plugins/system/cpubyuser @@ -7,6 +7,8 @@ # [cpubyuser] # 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. # You need to also make sure that awk is installed # @@ -70,6 +72,10 @@ if [ "$1" = "config" ]; then exit fi +if [ "$USERS" = "ALL" ]; then + USERS=$( w | awk '{ print $1 }' ) +fi + top -b -n 1 | tail -n +8 | \ awk -v USERS="$USERS" ' { if ($2 != "USER") CPU_USER[$2]+=$9 }