sensu-plugins / sensu-plugins-disk-checks

This plugin provides native disk instrumentation for monitoring and metrics collection, including: health, usage, and various metrics.
http://sensu-plugins.io
MIT License
27 stars 63 forks source link

Fix for ignored SMART parameters #162

Closed VeselaHouba closed 3 years ago

VeselaHouba commented 4 years ago

Pull Request Checklist

Is this in reference to an existing issue? No, was too lazy to open issue and instead created PR

General

New Plugins

Purpose

check-smart-status.rb - Check was ignoring all parameters, when ignore was not defined. before:

bin/check-smart-status.rb --json /etc/sensu/conf.d/smart.json
SmartCheckStatus OK: All device operating properly

after:

bin/check-smart-status.rb --json /etc/sensu/conf.d/smart.json
SmartCheckStatus CRITICAL: #<Disk:0x0000561460428e28> critical 9 Power_On_Hours: 32813
#<Disk:0x0000561460428248> critical 5 Reallocated_Sector_Ct: 38648
#<Disk:0x0000561460428248> critical 9 Power_On_Hours: 34045
#<Disk:0x0000561460428248> critical 196 Reallocated_Event_Count: 4806
#<Disk:0x0000561460428248> critical 197 Current_Pending_Sector: 640
#<Disk:0x0000561460428248> critical 199 UDMA_CRC_Error_Count: 13
#<Disk:0x0000561460427730> critical 9 Power_On_Hours: 33277
#<Disk:0x0000561460426c40> critical 9 Power_On_Hours: 35113
#<Disk:0x0000561460426c40> critical 199 UDMA_CRC_Error_Count: 2
#<Disk:0x0000561460428e28> warning 194 Temperature_Celsius: 44
#<Disk:0x0000561460427730> warning 194 Temperature_Celsius: 42

smart.json

{
  "smart": {
    "attributes": [
      { "id": 1, "name": "Raw_read_Error_Rate", "read": "left16bit" },
      { "id": 5, "name": "Reallocated_Sector_Ct" },
      { "id": 9, "name": "Power_On_Hours", "read": "right16bit", "warn_max": 10000, "crit_max": 15000 },
      { "id": 10 , "name": "Spin_Retry_Count" },
      { "id": 184, "name": "End-to-End_Error" },
      { "id": 187, "name": "Reported_Uncorrect" },
      { "id": 188, "name": "Command_Timeout" },
      { "id": 193, "name": "Load_Cycle_Count", "warn_max": 300000, "crit_max": 600000 },
      { "id": 194, "name": "Temperature_Celsius", "read": "right16bit", "crit_min": 20, "warn_min": 10, "warn_max": 40, "crit_max": 50 },
      { "id": 196, "name": "Reallocated_Event_Count" },
      { "id": 197, "name": "Current_Pending_Sector" },
      { "id": 198, "name": "Offline_Uncorrectable" },
      { "id": 199, "name": "UDMA_CRC_Error_Count" },
      { "id": 201, "name": "Unc_Soft_read_Err_Rate", "read": "left16bit" },
      { "id": 230, "name": "Life_Curve_Status", "crit_min": 100, "warn_min": 100, "warn_max": 100, "crit_max": 100 }
    ]
  },
  "hardware": {
    "devices": []
  }
}

Known Compatibility Issues