From b3c96687c3982835f2af7b7191ba3cc744ec51f1 Mon Sep 17 00:00:00 2001 From: Florian Zirker Date: Mon, 28 Mar 2022 21:26:31 +0200 Subject: [PATCH] extract telegraf from monitoring to run int on multible docker hosts --- monitoring/docker-compose.yaml | 40 ------------------- telegraf/docker-compose.yaml | 36 +++++++++++++++++ telegraf/influxdb.conf | 12 ++++++ .../telegraf => telegraf}/telegraf_host.conf | 0 .../telegraf => telegraf}/telegraf_net.conf | 0 {monitoring => telegraf}/test-telegraf.sh | 0 6 files changed, 48 insertions(+), 40 deletions(-) create mode 100644 telegraf/docker-compose.yaml create mode 100644 telegraf/influxdb.conf rename {monitoring/telegraf => telegraf}/telegraf_host.conf (100%) rename {monitoring/telegraf => telegraf}/telegraf_net.conf (100%) rename {monitoring => telegraf}/test-telegraf.sh (100%) diff --git a/monitoring/docker-compose.yaml b/monitoring/docker-compose.yaml index 2a87bea..86835ae 100644 --- a/monitoring/docker-compose.yaml +++ b/monitoring/docker-compose.yaml @@ -70,46 +70,6 @@ services: - "traefik.docker.network=web" - "docker.group=monitoring" - - ################################################################## - # here starts data collection - - telegraf_host: - image: telegraf:1.18 - restart: unless-stopped - environment: - - HOST_MOUNT_PREFIX=/hostfs - - HOST_PROC=/hostfs/proc - - HOST_SYS=/hostfs/sys - - HOST_ETC=/hostfs/etc - - HOST_VAR=/hostfs/var - - HOST_RUN=/hostfs/run - volumes: - - ./telegraf/telegraf_host.conf:/etc/telegraf/telegraf.conf:ro - - /var/run/utmp:/var/run/utmp:ro - - /:/hostfs:ro - network_mode: "host" - labels: - - "docker.group=monitoring" - depends_on: - - influxdb - - - telegraf_net: - image: telegraf:1.18 - restart: unless-stopped - volumes: - - ./telegraf/telegraf_net.conf:/etc/telegraf/telegraf.conf:ro - networks: - - monitoring - - dockersocket - labels: - - "docker.group=monitoring" - depends_on: - - influxdb - dns: - - 192.168.16.5 - networks: monitoring: web: diff --git a/telegraf/docker-compose.yaml b/telegraf/docker-compose.yaml new file mode 100644 index 0000000..91950d4 --- /dev/null +++ b/telegraf/docker-compose.yaml @@ -0,0 +1,36 @@ +version: "3.3" +services: + + host: + image: telegraf:1.18 + restart: unless-stopped + environment: + - HOST_MOUNT_PREFIX=/hostfs + - HOST_PROC=/hostfs/proc + - HOST_SYS=/hostfs/sys + - HOST_ETC=/hostfs/etc + - HOST_VAR=/hostfs/var + - HOST_RUN=/hostfs/run + volumes: + - ./telegraf_host.conf:/etc/telegraf/telegraf.conf:ro + - /var/run/utmp:/var/run/utmp:ro + - /:/hostfs:ro + network_mode: "host" + labels: + - "docker.group=telegraf" + + net: + image: telegraf:1.18 + restart: unless-stopped + volumes: + - ./telegraf_net.conf:/etc/telegraf/telegraf.conf:ro + networks: + - dockersocket + labels: + - "docker.group=telegraf" + dns: + - ${LOCAL_DNS_SERVER} + +networks: + dockersocket: + external: true diff --git a/telegraf/influxdb.conf b/telegraf/influxdb.conf new file mode 100644 index 0000000..9244c34 --- /dev/null +++ b/telegraf/influxdb.conf @@ -0,0 +1,12 @@ +[meta] + dir = "/var/lib/influxdb/meta" + +[data] + dir = "/var/lib/influxdb/data" + wal-dir = "/var/lib/influxdb/wal" + max-concurrent-compactions = 1 + +[monitor] + store-enabled = false + store-database = "_internal" + store-interval = "10s" diff --git a/monitoring/telegraf/telegraf_host.conf b/telegraf/telegraf_host.conf similarity index 100% rename from monitoring/telegraf/telegraf_host.conf rename to telegraf/telegraf_host.conf diff --git a/monitoring/telegraf/telegraf_net.conf b/telegraf/telegraf_net.conf similarity index 100% rename from monitoring/telegraf/telegraf_net.conf rename to telegraf/telegraf_net.conf diff --git a/monitoring/test-telegraf.sh b/telegraf/test-telegraf.sh similarity index 100% rename from monitoring/test-telegraf.sh rename to telegraf/test-telegraf.sh