@cryptotaxi247 / netdata-1 / commits / 95b60b8a9

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.

Austin S. Hemmelgarn committed Apr 21, 2020 at 21:08 UTC 95b60b8a900557b3ea9801aefb9f3331ff97760e
1 file changed +3
daemon/system-info.sh
+3
@@ -192,6 +192,9 @@ if [ -n "${lscpu}" ] && lscpu >/dev/null 2>&1 ; then
192 CPU_VENDOR="$(echo "${lscpu_output}" | grep "^Vendor ID:" | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
193 CPU_MODEL="$(echo "${lscpu_output}" | grep "^Model name:" | cut -f 2 -d ':' | sed -e 's/^[[:space:]]*//' -e 's/[[:space:]]*$//')"
194 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"
195 + if [ "${possible_cpu_freq}" = " MHz" ] ; then
196 + 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"
197 + fi
198 elif [ -n "${dmidecode}" ] && dmidecode -t processor >/dev/null 2>&1 ; then
199 dmidecode_output="$(${dmidecode} -t processor 2>/dev/null)"
200 CPU_INFO_SOURCE="dmidecode"