Self-hosting. Telegraf

АгСнт для сбора Ρ€Π°Π·Π»ΠΈΡ‡Π½Ρ‹Ρ… сСрвСрных Π°Π½Π°Π»ΠΈΡ‚ΠΈΠΊ с ΠΎΡ‚ΠΊΡ€Ρ‹Ρ‚Ρ‹ΠΌ исходным ΠΊΠΎΠ΄ΠΎΠΌ. ΠŸΠΎΠ·Π²ΠΎΠ»ΡΠ΅Ρ‚ ΡΠΎΠ±ΠΈΡ€Π°Ρ‚ΡŒ Ρ€Π°Π·Π»ΠΈΡ‡Π½Ρ‹Π΅ Π΄Π°Π½Π½Ρ‹Π΅ для ΠΎΡ€Π³Π°Π½ΠΈΠ·Π°Ρ†ΠΈΠΈ ΠΌΠΎΠ½ΠΈΡ‚ΠΎΡ€ΠΈΠ½Π³Π° систСм ΠΈ ΠΏΠ΅Ρ€Π΅Π΄Π°Π²Π°Ρ‚ΡŒ ΠΈΡ… Π² Ρ€Π°Π·Π»ΠΈΡ‡Π½Ρ‹Π΅ систСмы сбора ΠΈ ΠΎΠ±Ρ€Π°Π±ΠΎΡ‚ΠΊΠΈ статистики. Π’ основном ΠΈΡΠΏΠΎΠ»ΡŒΠ·ΡƒΠ΅Ρ‚ΡΡ Π² связкС с influxdb, Π½ΠΎ Ρ‚Π°ΠΊ ΠΆΠ΅ ΠΌΠΎΠΆΠ΅Ρ‚ ΠΏΠΈΡΠ°Ρ‚ΡŒ Π² Π»ΠΎΠ³ΠΈ ΠΈ Π² mqtt ΠΈ ΠΈ.Π΄.

Π˜ΠΌΠ΅Π΅Ρ‚ мноТСство Ρ€Π°Π·Π»ΠΈΡ‡Π½Ρ‹Ρ… ΠΏΠ»Π°Π³ΠΈΠ½ΠΎΠ² для Ρ€Π°ΡΡˆΠΈΡ€Π΅Π½ΠΈΡ Ρ„ΡƒΠ½ΠΊΡ†ΠΈΠΎΠ½Π°Π»Π°: Plugin directory | Telegraf Documentation

ΠžΡ„ΠΈΡ†ΠΈΠ°Π»ΡŒΠ½Ρ‹ΠΉ сайт: Telegraf | InfluxData

ΠœΠΎΠ½ΠΈΡ‚ΠΎΡ€ΠΈΠ½Π³ linux систСмы

Docker compose Ρ„Π°ΠΉΠ»:

Telegraf

ΠšΠΎΠ½Ρ„ΠΈΠ³ настроСк Ρ„Π°ΠΉΠ»Π΅ ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ, Π° Ρ‚Π°ΠΊ ΠΆΠ΅ хранится Π² influxdb

version: "3"
services:
  telegraf:
    image: telegraf:latest
    container_name: telegraf
    environment:
      - HOST_ETC=/hostfs/etc
      - HOST_PROC=/hostfs/proc
      - HOST_SYS=/hostfs/sys
      - HOST_VAR=/hostfs/var
      - HOST_RUN=/hostfs/run
      - HOST_MOUNT_PREFIX=/hostfs
      - TZ=Europe/Moscow
    volumes:
      - /:/hostfs:ro
      - /docker/telegraf/telegraf.conf:/etc/telegraf/telegraf.conf:ro

ΠšΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΡ:

Telegraf

[global_tags]
[agent]
  interval = "30s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = ""
  debug = false
  quiet = false
  hostname = "Armbian"
  omit_hostname = false

[[outputs.influxdb_v2]]
  urls = ["http://192.168.0.135:8086"]
  token = "<TOKEN>"
  organization = "influxdb"
  bucket = "system-monitoring"

[[inputs.cpu]]
  percpu = false
  totalcpu = true
  collect_cpu_time = false
  report_active = false
[[inputs.disk]]
  mount_points = ["/"]
[[inputs.diskio]]
[[inputs.linux_sysctl_fs]]
[[inputs.mem]]
[[inputs.nstat]]
[[inputs.netstat]]
[[inputs.processes]]
[[inputs.swap]]
[[inputs.system]]
[[inputs.temp]]

ΠœΠΎΠ½ΠΈΡ‚ΠΎΡ€ΠΈΠ½Π³ OpenWrt

Docker compose Ρ„Π°ΠΉΠ»:

ΠšΠΎΠ½Ρ„ΠΈΠ³ настроСк Ρ„Π°ΠΉΠ»Π΅ ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ, Π° Ρ‚Π°ΠΊ ΠΆΠ΅ хранится Π² influxdb

version: "3"
services:
  telegraf-openwrt:
    image: telegraf:latest
    container_name: telegraf-openwrt
    environment:
      - TZ=Europe/Moscow
    volumes:
      - /docker/telegraf-openwrt/telegraf.conf:/etc/telegraf/telegraf.conf:ro
      - /docker/telegraf-openwrt/types.db:/usr/share/collectd/types.db
    ports:
      - "8094:8094/udp"

ΠšΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΡ:

[global_tags]

[agent]
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_interval = "10s"
  flush_jitter = "0s"
  precision = "0s"
  hostname = "Perenio"
  omit_hostname = false

[[outputs.influxdb_v2]]
urls = ["http://192.168.0.137:8086"]
token = "<TOKEN>"
organization = "influxdb"
bucket = "openwrt"

[[inputs.socket_listener]]
  service_address = "udp://0.0.0.0:8094"
  data_format = "collectd"
  collectd_typesdb = ["/usr/share/collectd/types.db"]

Π€Π°ΠΉΠ» Π±Π°Π·Ρ‹: ![[types.db]]

ΠœΠΎΠ½ΠΈΡ‚ΠΎΡ€ΠΈΠ½Π³ NUT

Docker compose Ρ„Π°ΠΉΠ»:

Telegraf-nut

ΠšΠΎΠ½Ρ„ΠΈΠ³ настроСк Ρ„Π°ΠΉΠ»Π΅ ΠΊΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΠΈ, Π° Ρ‚Π°ΠΊ ΠΆΠ΅ хранится Π² influxdb

version: "3"
services:
  telegraf-nut:
    image: telegraf:latest
    container_name: telegraf-nut
    environment:
      - TZ=Europe/Moscow
    volumes:
      - /docker/telegraf-nut/telegraf.conf:/etc/telegraf/telegraf.conf:ro

ΠšΠΎΠ½Ρ„ΠΈΠ³ΡƒΡ€Π°Ρ†ΠΈΡ:

Telegraf-Nut

[agent]
  interval = "10s"
  round_interval = true
  metric_batch_size = 1000
  metric_buffer_limit = 10000
  collection_jitter = "0s"
  flush_jitter = "0s"
  precision = ""
  hostname = "Armbian"
  omit_hostname = false
[[outputs.influxdb_v2]]
  urls = ["http://192.168.0.135:8086"]
  token = "<TOKEN>"
  organization = "influxdb"
  bucket = "nut"
[[inputs.upsd]]
  server = "192.168.0.137"
  port = 3493
  username = "deniom"
  password = "Ap256216"
  
  additional_fields = ["*"]

[[processors.enum]]
  [[processors.enum.mapping]]
    field = "ups_beeper_status"
    [processors.enum.mapping.value_mappings]
      true = "enabled"
      false = "disabled"