mirror of
https://github.com/munin-monitoring/muninlite.git
synced 2025-01-03 11:42:10 +01:00
Plugin cpu: fix handling of more than ten CPUs
Previously only CPU entries with a single digit (0..9) were parsed. The improved regular expression simplifies the calculation of the CPU count, since the combined entry ("cpu" without digits) is skipped.
This commit is contained in:
parent
14251d6791
commit
dc242d3631
1 changed files with 2 additions and 2 deletions
|
@ -3,8 +3,8 @@ config_cpu() {
|
|||
if grep '^cpu \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\} \{1,\}[0-9]\{1,\}' /proc/stat >/dev/null 2>&1; then
|
||||
extinfo="iowait irq softirq"
|
||||
fi
|
||||
NCPU=$(($(grep '^cpu. ' /proc/stat | wc -l) - 1))
|
||||
if [ $NCPU = 0 ]; then NCPU=1; fi
|
||||
# shellcheck disable=SC2126
|
||||
NCPU=$(grep '^cpu[0-9]\+ ' /proc/stat | wc -l)
|
||||
PERCENT=$(($NCPU * 100))
|
||||
graphlimit=$PERCENT
|
||||
SYSWARNING=$(($PERCENT * 30 / 100))
|
||||
|
|
Loading…
Reference in a new issue