mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-22 02:51:03 +00:00
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.
This commit is contained in:
parent
ff1c67d59c
commit
d824c7696f
1 changed files with 2 additions and 2 deletions
|
@ -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) {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue