From d824c7696f510011dc6524002d8455133fb99b90 Mon Sep 17 00:00:00 2001 From: pascal Date: Mon, 10 Mar 2014 18:34:49 +0100 Subject: [PATCH] p/cpubyuser: get stats from top instead of ps The top cpu statistics fit better to the other cpu statistics in munin. The ps based statistics are calculated as average over the runtime of a program, which does not neccessarily reflect the current situation. --- plugins/system/cpubyuser | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/plugins/system/cpubyuser b/plugins/system/cpubyuser index b56859c5..424bc2cf 100755 --- a/plugins/system/cpubyuser +++ b/plugins/system/cpubyuser @@ -70,9 +70,9 @@ if [ "$1" = "config" ]; then exit fi -ps -e -o "%C%U" | \ +top -b -n 1 | tail -n +8 | \ awk -v USERS="$USERS" ' - { if ($2 != "USER") CPU_USER[$2]+=$1 } + { if ($2 != "USER") CPU_USER[$2]+=$9 } END { others_sum = 0 for (user in CPU_USER) {