add probe warning event body like 'Probe terminated redirects'

This commit is contained in:
Paco Xu
2021-12-13 16:50:32 +08:00
parent 93d858c46e
commit 65529fe6e9
2 changed files with 5 additions and 1 deletions

View File

@@ -129,6 +129,10 @@ func DoHTTPProbe(url *url.URL, headers http.Header, client GetHTTPInterface) (pr
if res.StatusCode >= http.StatusOK && res.StatusCode < http.StatusBadRequest {
if res.StatusCode >= http.StatusMultipleChoices { // Redirect
klog.V(4).Infof("Probe terminated redirects for %s, Response: %v", url.String(), *res)
// add some message in case body is empty when redirect is terminated
if len(body) == 0 {
return probe.Warning, "Probe terminated redirects", nil
}
return probe.Warning, body, nil
}
klog.V(4).Infof("Probe succeeded for %s, Response: %v", url.String(), *res)