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

check-smart.rb in 2.4.1 doesn't work #82

Closed piotrkotowski closed 7 years ago

piotrkotowski commented 7 years ago

Hi, I have a check-smart.rb which works on my machine with gem in version 2.1.0:

sensu@xxx:~/embedded/bin$ sudo /opt/sensu/embedded/bin/check-smart.rb
CheckSMART OK: PASSED

Unfortunately, with latest 2.4.1 it doesn't:

sensu@xxx:~/embedded/bin$ sudo /opt/sensu/embedded/bin/check-smart.rb
Check failed to run: No such file or directory @ rb_sysopen - /opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-disk-checks-2.4.1/bin/smart.json, ["/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-disk-checks-2.4.1/bin/check-smart.rb:126:in `read'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-disk-checks-2.4.1/bin/check-smart.rb:126:in `initialize'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.4.2/lib/sensu-plugin/cli.rb:57:in `new'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.4.2/lib/sensu-plugin/cli.rb:57:in `block in <class:CLI>'"]

OS is Ubuntu 16.04.3 LTS, smartmontools in version 6.4+svn4214-1. The output from smartctl -a :

smartctl 6.5 2016-01-24 r4214 [x86_64-linux-4.4.0-92-generic] (local build)
Copyright (C) 2002-16, Bruce Allen, Christian Franke, www.smartmontools.org

=== START OF INFORMATION SECTION ===
Model Family:     Hitachi/HGST Ultrastar 7K4000
Device Model:     HGST HUS724020ALA640
Serial Number:    PN1134P6HGTMNN
LU WWN Device Id: 5 000cca 22dd4d12c
Firmware Version: MF6OABY0
User Capacity:    2,000,398,934,016 bytes [2,00 TB]
Sector Size:      512 bytes logical/physical
Rotation Rate:    7200 rpm
Form Factor:      3.5 inches
Device is:        In smartctl database [for details use: -P show]
ATA Version is:   ATA8-ACS T13/1699-D revision 4
SATA Version is:  SATA 3.0, 6.0 Gb/s (current: 3.0 Gb/s)
Local Time is:    Thu Aug 17 12:50:27 2017 CEST
SMART support is: Available - device has SMART capability.
SMART support is: Enabled

=== START OF READ SMART DATA SECTION ===
SMART overall-health self-assessment test result: PASSED

General SMART Values:
Offline data collection status:  (0x80) Offline data collection activity
                    was never started.
                    Auto Offline Data Collection: Enabled.
Self-test execution status:      (   0) The previous self-test routine completed
                    without error or no self-test has ever
                    been run.
Total time to complete Offline
data collection:        (   24) seconds.
Offline data collection
capabilities:            (0x5b) SMART execute Offline immediate.
                    Auto Offline data collection on/off support.
                    Suspend Offline collection upon new
                    command.
                    Offline surface scan supported.
                    Self-test supported.
                    No Conveyance Self-test supported.
                    Selective Self-test supported.
SMART capabilities:            (0x0003) Saves SMART data before entering
                    power-saving mode.
                    Supports SMART auto save timer.
Error logging capability:        (0x01) Error logging supported.
                    General Purpose Logging supported.
Short self-test routine
recommended polling time:    (   1) minutes.
Extended self-test routine
recommended polling time:    ( 314) minutes.
SCT capabilities:          (0x003d) SCT Status supported.
                    SCT Error Recovery Control supported.
                    SCT Feature Control supported.
                    SCT Data Table supported.

SMART Attributes Data Structure revision number: 16
Vendor Specific SMART Attributes with Thresholds:
ID# ATTRIBUTE_NAME          FLAG     VALUE WORST THRESH TYPE      UPDATED  WHEN_FAILED RAW_VALUE
  1 Raw_Read_Error_Rate     0x000b   100   100   016    Pre-fail  Always       -       0
  2 Throughput_Performance  0x0005   136   136   054    Pre-fail  Offline      -       83
  3 Spin_Up_Time            0x0007   132   132   024    Pre-fail  Always       -       476 (Average 467)
  4 Start_Stop_Count        0x0012   100   100   000    Old_age   Always       -       36
  5 Reallocated_Sector_Ct   0x0033   100   100   005    Pre-fail  Always       -       0
  7 Seek_Error_Rate         0x000b   100   100   067    Pre-fail  Always       -       0
  8 Seek_Time_Performance   0x0005   140   140   020    Pre-fail  Offline      -       26
  9 Power_On_Hours          0x0012   097   097   000    Old_age   Always       -       27502
 10 Spin_Retry_Count        0x0013   100   100   060    Pre-fail  Always       -       0
 12 Power_Cycle_Count       0x0032   100   100   000    Old_age   Always       -       36
192 Power-Off_Retract_Count 0x0032   100   100   000    Old_age   Always       -       78
193 Load_Cycle_Count        0x0012   100   100   000    Old_age   Always       -       78
194 Temperature_Celsius     0x0002   153   153   000    Old_age   Always       -       39 (Min/Max 18/50)
196 Reallocated_Event_Count 0x0032   100   100   000    Old_age   Always       -       0
197 Current_Pending_Sector  0x0022   100   100   000    Old_age   Always       -       0
198 Offline_Uncorrectable   0x0008   100   100   000    Old_age   Offline      -       0
199 UDMA_CRC_Error_Count    0x000a   200   200   000    Old_age   Always       -       0

SMART Error Log Version: 1
No Errors Logged

SMART Self-test log structure revision number 1
Num  Test_Description    Status                  Remaining  LifeTime(hours)  LBA_of_first_error
# 1  Short offline       Completed without error       00%     27498         -
# 2  Short offline       Completed without error       00%     27495         -
# 3  Short offline       Completed without error       00%     27495         -
# 4  Short offline       Completed without error       00%     26534         -
# 5  Short offline       Completed without error       00%     26531         -
# 6  Short offline       Completed without error       00%     26531         -
# 7  Short offline       Completed without error       00%     26518         -
# 8  Short offline       Completed without error       00%     26510         -
# 9  Short offline       Completed without error       00%     26510         -
#10  Short offline       Completed without error       00%     26470         -
#11  Short offline       Completed without error       00%     26462         -

SMART Selective self-test log data structure revision number 1
 SPAN  MIN_LBA  MAX_LBA  CURRENT_TEST_STATUS
    1        0        0  Not_testing
    2        0        0  Not_testing
    3        0        0  Not_testing
    4        0        0  Not_testing
    5        0        0  Not_testing
Selective self-test flags (0x0):
  After scanning selected spans, do NOT read-scan remainder of disk.
If Selective self-test is pending on power-up, resume after 0 minute delay.

Pls let me know if you need more information to proceed.

Thank you very much for help!

majormoses commented 7 years ago

I think this is fixed in #87 I will be released in: https://rubygems.org/gems/sensu-plugins-disk-checks/versions/2.5.0 in a couple of minutes can you confirm that with the new version it solves your problem (json file not existing). If you are still having issues I will attempt to replicate.

piotrkotowski commented 7 years ago

You are right, with 2.5.0 it works flawlessly 👍

Thank you!