bin/check-varnish-status.rb in sensu-plugins-varnish-1.0.0 vs bin/check-varnish-status.rb in sensu-plugins-varnish-1.1.0

- old
+ new

@@ -74,11 +74,13 @@ default: 6082 ) # Main Function def run - unknown 'varnishadm is not installed!' unless `which varnishadm 2>/dev/null`.to_s.include? 'varnish' - command = `sudo varnishadm -T #{config[:host]}:#{config[:port]} -S #{config[:secret]} -t #{config[:timeout]} #{config[:command]}` + # Keep a full reference for the varnish binary so sudo uses a full path + varnishadm = `which varnishadm 2>/dev/null`.to_s + unknown 'varnishadm is not installed!' unless varnishadm.include? 'varnish' + command = `sudo #{varnishadm} -T #{config[:host]}:#{config[:port]} -S #{config[:secret]} -t #{config[:timeout]} #{config[:command]}` if config[:command] == 'status' if command.include? 'state running' ok 'Up & Running' else critical 'Varnish down'