bin/check-chronos.rb in sensu-plugins-mesos-0.1.1 vs bin/check-chronos.rb in sensu-plugins-mesos-1.0.0
- old
+ new
@@ -40,22 +40,29 @@
description: 'Chronos port',
short: '-p PORT',
long: '--port PORT',
default: '80'
+ option :uri,
+ description: 'Endpoint URI',
+ short: '-u URI',
+ long: '--uri URI',
+ default: '/scheduler/jobs'
+
option :timeout,
description: 'timeout in seconds',
short: '-t TIMEOUT',
long: '--timeout TIMEOUT',
proc: proc(&:to_i),
default: 5
def run
servers = config[:server]
+ uri = config[:uri]
failures = []
servers.split(',').each do |server|
begin
- r = RestClient::Resource.new("http://#{server}:#{config[:port]}/scheduler/jobs", timeout: config[:timeout]).get
+ r = RestClient::Resource.new("http://#{server}:#{config[:port]}#{uri}", timeout: config[:timeout]).get
if r.code != 200
failures << "Chronos on #{server} is not responding"
end
rescue Errno::ECONNREFUSED, RestClient::ResourceNotFound, SocketError
failures << "Chronos on #{server} is not responding"