Skip to content

Commit

Permalink
Adding support for Default Haproxy Stats Page
Browse files Browse the repository at this point in the history
Related to influxdata#1019
  • Loading branch information
pasancario committed Apr 13, 2016
1 parent e428d11 commit 717fe0a
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions plugins/inputs/haproxy/haproxy.go
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down

0 comments on commit 717fe0a

Please sign in to comment.