diff options
author | Austin S. Hemmelgarn <austin@netdata.cloud> | 2020-04-21 21:08:46 -0400 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-04-22 11:08:46 +1000 |
commit | 95b60b8a900557b3ea9801aefb9f3331ff97760e (patch) | |
tree | 09573f768adf10bc8ef3d793593c62e3545c5a76 /daemon | |
parent | f670e6285d36ad4daf22b9e81af5a7d2a3b2ad80 (diff) |
Fixed issue in `system-info.sh`regarding the parsing of `lscpu` output. (#8754)
* Fix parsing issue in system-info.sh.
Depending on the exact hardware it's run on, `lscpu` may or may not
report a maximum and/or minimum CPU frequency. We want to preferentially
match on the maximum if it's there because the regular CPU frequency
entry from `lscpu` shows the _current_ frequency most of the time, and
we want to report the 'intended' frequency for the CPU.
* Fix the check to see if we found a CPU frequency value.
* Actually fix parsing.
Diffstat (limited to 'daemon')
-rwxr-xr-x | daemon/system-info.sh | 3 |
1 files changed, 3 insertions, 0 deletions
diff --git a/daemon/system-info.sh b/daemon/system-info.sh index 110b4b3129..9b40715054 100755 --- a/daemon/system-info.sh +++ b/daemon/system-info.sh @@ -192,6 +192,9 @@ if [ -n "${lscpu}" ] && lscpu >/dev/null 2>&1 ; then CPU_VENDOR="$(echo "${lscpu_output}" | grep "^Vendor ID:" | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" CPU_MODEL="$(echo "${lscpu_output}" | grep "^Model name:" | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')" possible_cpu_freq="$(echo "${lscpu_output}" | grep -F "CPU max MHz:" | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | grep -o '^[0-9]*') MHz" + if [ "${possible_cpu_freq}" = " MHz" ] ; then + possible_cpu_freq="$(echo "${lscpu_output}" | grep -F "CPU MHz:" | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//' | grep -o '^[0-9]*') MHz" + fi elif [ -n "${dmidecode}" ] && dmidecode -t processor >/dev/null 2>&1 ; then dmidecode_output="$(${dmidecode} -t processor 2>/dev/null)" CPU_INFO_SOURCE="dmidecode" |