From 4b21d5819537416c7f88965036abc7fc7425a422 Mon Sep 17 00:00:00 2001 From: Lars Kruse Date: Sat, 22 Oct 2016 03:50:32 +0200 Subject: [PATCH] [cpubyuser] expand magic 'ALL' user before config --- plugins/system/cpubyuser | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/plugins/system/cpubyuser b/plugins/system/cpubyuser index 04dc2c2f..39469981 100755 --- a/plugins/system/cpubyuser +++ b/plugins/system/cpubyuser @@ -39,6 +39,9 @@ . "$MUNIN_LIBDIR/plugins/plugin.sh" +[ "$USERS" = "ALL" ] && USERS=$(w --no-header | awk '{ print $1 }' | sort | uniq) + + if [ "$1" = "autoconf" ]; then if [ -n "$USERS" ]; then echo "yes" @@ -68,10 +71,6 @@ 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 }