-
Notifications
You must be signed in to change notification settings - Fork 117
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
sensu-handler.rb sends 'http://servername:port' to the API, along with stash request #160
Comments
sensu-plugin 1.4.3 contains a regression in api_request which we don't want to ship (see sensu-plugins/sensu-plugin#160). This reverts commit ced730c.
@raffraffraff thanks for bringing this to our attention; this appears to be a regression. |
So a gem install sensu-plugin -v 1.4.2 gets me out of the soup, for now. Thanks for the very quick response. |
I do this (sensu-plugin-1.4.3/lib/sensu-handler.rb):
And my logs changed from this:
To this:
|
As noted in #131 we don't have unit tests for most any aspect of api requests, including stashes. I've started adding a test here https://github.com/sensu-plugins/sensu-plugin/compare/tests/api-request-stash-exists but it is passing on 1.9 where this bug report leads me to believe it should be failing. Perhaps webmock is hiding the bug? Any thoughts? |
Comparing the arguments for `Net::HTTPGenericRequest` on [1.9.1](https://ruby-doc.org/stdlib-1.9.1/libdoc/net/http/rdoc/Net/HTTPGenericRequest.html) vs [2.3.0](https://ruby-doc.org/stdlib-2.3.0/libdoc/net/http/rdoc/Net/HTTPGenericRequest.html), I see that 1.9.1 expects argument `path` where as 2.3.0 takes `uri_or_path` argument. If the `uri_or_path` is not a `URI` object, it is treated as the path. I believe we can unconditionally pass the value of `uri.path` to `net_http_req_class(method).new` on both ruby 1.9 and 2.x, as the hostname, port and scheme are explicitly set when calling `Net::HTTP.start`. Closes sensu-plugins/sensu-plugins-sensu#18 Closes #160 Closes #161
Comparing the arguments for `Net::HTTPGenericRequest` on [1.9.1](https://ruby-doc.org/stdlib-1.9.1/libdoc/net/http/rdoc/Net/HTTPGenericRequest.html) vs [2.3.0](https://ruby-doc.org/stdlib-2.3.0/libdoc/net/http/rdoc/Net/HTTPGenericRequest.html), I see that 1.9.1 expects argument `path` where as 2.3.0 takes `uri_or_path` argument. If the `uri_or_path` is not a `URI` object, it is treated as the path. I believe we can unconditionally pass the value of `uri.path` to `net_http_req_class(method).new` on both ruby 1.9 and 2.x, as the hostname, port and scheme are explicitly set when calling `Net::HTTP.start`. Closes sensu-plugins/sensu-plugins-sensu#18 Closes #160 Closes #161
sensu-plugin 1.4.3 [contains a regression][1] which is now fixed in 1.4.4. [1]: sensu-plugins/sensu-plugin#160
I'm using the latest version of sensu (0.26 git clone) and sensu-plugin 1.4.3. My stashes are not honored. I've done some debugging, and I've found that 'sensu-handler.rb' composes a 'correct' uri for each stash check. I've added a 'put' so it logs it to the sensu-server.log. I took the uri it logged and tested it with curl
curl -X -u user:pass http://127.0.0.1:4567/stashes/silence/server/check
This works. The sensu-api.log tells me that the sensu-handler.rb gets a 404 for the same uri. However, I also noticed that the handler appears to be sending the 'http://127.0.0.1:4567' to the http://127.0.0.1:4567.
sensu-api.log - curl
sensu-api.log - sensu-handler
The only way I can replicate this behavior using curl, is to do this:
curl -u user:pass -X GET http://127./0.0.1:4567?http://127.0.0.1:4567/stashes/silence/host/check
My api.json is pretty basic:
The text was updated successfully, but these errors were encountered: