grafanaprometheuscentos-6.9

Haproxy exporter unable to fetch data


I am using haproxy_exporter in prometheus and add prometheus as a datasource in grafana and the haproxy plugin using prometheus as a datasource in order to fetch haproxy stats and shown in grafana server. And i am not able to get the output from it. When i run below command, I am getting error invalid URL port.

./haproxy_exporter --no-haproxy.ssl-verify --haproxy.scrape-uri="http://user:$(cat pwfile)192.168.1.10:10000/haproxy/stats;csv"

OUTPUT:

INFO[0000] Starting haproxy_exporter (version=0.9.0, branch=master, revision=0cae8ee3e3f3b7c517db2cc68f386672d8b1b6a7)  source=haproxy_exporter.go:495
INFO[0000] Build context (go=go1.10.1, user=root@rlinux57, date=20180724-16:08:06)  source=haproxy_exporter.go:496
INFO[0000] Listening on :9101                            source=haproxy_exporter.go:521


**ERRO[0013] Can't scrape HAProxy: Get http://admin:abEDokA("192.168.1.10:10000/haproxy/stats;csv: invalid URL port abEDokA("192.168.1.10:10000"  source=haproxy_exporter.go:315**

And when i placed @ sign between password and IP address, such as ./haproxy_exporter --no-haproxy.ssl-verify --haproxy.scrape-uri="http://admin:abEDokA("@192.168.1.10:10000/haproxy/stats;csv" It gives below error:

INFO[0000] Starting haproxy_exporter (version=0.9.0, branch=master, revision=0cae8ee3e3f3b7c517db2cc68f386672d8b1b6a7)  source=haproxy_exporter.go:495
INFO[0000] Build context (go=go1.10.1, user=root@rlinux57, date=20180724-16:08:06)  source=haproxy_exporter.go:496
FATA[0000] parse http://admin:abEDokA("@192.168.1.10:10000/haproxy/stats;csv: net/url: invalid userinfo  source=haproxy_exporter.go:500

And my prometheus settings are:

  - job_name: 'haproxy'

    # metrics_path defaults to '/metrics'
    # scheme defaults to 'http'.
   static_configs:
    - targets: ['localhost:9101']

Solution

  • You need the @ in there and you might need to get rid of the " in your password. Maybe simply escaping it (\") could work, but the second error message suggests haproxy_exporter somehow correctly receives the URL as http://admin:abEDokA("@192.168.1.10:10000/haproxy/stats;csv but is then unable to parse it.

    Yup, according to http://www.ietf.org/rfc/rfc1738.txt, " is not a valid character in a URL. You may get around it by using its escape, %22.