-
-
Save haproxytechblog/afff5e45d4ede85e9825690278e29d01 to your computer and use it in GitHub Desktop.
Visualize HAProxy Metrics with InfluxDB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
global | |
stats socket /run/haproxy/api.sock mode 660 level admin |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo mkdir /run/haproxy |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ export INFLUXDB_TOKEN="<Insert InfluxDB token here>" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
[[outputs.influxdb_v2]] | |
## The URLs of the InfluxDB cluster nodes. | |
## urls exp: http://127.0.0.1:9999 | |
urls = ["http://127.0.0.1:8086"] | |
## Token for authentication. | |
# token = "$INFLUX_TOKEN" # Uncomment to use environment variable | |
token = "Your InfluxDB token" # Plain text token | |
## Organization is the name of the organization you wish to write to; must exist. | |
organization = "haproxy" | |
## Destination bucket to write into. | |
bucket = "haproxy" | |
[[inputs.haproxy]] | |
servers = ["socket:/run/haproxy/api.sock"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo systemctl stop telegraf | |
$ telegraf --config /etc/telegraf/telegraf.conf | |
2021-04-23T00:01:17Z I! Starting Telegraf 1.18.1 | |
2021-04-23T00:01:17Z I! Loaded inputs: haproxy | |
2021-04-23T00:01:17Z I! Loaded aggregators: | |
2021-04-23T00:01:17Z I! Loaded processors: | |
2021-04-23T00:01:17Z I! Loaded outputs: influxdb_v2 | |
2021-04-23T00:01:17Z I! Tags enabled: host=spion | |
2021-04-23T00:01:17Z I! [agent] Config: Interval:10s, Quiet:false, Hostname:"my-haproxy", Flush Interval:10s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
$ sudo systemctl start telegraf |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment