bin/check-consul-members.rb in sensu-plugins-consul-2.1.1 vs bin/check-consul-members.rb in sensu-plugins-consul-2.2.0
- old
+ new
@@ -92,14 +92,19 @@
description: 'connection will time out after this many seconds',
short: '-t TIMEOUT_IN_SECONDS',
long: '--timeout TIMEOUT_IN_SECONDS',
default: 5
+ option :token,
+ description: 'ACL token',
+ long: '--token ACL_TOKEN'
+
def run
url = "#{config[:scheme]}://#{config[:server]}:#{config[:port]}/v1/agent/members"
options = { timeout: config[:timeout],
verify_ssl: (OpenSSL::SSL::VERIFY_NONE if defined? config[:insecure]),
- ssl_ca_file: (config[:capath] if defined? config[:capath]) }
+ ssl_ca_file: (config[:capath] if defined? config[:capath]),
+ headers: { 'X-Consul-Token' => config[:token] } }
if config[:wan]
url += '?wan=1'
end