{"id":13392830,"url":"https://github.com/prometheus/haproxy_exporter","last_synced_at":"2025-03-13T19:31:05.155Z","repository":{"id":6694210,"uuid":"7939398","full_name":"prometheus/haproxy_exporter","owner":"prometheus","description":"Simple server that scrapes HAProxy stats and exports them via HTTP for Prometheus consumption","archived":true,"fork":false,"pushed_at":"2023-03-08T16:26:18.000Z","size":10302,"stargazers_count":617,"open_issues_count":0,"forks_count":219,"subscribers_count":30,"default_branch":"main","last_synced_at":"2024-10-26T18:28:48.555Z","etag":null,"topics":["go","haproxy","haproxy-exporter","metrics","prometheus","prometheus-exporter"],"latest_commit_sha":null,"homepage":"","language":"Go","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"apache-2.0","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prometheus.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null}},"created_at":"2013-01-31T15:33:01.000Z","updated_at":"2024-09-25T22:38:07.000Z","dependencies_parsed_at":"2023-01-13T15:00:11.105Z","dependency_job_id":null,"html_url":"https://github.com/prometheus/haproxy_exporter","commit_stats":{"total_commits":210,"total_committers":51,"mean_commits":4.117647058823529,"dds":0.8571428571428572,"last_synced_commit":"d4aba878f043fd3ad0bcacd0149e7d75e67c0faa"},"previous_names":[],"tags_count":20,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus%2Fhaproxy_exporter","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus%2Fhaproxy_exporter/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus%2Fhaproxy_exporter/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prometheus%2Fhaproxy_exporter/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prometheus","download_url":"https://codeload.github.com/prometheus/haproxy_exporter/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":243469115,"owners_count":20295690,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["go","haproxy","haproxy-exporter","metrics","prometheus","prometheus-exporter"],"created_at":"2024-07-30T17:00:37.842Z","updated_at":"2025-03-13T19:31:04.722Z","avatar_url":"https://github.com/prometheus.png","language":"Go","readme":"# HAProxy Exporter for Prometheus\n\nThis is a simple server that scrapes HAProxy stats and exports them via HTTP for\nPrometheus consumption.\n\n## This exporter is retired\n\nIn all supported versions of HAProxy, the official source includes a Prometheus exporter module that can be built into your binary with a single flag during build time and offers a native Prometheus endpoint. For more information see [down below](#official-prometheus-exporter).\n\nPlease transition to using the built-in support as soon as possible.\n\n## Getting Started\n\nTo run it:\n\n```bash\n./haproxy_exporter [flags]\n```\n\nHelp on flags:\n\n```bash\n./haproxy_exporter --help\n```\n\nFor more information check the [source code documentation][gdocs]. All of the\ncore developers are accessible via the Prometheus Developers [mailinglist][].\n\n[gdocs]: http://godoc.org/github.com/prometheus/haproxy_exporter\n[mailinglist]: https://groups.google.com/forum/?fromgroups#!forum/prometheus-developers\n\n## Usage\n\n### HTTP stats URL\n\nSpecify custom URLs for the HAProxy stats port using the `--haproxy.scrape-uri`\nflag. For example, if you have set `stats uri /baz`,\n\n```bash\nhaproxy_exporter --haproxy.scrape-uri=\"http://localhost:5000/baz?stats;csv\"\n```\n\nOr to scrape a remote host:\n\n```bash\nhaproxy_exporter --haproxy.scrape-uri=\"http://haproxy.example.com/haproxy?stats;csv\"\n```\n\nNote that the `;csv` is mandatory (and needs to be quoted).\n\nIf your stats port is protected by [basic auth][], add the credentials to the\nscrape URL:\n\n```bash\nhaproxy_exporter  --haproxy.scrape-uri=\"http://user:pass@haproxy.example.com/haproxy?stats;csv\"\n```\n\nAlternatively, provide the password through a file, so that it does not appear in the process\ntable or in the output of the ```/debug/pprof/cmdline``` profiling service:\n\n```bash\necho '--haproxy.scrape-uri=http://user:pass@haproxy.example.com/haproxy?stats;csv' \u003e args\nhaproxy_exporter @args\n```\n\nYou can also scrape HTTPS URLs. Certificate validation is enabled by default, but\nyou can disable it using the `--no-haproxy.ssl-verify` flag:\n\n```bash\nhaproxy_exporter --no-haproxy.ssl-verify --haproxy.scrape-uri=\"https://haproxy.example.com/haproxy?stats;csv\"\n```\n\nIf scraping a remote HAProxy must be done via an HTTP proxy, you can enable reading of the\nstandard [`$http_proxy` / `$https_proxy` / `$no_proxy` environment variables](https://pkg.go.dev/net/http#ProxyFromEnvironment) by using the\n`--http.proxy-from-env` flag (these variables will be ignored otherwise):\n\n```bash\nexport HTTP_PROXY=\"http://proxy:3128\"\nhaproxy_exporter --http.proxy-from-env --haproxy.scrape-uri=\"http://haproxy.example.com/haproxy?stats;csv\"\n```\n\n[basic auth]: https://cbonte.github.io/haproxy-dconv/configuration-1.6.html#4-stats%20auth\n\n### Unix Sockets\n\nAs alternative to localhost HTTP a stats socket can be used. Enable the stats\nsocket in HAProxy with for example:\n\n\n    stats socket /run/haproxy/admin.sock mode 660 level admin\n\n\nThe scrape URL uses the 'unix:' scheme:\n\n```bash\nhaproxy_exporter --haproxy.scrape-uri=unix:/run/haproxy/admin.sock\n```\n\n### Docker\n\n[![Docker Repository on Quay](https://quay.io/repository/prometheus/haproxy-exporter/status)][quay]\n[![Docker Pulls](https://img.shields.io/docker/pulls/prom/haproxy-exporter.svg?maxAge=604800)][hub]\n\nTo run the haproxy exporter as a Docker container, run:\n\n```bash\ndocker run -p 9101:9101 quay.io/prometheus/haproxy-exporter:latest --haproxy.scrape-uri=\"http://user:pass@haproxy.example.com/haproxy?stats;csv\"\n```\n\n[hub]: https://hub.docker.com/r/prom/haproxy-exporter/\n[quay]: https://quay.io/repository/prometheus/haproxy-exporter\n\n## Development\n\n[![Go Report Card](https://goreportcard.com/badge/github.com/prometheus/haproxy_exporter)][goreportcard]\n[![Code Climate](https://codeclimate.com/github/prometheus/haproxy_exporter/badges/gpa.svg)][codeclimate]\n\n[goreportcard]: https://goreportcard.com/report/github.com/prometheus/haproxy_exporter\n[codeclimate]: https://codeclimate.com/github/prometheus/haproxy_exporter\n\n### Building\n\n```bash\nmake build\n```\n\n### Testing\n\n[![CircleCI](https://circleci.com/gh/prometheus/haproxy_exporter/tree/main.svg?style=shield)][circleci]\n\n```bash\nmake test\n```\n\n[circleci]: https://circleci.com/gh/prometheus/haproxy_exporter\n\n### TLS and basic authentication\n\nThe HAProxy Exporter supports TLS and basic authentication.\n\nTo use TLS and/or basic authentication, you need to pass a configuration file\nusing the `--web.config.file` parameter. The format of the file is described\n[in the exporter-toolkit repository](https://github.com/prometheus/exporter-toolkit/blob/master/docs/web-configuration.md).\n\n## License\n\nApache License 2.0, see [LICENSE](https://github.com/prometheus/haproxy_exporter/blob/main/LICENSE).\n\n## Alternatives\n\n### Official Prometheus exporter\n\nAs of 2.0.0, HAProxy includes a Prometheus exporter module that can be built into your binary during build time.\nFor HAProxy 2.4 and higher, pass the `USE_PROMEX` flag to `make`:\n\n```bash\nmake TARGET=linux-glibc USE_PROMEX=1\n```\n\nPre-built versions, including the [Docker image](https://hub.docker.com/_/haproxy), typically have this enabled already.\n\nOnce built, you can enable and configure the Prometheus endpoint from your `haproxy.cfg` file as a typical frontend:\n\n```haproxy\nfrontend stats\n    bind *:8404\n    http-request use-service prometheus-exporter if { path /metrics }\n    stats enable\n    stats uri /stats\n    stats refresh 10s\n```\n\nFor more information, see [this official blog post](https://www.haproxy.com/blog/haproxy-exposes-a-prometheus-metrics-endpoint/).\n","funding_links":[],"categories":["Prometheus","Go","go","Monitoring","Exporters"],"sub_categories":["Prometheus","HTTP"],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometheus%2Fhaproxy_exporter","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprometheus%2Fhaproxy_exporter","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprometheus%2Fhaproxy_exporter/lists"}