Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Error running check-smart-status.rb - undefined method `name' for #<Disk:0x0000000253d8b8> #89

Open
vadim6 opened this issue Dec 31, 2017 · 3 comments

Comments

@vadim6
Copy link

vadim6 commented Dec 31, 2017

I'm using v2.5.1 of check-smart-status.rb, when running it with the example json it's failing in line 219.

sudo ./check-smart-status.rb -j ~/smart.json Check failed to run: undefined method name' for #Disk:0x0000000253d8b8, ["/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-disk-checks-2.5.1/bin/check-smart-status.rb:219:in block in run'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-disk-checks-2.5.1/bin/check-smart-status.rb:206:in each'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugins-disk-checks-2.5.1/bin/check-smart-status.rb:206:in run'", "/opt/sensu/embedded/lib/ruby/gems/2.3.0/gems/sensu-plugin-1.3.0/lib/sensu-plugin/cli.rb:57:in block in class:CLI'"]`

I've found that changing #{dev.name} to #{dev.device_path} does the trick in line 219:
criticals << "Overall health check failed on #{dev.name}"

Not sure if it's only something on my system or not though...

@vadim6 vadim6 changed the title Error running check-smart-status.rb Error running check-smart-status.rb - undefined method `name' for #<Disk:0x0000000253d8b8> Dec 31, 2017
@majormoses
Copy link
Member

Can you please include an exmaple of what smart.json should look like so I can do some testing?

@majormoses
Copy link
Member

Sounds good can you create a PR to fix it?

@AMD1212
Copy link

AMD1212 commented Jan 8, 2020

I am getting the same error on three of my servers.
The workaround of vadim6 does not seem to work anymore.

Check failed to run: undefined method name' for #<Disk:0x0000564789ecbcc0>, ["/usr/lib/nagios/plugins/check-smart-status.rb:220:in block in run'", "/usr/lib/nagios/plugins/check-smart-status.rb:207:in each'", "/usr/lib/nagios/plugins/check-smart-status.rb:207:in run'", "/var/lib/gems/2.5.0/gems/sensu-plugin-4.0.0/lib/sensu-plugin/cli.rb:59:in `block in class:CLI'"]

smart.json is attached
smart.json.txt

The servers are all HP ProLiant SE316M1 all using an LSI Logic / Symbios Logic SAS2008 PCI-Express Fusion-MPT SAS-2 [Falcon] Raid Controller (all Disks in JBOD Mode).

I can run smartctl -a on all disks configured in smart.json without a problem.
The Poblem also exists if i write only one disk into the json (of course the disk-id changes).

Attached is also the whole output of a smartctl -a on /dev/sda:
smartctl-sda.txt

If I can provide any more information that could help to solve the problem, just let me know.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants