From 81c76f7807bd57b51f55da563e92952c9dac6dbb Mon Sep 17 00:00:00 2001 From: ale <ale@incal.net> Date: Wed, 15 Jan 2025 16:40:48 +0000 Subject: [PATCH] Ignore SMART test statuses that aren't complete yet Prevent alerting when SMART tests haven't run yet. --- roles/float-base/files/node-exporter-scripts/smartmon.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/roles/float-base/files/node-exporter-scripts/smartmon.py b/roles/float-base/files/node-exporter-scripts/smartmon.py index 7cfb6c1f..ebd3299b 100644 --- a/roles/float-base/files/node-exporter-scripts/smartmon.py +++ b/roles/float-base/files/node-exporter-scripts/smartmon.py @@ -221,6 +221,9 @@ def collect_self_test_status(device, data): (test['lifetime_hours'] > most_recent_test_by_type[key]['lifetime_hours']): most_recent_test_by_type[key] = test for test in most_recent_test_by_type.values(): + if 'passed' not in test['status']: + # Possibly still ongoing. + continue labels = {'test': to_label_value(test['type']['string'])} labels.update(device.labels) yield Gauge('self_test_status', labels, test['status']['passed']) -- GitLab