From d61fef8ce6cc14f55aff89a5e210369d4363f810 Mon Sep 17 00:00:00 2001 From: Rene Treffer Date: Tue, 21 Mar 2017 10:47:27 +0100 Subject: [PATCH] Handle smart raw values >2^31 "%d" in awk will truncate values at 2^31. S.M.A.R.T. values can exceed that, thus use a floating point notation instead to encode larger values (at the possible cost of some precision). --- text_collector_examples/smartmon.sh | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/text_collector_examples/smartmon.sh b/text_collector_examples/smartmon.sh index 3ba9e3bd..ed50c87c 100755 --- a/text_collector_examples/smartmon.sh +++ b/text_collector_examples/smartmon.sh @@ -15,7 +15,7 @@ $1 ~ /^[0-9]+$/ && $2 ~ /^[a-zA-Z0-9_-]+$/ { printf "%s_value{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $4 printf "%s_worst{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $5 printf "%s_threshold{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $6 - printf "%s_raw_value{%s,smart_id=\"%s\"} %d\n", $2, labels, $1, $10 + printf "%s_raw_value{%s,smart_id=\"%s\"} %e\n", $2, labels, $1, $10 } SMARTCTLAWK )"