From 717fe0aa209c325447c6f50c60c4efd6bebbf38f Mon Sep 17 00:00:00 2001 From: chewieip Date: Wed, 13 Apr 2016 16:40:31 +0200 Subject: [PATCH] Adding support for Default Haproxy Stats Page Related to https://github.com/influxdata/telegraf/issues/1019 --- plugins/inputs/haproxy/haproxy.go | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/plugins/inputs/haproxy/haproxy.go b/plugins/inputs/haproxy/haproxy.go index b1402d8ec..2a3451fe4 100644 --- a/plugins/inputs/haproxy/haproxy.go +++ b/plugins/inputs/haproxy/haproxy.go @@ -141,8 +141,14 @@ func (g *haproxy) gatherServer(addr string, acc telegraf.Accumulator) error { if err != nil { return fmt.Errorf("Unable parse server address '%s': %s", addr, err) } - - req, err := http.NewRequest("GET", fmt.Sprintf("%s://%s%s/;csv", u.Scheme, u.Host, u.Path), nil) + var uri string + //Checking for default Haproxy Status page + if u.RawQuery == "" { + uri = fmt.Sprintf("%s://%s%s;csv", u.Scheme, u.Host, u.Path) + } else { + uri = fmt.Sprintf("%s://%s%s?%s;csv", u.Scheme, u.Host, u.Path,u.RawQuery) + } + req, err := http.NewRequest("GET", uri, nil) if u.User != nil { p, _ := u.User.Password() req.SetBasicAuth(u.User.Username(), p)