From 4c2d99f8a6e901df92ce7a3f2592d2bf5c75ad82 Mon Sep 17 00:00:00 2001 From: "Joshua M. Boniface" Date: Thu, 23 Feb 2023 13:21:23 -0500 Subject: [PATCH] Fix bug with SMART info --- node-daemon/plugins/disk | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/node-daemon/plugins/disk b/node-daemon/plugins/disk index 77543162..cd1fac9d 100644 --- a/node-daemon/plugins/disk +++ b/node-daemon/plugins/disk @@ -129,7 +129,7 @@ class MonitoringPluginScript(MonitoringPlugin): continue if disk_type == 'nvme': - for attribute in smart_info['nvme_smart_health_information_log'].items(): + for attribute in smart_info.get('nvme_smart_health_information_log', {}).items(): if attribute[0] == "critical_warning" and attribute[1] > 0: health_delta += 10 messages.append(f"{disk} critical warning value {attribute[1]}") @@ -140,7 +140,7 @@ class MonitoringPluginScript(MonitoringPlugin): health_delta += 10 messages.append(f"{disk} percentage used value {attribute[1]}%") else: - for attribute in smart_info['ata_smart_attributes']['table']: + for attribute in smart_info.get('ata_smart_attributes', {}).get('table', []): if attribute["when_failed"]: health_delta += 10 messages.append(f"{disk} attribute {attribute['name']} value {attribute['raw']['value']}")