bin/check-marathon.rb in sensu-plugins-mesos-0.1.1 vs bin/check-marathon.rb in sensu-plugins-mesos-1.0.0

- old
+ new

@@ -41,10 +41,23 @@ short: '-p PORT', long: '--port PORT', required: false, default: '8080' + option :protocol, + description: 'Marathon protocol [http/https]', + short: '-P PROTOCOL', + long: '--protocol PROTOCOL', + required: false, + default: 'http' + + option :uri, + description: 'Endpoint URI', + short: '-u URI', + long: '--uri URI', + default: '/ping' + option :timeout, description: 'timeout in seconds', short: '-t TIMEOUT', long: '--timeout TIMEOUT', proc: proc(&:to_i), @@ -53,10 +66,10 @@ def run servers = config[:server] failures = [] servers.split(',').each do |server| begin - r = RestClient::Resource.new("http://#{server}:#{config[:port]}/ping", timeout: config[:timeout]).get + r = RestClient::Resource.new("#{config[:protocol]}://#{server}:#{config[:port]}#{config[:uri]}", timeout: config[:timeout]).get if r.code != 200 failures << "Marathon Service on #{server} is not responding" end rescue Errno::ECONNREFUSED, RestClient::ResourceNotFound, SocketError failures << "Marathon Service on #{server} is not responding"