check-smart.rb doesn't use attribute accessor thus ignoring 'override'
sovaa opened this issue · comments
Oscar Eriksson commented
# Check for SMART cspability
#
def check_smart_capability!
output = `sudo #{@smart_binary} -i #{@device_path}`
@smart_available = !output.scan(/SMART support is:\s+Available/).empty?
@smart_enabled = !output.scan(/SMART support is:\s+Enabled/).empty?
@capability_output = output
end
# Check the SMART health
#
def check_health!
output = `sudo #{@smart_binary} -H #{@device_path}`
@smart_healthy = !output.scan(/PASSED|OK$/).empty?
@health_output = output
end
Both check_health
and check_smart_capability
accesses device_path
directly instead of the accessor:
def device_path
if @override_path.nil?
@device_path
else
@override_path
end
end
This causes the override_path
to be ignored for those two checks, resulting in the following output:
# /opt/sensu/embedded/bin/ruby //opt/sensu/embedded/bin/check-smart.rb -j /etc/sensu/conf.d/smart.json
CheckSMART UNKNOWN: No SMART capable devices found