From cd8816aa8215949bc4d4e9c63a900d41399161d4 Mon Sep 17 00:00:00 2001 From: Simon Murray Date: Thu, 7 Jan 2016 13:23:03 +0000 Subject: [PATCH] Make Off-line Collection More Tolerant It is not uncommon for offline data collection to be aborted, or on devices that do not have such checks never started. This removes the logic that bombs out returning WARNING or UNKNOWN and just echos the status to the output. Also corrects a formatting problem which didn't take into account the longest output text --- check_scsi_smart.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/check_scsi_smart.c b/check_scsi_smart.c index 037564a..52e7ca9 100644 --- a/check_scsi_smart.c +++ b/check_scsi_smart.c @@ -512,21 +512,18 @@ int main(int argc, char** argv) { ata_smart_read_data(fd, (unsigned char*)&sd); if((sd.offline_data_collection_status & 0x7f) == SMART_OFF_LINE_STATUS_NEVER_STARTED) { - printf("UNKNOWN: Off-line data collection never started\n"); - exit(NAGIOS_UNKNOWN); + printf("Off-line data collection: never started\n"); } if((sd.offline_data_collection_status & 0x7f) == SMART_OFF_LINE_STATUS_SUSPENDED || (sd.offline_data_collection_status & 0x7f) == SMART_OFF_LINE_STATUS_ABORTED_HOST || (sd.offline_data_collection_status & 0x7f) == SMART_OFF_LINE_STATUS_ABORTED_DEVICE) { - printf("WARNING: Off-line data collection suspended/aborted\n"); - exit(NAGIOS_WARNING); + printf("Off-line data collection: suspended/aborted\n"); } if((sd.offline_data_collection_status & 0x7f) != SMART_OFF_LINE_STATUS_COMPLETED && (sd.offline_data_collection_status & 0x7f) != SMART_OFF_LINE_STATUS_IN_PROGRESS) { - printf("UNKNOWN: Off-line data collection in unknown state\n"); - exit(NAGIOS_UNKNOWN); + printf("Off-line data collection: unknown state\n"); } /* Perform actual SMART threshold checks */ @@ -535,7 +532,7 @@ int main(int argc, char** argv) { smart_thresholds st; ata_smart_read_thresholds(fd, (unsigned char*)&st); - printf("ID Name Value Worst Thresh Type Updated Raw Status\n"); + printf("ID Name Value Worst Thresh Type Updated Raw Status\n"); int i=0; for(; i