Fixes #1277 Use the DefaultURL parameter if no url is explicitly set by the user

This commit is contained in:
Martin Seener 2016-05-26 11:25:21 +02:00
parent a8334c3261
commit e04e1a4e3b
1 changed files with 5 additions and 1 deletions

View File

@ -146,7 +146,11 @@ func (r *RabbitMQ) Gather(acc telegraf.Accumulator) error {
}
func (r *RabbitMQ) requestJSON(u string, target interface{}) error {
u = fmt.Sprintf("%s%s", r.URL, u)
url := r.URL
if url == "" {
url = DefaultURL
}
u = fmt.Sprintf("%s%s", url, u)
req, err := http.NewRequest("GET", u, nil)
if err != nil {