sensu-plugins / sensu-plugins-http

This plugin provides native HTTP instrumentation for monitoring and metrics collection, including: response code, JSON response, HTTP last modified, SSL expiry, and metrics via `curl`.
http://sensu-plugins.io
MIT License
30 stars 97 forks source link

Follow redirects option for check-http.rb #96

Open busseyl opened 6 years ago

busseyl commented 6 years ago

This is a feature request:

There are occasions where we need to monitor a HTTP endpoint that has a redirect. Currently, we set up two checks, one that confirms the first hop is a redirect (setting the redirect switch to return a OK status code), and one that confirms the second hop is 200 OK.

It would be beneficial to have this occur in just one check, where the option to follow the redirect(s) is included in the check-http.rb script. This way we can also use the additional functionality of checking output, etc in the output of the final hop.

It appears to me that there is already code in the check-head-redirect.rb script that would apply.

majormoses commented 5 years ago

That makes sense to me from a usability standpoint but I think that complicates the logic quite a bit and makes it less clear as to what is the issue. I am open to it but its not something I have any bandwidth or need for right now. If there would be shared logic we can abstract it into a library to avoid duplication across condition checking and metric gathering scripts.