diff --git a/CHANGELOG.md b/CHANGELOG.md index c9c884a2307c870facd096918df3ae1aac4fedc2..3ab96fb6db45775b7cd3994909001d842cee8983 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.2.4] - 2022-06-07 +### Added +- gpumon: GPU_DEVICES_UNRECOGNIZED detection reworked without grep, with gawk, avoiding crash + ## [1.2.3] - 2022-06-07 ### Added - gpumon: publish at least a metric help (metric-generator-exec requirement) diff --git a/src/metric-generators/gpumon.sh b/src/metric-generators/gpumon.sh index 2cfffaedfa56df35c1989e441c6f47340945f453..1c37b76b3f9138c16e55e03fd4e8305ab4337ddb 100755 --- a/src/metric-generators/gpumon.sh +++ b/src/metric-generators/gpumon.sh @@ -47,8 +47,8 @@ function find_gpu_passthough_vm_manifest () { # gather all GPU cards (assure device model name is detected) STAGE_NAME="GPU cards successfully detected" GPU_DEVICES="$(get_gpu_devices)" -GPU_DEVICES_UNRECOGNIZED="$(echo "${GPU_DEVICES}" | gawk 'BEGIN{FPAT = "(\"[^\"]+\")"}{print $3}' | \ - sort -u | tr -d '"' | grep -Ev '.+[ \t]\[.+\]')" +GPU_DEVICES_UNRECOGNIZED="$(echo "${GPU_DEVICES}" | \ + gawk 'BEGIN{FPAT = "(\"[^\"]+\")"}{if (!($3 ~ /.+[ \t]\[.+\]/)) {print $3}}')" if [ -n "${GPU_DEVICES_UNRECOGNIZED}" ]; then # reload GPU devices and resolve proper device names with internet PCI id database GPU_DEVICES="$(get_gpu_devices -q)"