From 248d31d6c64d096523799639314389704812dc80 Mon Sep 17 00:00:00 2001 From: Manuel de Brito Fontes Date: Thu, 2 Nov 2017 17:04:04 -0300 Subject: [PATCH] Do not use localhost in checks --- pkg/nginx/controller/nginx.go | 2 +- pkg/nginx/metric/collector/status.go | 4 ++-- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/pkg/nginx/controller/nginx.go b/pkg/nginx/controller/nginx.go index 988b9f63f..7d4e9e56c 100644 --- a/pkg/nginx/controller/nginx.go +++ b/pkg/nginx/controller/nginx.go @@ -734,7 +734,7 @@ func (n NGINXController) Name() string { // Check returns if the nginx healthz endpoint is returning ok (status code 200) func (n NGINXController) Check(_ *http.Request) error { - res, err := http.Get(fmt.Sprintf("http://localhost:%v%v", n.ports.Status, ngxHealthPath)) + res, err := http.Get(fmt.Sprintf("http://0.0.0.0:%v%v", n.ports.Status, ngxHealthPath)) if err != nil { return err } diff --git a/pkg/nginx/metric/collector/status.go b/pkg/nginx/metric/collector/status.go index e68e08b5d..e195b045d 100644 --- a/pkg/nginx/metric/collector/status.go +++ b/pkg/nginx/metric/collector/status.go @@ -144,7 +144,7 @@ func (bit BoolToFloat64) UnmarshalJSON(data []byte) error { } func getNginxStatus(port int, path string) (*basicStatus, error) { - url := fmt.Sprintf("http://localhost:%v%v", port, path) + url := fmt.Sprintf("http://0.0.0.0:%v%v", port, path) glog.V(3).Infof("start scraping url: %v", url) data, err := httpBody(url) @@ -175,7 +175,7 @@ func httpBody(url string) ([]byte, error) { } func getNginxVtsMetrics(port int, path string) (*vts, error) { - url := fmt.Sprintf("http://localhost:%v%v", port, path) + url := fmt.Sprintf("http://0.0.0.0:%v%v", port, path) glog.V(3).Infof("start scraping url: %v", url) data, err := httpBody(url)