include: - haproxy pkg_prometheus-haproxy-exporter: pkg.installed: - pkgs: - prometheus-haproxy-exporter service_prometheus-haproxy-exporter: service.running: - name: prometheus-haproxy-exporter - enable: True - watch: - file: /etc/default/prometheus-haproxy-exporter etc_default_prometheus_haproxy-exporter: file.managed: - name: /etc/default/prometheus-haproxy-exporter - require: - pkg: pkg_prometheus-haproxy-exporter - contents: | # ## SALT managed # # Set the command-line arguments to pass to the server. # Due to shell scaping, to pass backslashes for regexes, you need to double # them (\\d for \d). If running under systemd, you need to double them again # (\\\\d to mean \d), and escape newlines too. ARGS="--haproxy.scrape-uri=http://localhost:9110/haproxy-status;csv --log.level=warn" # Prometheus-haproxy-exporter supports the following options: # # --web.listen-address=":9101" # Address to listen on for web interface and telemetry. # --web.telemetry-path="/metrics" # Path under which to expose metrics. # --haproxy.scrape-uri="http://localhost/;csv" # URI on which to scrape HAProxy. # --haproxy.ssl-verify # Flag that enables SSL certificate verification for the scrape URI # --haproxy.server-metric-fields="2,3,4,5,6,7,8,9,13,14,15,16,17,18,21,24,33,35,38,39,40,41,42,43,44" # Comma-separated list of exported server metrics. See # http://cbonte.github.io/haproxy-dconv/configuration-1.5.html#9.1 # --haproxy.timeout=5s # Timeout for trying to get stats from HAProxy. # --haproxy.pid-file="" # Path to HAProxy pid file. # # If provided, the standard process metrics get exported for the HAProxy # process, prefixed with 'haproxy_process_...'. The haproxy_process exporter # needs to have read access to files owned by the HAProxy process. Depends # on the availability of /proc. # https://prometheus.io/docs/instrumenting/writing_clientlibs/#process-metrics. # --log.level="info" # Only log messages with the given severity or above. # Valid levels: [debug, info, warn, error, fatal] # --log.format="logger:stderr" # Set the log target and format. Example: # "logger:syslog?appname=bob&local=7" or "logger:stdout?json=true"