Closed sovaa closed 7 years ago
With fix:
[root@host ~]# grep -nA14 "def check_smart_capability" check-smart.rb
79: def check_smart_capability!
80- output = `sudo #{@smart_binary} -i #{device_path}`
81- @smart_available = !output.scan(/SMART support is:\s+Available/).empty?
82- @smart_enabled = !output.scan(/SMART support is:\s+Enabled/).empty?
83- @capability_output = output
84- end
85-
86- # Check the SMART health
87- #
88- def check_health!
89- output = `sudo #{@smart_binary} -H #{device_path}`
90- @smart_healthy = !output.scan(/PASSED|OK$/).empty?
91- @health_output = output
92- end
93-end
[root@host ~]# grep override smart.json
{ "path": "sda", "override": "/dev/sda -d sat+megaraid,0" }
[root@host ~]# /opt/sensu/embedded/bin/ruby ./check-smart.rb -j smart.json
CheckSMART OK: PASSED
Without fix:
[root@host ~]# grep -nA14 "def check_smart_capability" check-smart.rb
79: def check_smart_capability!
80- output = `sudo #{@smart_binary} -i #{@device_path}`
81- @smart_available = !output.scan(/SMART support is:\s+Available/).empty?
82- @smart_enabled = !output.scan(/SMART support is:\s+Enabled/).empty?
83- @capability_output = output
84- end
85-
86- # Check the SMART health
87- #
88- def check_health!
89- output = `sudo #{@smart_binary} -H #{@device_path}`
90- @smart_healthy = !output.scan(/PASSED|OK$/).empty?
91- @health_output = output
92- end
93-end
[root@host ~]# grep override smart.json
{ "path": "sda", "override": "/dev/sda -d sat+megaraid,0" }
[root@host ~]# /opt/sensu/embedded/bin/ruby ./check-smart.rb -j smart.json
CheckSMART UNKNOWN: smartctl 6.2 2013-07-26 r3841 [x86_64-linux-3.10.0-514.6.2.el7.x86_64] (local build)
Copyright (C) 2002-13, Bruce Allen, Christian Franke, www.smartmontools.org
Smartctl open device: /dev/sda failed: DELL or MegaRaid controller, please try adding '-d megaraid,N'
Pull Request Checklist
Is this in reference to an existing issue?
General
[ ] Update Changelog following the conventions laid out on Keep A Changelog
[ ] Update README with any necessary configuration snippets
[ ] Binstubs are created if needed
[ ] RuboCop passes
[ ] Existing tests pass
New Plugins
[ ] Tests
[ ] Add the plugin to the README
[ ] Does it have a complete header as outlined here
Purpose
Known Compatibility Issues