1
0
Fork 0
mirror of https://github.com/eosswedenorg/haproxy-exporter-systemd synced 2026-06-16 05:04:56 +02:00

Initial Commit

This commit is contained in:
Henrik Hautakoski 2018-12-07 19:29:57 +01:00
commit 3ca0d22ed1
3 changed files with 64 additions and 0 deletions

1
.gitignore vendored Normal file
View file

@ -0,0 +1 @@
/*/*

30
haproxy_exporter.conf Normal file
View file

@ -0,0 +1,30 @@
# 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"
# --version Show application version.
#
HAPROXY_EXPORTER_OPTS=

33
install.sh Executable file
View file

@ -0,0 +1,33 @@
#!/usr/bin/env bash
ARCH=$(dpkg --print-architecture)
VERSION=0.9.0
INSTALLDIR=/usr/local/bin
CONFIGDIR=/etc/prometheus
# Download and install the binary.
wget -O- https://github.com/prometheus/haproxy_exporter/releases/download/v${VERSION}/haproxy_exporter-${VERSION}.linux-${ARCH}.tar.gz | tar zxf -
sudo mv haproxy_exporter-${VERSION}.linux-${ARCH}/haproxy_exporter ${INSTALLDIR}/haproxy_exporter-${VERSION}
# Create User/Group
sudo useradd -M -s /bin/false haproxy_exporter
# Write config
sudo mkdir -p ${CONFIGDIR}
sudo cp ./haproxy_exporter.conf ${CONFIGDIR}/
# Write system service file.
echo "[Unit]
Description=HAProxy Prometheus Exporter
Wants=network-online.target
After=network-online.target
[Service]
EnvironmentFile=-${CONFIGDIR}/haproxy_exporter.conf
User=haproxy_exporter
Group=haproxy_exporter
Type=simple
ExecStart=/usr/local/bin/haproxy_exporter-${VERSION} \$HAPROXY_EXPORTER_OPTS
[Install]
WantedBy=multi-user.target" | sudo tee /etc/systemd/system/haproxy_exporter.service > /dev/null