bin/check-mesos.rb in sensu-plugins-mesos-0.0.2 vs bin/check-mesos.rb in sensu-plugins-mesos-0.0.3

- old
+ new

@@ -40,20 +40,27 @@ description: 'master or slave', short: '-m MODE', long: '--mode MODE', required: true + option :timeout, + description: 'timeout in seconds', + short: '-t TIMEOUT', + long: '--timeout TIMEOUT', + proc: proc(&:to_i), + default: 5 + def run case config[:mode] when 'master' port = '5050' uri = '/master/health' when 'slave' port = '5051' uri = '/slave(1)/health' end begin - r = RestClient::Resource.new("http://#{config[:server]}:#{port}#{uri}", timeout: 5).get + r = RestClient::Resource.new("http://#{config[:server]}:#{port}#{uri}", timeout: config[:timeout]).get if r.code == 200 ok "Mesos #{config[:mode]} is up" else critical "Mesos #{config[:mode]} is not responding" end