From f039320fb1cb5cb1e6c2fc304f6a4f1718c0ab97 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Franti=C5=A1ek=20=C5=98ezn=C3=AD=C4=8Dek?= <246254@mail.muni.cz> Date: Tue, 7 Jun 2022 17:31:45 +0200 Subject: [PATCH] fix: gpumon generates at least a metric help (metric-generator-exec.sh requirement) --- CHANGELOG.md | 5 +++++ src/metric-generator-exec.sh | 4 ++++ src/metric-generators/gpumon.sh | 7 ++++--- 3 files changed, 13 insertions(+), 3 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 8c0fecb..c9c884a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] +## [1.2.3] - 2022-06-07 +### Added +- gpumon: publish at least a metric help (metric-generator-exec requirement) +- metric-generator-exec.sh: added note on how should generator module behave + ## [1.2.2] - 2022-06-07 ### Added - gpumon: avoid crashing on no GPU (readlink) diff --git a/src/metric-generator-exec.sh b/src/metric-generator-exec.sh index 5efe11a..3adea22 100755 --- a/src/metric-generator-exec.sh +++ b/src/metric-generator-exec.sh @@ -9,6 +9,10 @@ # * <metrics-generator-output-textfile-metric-file> generated by the <metric-generator-module-name> # * <runner-output-textfile-metric-file> generated by this runner (measuring <metric-generator-module-name> is successfully executed) # +# Requirements: +# 1. CMG module has to exit with ecode of 0 +# 2. CMG module has to produce metrics on stdout (empty stdout is also invalid, generate at least metric help comments) +# # Examples: # # launch `smartmon` metric generator module # $ metric-generator-exec.sh smartmon /tmp/smartmon.prom /tmp/cmg-smartmon.prom diff --git a/src/metric-generators/gpumon.sh b/src/metric-generators/gpumon.sh index c2c8549..2cfffae 100755 --- a/src/metric-generators/gpumon.sh +++ b/src/metric-generators/gpumon.sh @@ -56,12 +56,13 @@ fi # browse the GPUs and export metrics METRIC_NAME="gpumon_device_state_code" -STAGE_NAME="GPU devices ${METRIC_NAME} metrics generated" +STAGE_NAME="GPU devices ${METRIC_NAME} metric[s] documentation generated" +get_metric_help "${METRIC_NAME}" "gauge" "GPU device state code (0/1 ~ available free/unavailable used)." +STAGE_NAME="GPU devices ${METRIC_NAME} metric[s] time-series generated" if [ -n "${GPU_DEVICES}" ]; then - get_metric_help "${METRIC_NAME}" "gauge" "GPU device state code (0/1 ~ available free/unavailable used)." echo "${GPU_DEVICES}" | \ while read i_gpu_device ; do - STAGE_NAME="GPU device ${METRIC_NAME} metrics generated (${i_gpu_device})" + STAGE_NAME="GPU device ${METRIC_NAME} metric time-series generated (${i_gpu_device})" [ -z "${i_gpu_device}" ] && \ continue i_gpu_device_location="$(echo "${i_gpu_device}" | awk '{printf $1}')" -- GitLab