From e9ee2039d5b64e2ce3e912a9adfa13db25113a13 Mon Sep 17 00:00:00 2001 From: Franziska Kunsmann Date: Thu, 13 Jul 2023 21:41:52 +0200 Subject: [PATCH] bundles/smartd: ignore non-digit values in telegraf stats --- bundles/smartd/files/telegraf_plugin | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/bundles/smartd/files/telegraf_plugin b/bundles/smartd/files/telegraf_plugin index 5bd10f2..46144bf 100644 --- a/bundles/smartd/files/telegraf_plugin +++ b/bundles/smartd/files/telegraf_plugin @@ -29,10 +29,16 @@ for device in devices: if 'nvme_smart_health_information_log' in json: for k, v in json['nvme_smart_health_information_log'].items(): + if not str(v).isdigit(): + continue + telegraf_output.add(f'{k}={v}') if 'ata_smart_attributes' in json: for entry in json['ata_smart_attributes']['table']: + if not str(entry['raw']['value']).isdigit(): + continue + telegraf_output.add('{}={}'.format( entry['name'], entry['raw']['value'],