Mackerel blog #mackerelio

The Official Blog of Mackerel

Regarding response body checks and redirects of URL external monitoring and future plans

Mackerel Sub-producer id:Songmu here. Thank you very much for choosing Mackerel. This is an announcement regarding the titled subject matter.

As stated in the help page, 2xx / 3xx type status codes are considered normal in the URL external monitor feature. Additionally, redirects are not checked for 3xx type responses.

Even if “response body check” is configured, it will not be performed if the response type is 3xx. Thus, if you currently have monitoring set up for URLs that return 3xx responses, the response body check is not being performed.

We realize this behavior is not intuitive, and we plan to change it so that if “response body check” is configured, the string will be checked even for 3xx responses.

In this case, we plan on performing string checks for the response body of 3xx type HTTP responses. The URL external monitoring feature checks the HTTP response by itself in order to not follow the redirect.

As an example, http://mackerel.io returns the 301 redirect to https://mackerel.io. The output appears as shown below when accessed with curl (the output is abbreviated).

% curl -v http://mackerel.io/
> GET / HTTP/1.1
> Host: mackerel.io
> User-Agent: curl/7.51.0
> Accept: */*
>
< HTTP/1.1 301 Moved Permanently
< Date: Thu, 20 Apr 2017 10:28:57 GMT
< Content-Type: text/html
< Content-Length: 178
< Connection: keep-alive
< Location: https://mackerel.io/
<
<html>
<head><title>301 Moved Permanently</title></head>
<body bgcolor="white">
<center><h1>301 Moved Permanently</h1></center>
<hr><center>nginx</center>
</body>
</html>

In this case, the section beginning with <html> will be the response body of this HTTP response, and the string check of the “response body check” will be done for this content.

Such being the case, please take a moment to review the settings concerning monitoring items which configure the “response body check” in the URL that returns 3xx type responses. Specifically, any of the following responses are assumed. If such a configuration is already set, changing the configuration is not necessary.

  • Configuring the URL to that which returns 2xx instead of 3xx
  • Deleting the “response body check” configuration
  • Configuring “response body check” for the string included in the 3xx response itself in preparation for future specification changes

We are also considering creating a configuration option in future feature expansions to follow and check the redirect for 3xx responses.

Summary

  • Currently, response body checks are not performed for 3xx type responses
  • We plan to make changes so that the response body of the original response is checked
    • Please update the configuration as necessary
  • We are considering adding options in future feature expansions to follow 3xx type redirects

Thanks again for choosing Mackerel.