sensu-plugins-http
sensu-plugins-http copied to clipboard
metrics-http-json.rb HTTP basic auth
Extracting metrics from an api endpoint that requires authentication fails in a strange way. When the --url parameter is formatted like "user:pass@localhost:8080" the check fails with this output:
Check failed to run: Failed to open TCP connection to http:80 (getaddrinfo: Name or service not known), ["/usr/lib/ruby/2.3.0/net/http.rb:882:in `rescue in block in connect'", "/usr/lib/ruby/2.3.0/net/http.rb:879:in `block in connect'", "/usr/lib/ruby/2.3.0/timeout.rb:91:in `block in timeout'", "/usr/lib/ruby/2.3.0/timeout.rb:101:in `timeout'", "/usr/lib/ruby/2.3.0/net/http.rb:878:in `connect'", "/usr/lib/ruby/2.3.0/net/http.rb:863:in `do_start'", "/usr/lib/ruby/2.3.0/net/http.rb:852:in `start'", "/var/lib/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:715:in `transmit'", "/var/lib/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:145:in `execute'", "/var/lib/gems/2.3.0/gems/rest-client-2.0.2/lib/restclient/request.rb:52:in `execute'", "/var/lib/gems/2.3.0/gems/sensu-plugins-http-5.1.1/bin/metrics-http-json.rb:91:in `run'", "/var/lib/gems/2.3.0/gems/sensu-plugin-4.0.0/lib/sensu-plugin/cli.rb:59:in `block in <class:CLI>'"]
Of course, the request is not for port 80, making this failure perplexing.
let me take a look at this and see if I can figure it out. Ping here again on Monday if you haven't seen a response from me.
I suppose another way to go about it would be to add the --username
and --password
flags from the check-http-json.rb script.
Hey, @jspaleta any updates on this? If it helps at all, I'll be using this plugin to grab metrics from the CouchDB api, so it does need to have HTTP basic auth on a high port (5984/5986) Let me know if you need more info, cheers!
Yeah let's implement the username and password flags. I'll prioritize this right now and see if I can get this implemented.