bundles/smartd: ignore non-digit values in telegraf stats

This commit is contained in:
Franzi 2023-07-13 21:41:52 +02:00
parent 471e2ba6f6
commit e9ee2039d5
Signed by: kunsi
GPG key ID: 12E3D2136B818350

View file

@ -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'],