====== Telegraf ======
Agente recolector de métricas
* [[https://www.influxdata.com/time-series-platform/telegraf/|Web oficial]]
===== Instalación =====
Añadimos el repositorio de InfluxData:
wget -qO- https://repos.influxdata.com/influxdb.key | sudo apt-key add -
source /etc/os-release
test $VERSION_ID = "7" && echo "deb https://repos.influxdata.com/debian wheezy stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "8" && echo "deb https://repos.influxdata.com/debian jessie stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "9" && echo "deb https://repos.influxdata.com/debian stretch stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
test $VERSION_ID = "10" && echo "deb https://repos.influxdata.com/debian buster stable" | sudo tee /etc/apt/sources.list.d/influxdb.list
Actualizamos repositorios e instalamos:
sudo apt-get update && sudo apt-get install telegraf
* https://docs.influxdata.com/telegraf/v1.14/introduction/installation/
==== Docker ====
[[https://hub.docker.com/_/telegraf|Imagen oficial]].
Si queremos personalizar la configuración, lanzamos un contenedor de la siguiente manera:
docker run --rm telegraf telegraf config > telegraf.conf
Esto creará un fichero ''telegraf.conf'' con la configuración por defecto. Lo adaptamos a nuestro gusto y luego lo pasamos al contenedor:
''docker-compose.yml'':
version: '3'
services:
app:
container_name: telegraf
image: telegraf
restart: "no"
volumes:
- ./conf/telegraf.conf:/etc/telegraf/telegraf.conf:ro
===== Configuración =====
Fichero ''/etc/telegraf/telegraf.conf'':
###############################################################################
# CONFIGURATION #
###############################################################################
[global_tags]
[agent]
interval = "10s"
round_interval = true
metric_batch_size = 1000
metric_buffer_limit = 10000
collection_jitter = "0s"
flush_interval = "10s"
flush_jitter = "0s"
debug = false
quiet = false
hostname = "" # opcional
omit_hostname = false
###############################################################################
# OUTPUT PLUGINS #
###############################################################################
[[outputs.influxdb]]
urls = ["http://influxdb:8086"]
database = "telegraf"
retention_policy = ""
write_consistency = "any"
timeout = "5s"
username = "telegraf"
password = "TelegrafPassword"
###############################################################################
# INPUT PLUGINS #
###############################################################################
# CPU
######
[[inputs.cpu]]
percpu = false
totalcpu = true
fielddrop = ["time_*"]
# DISK
#######
[[inputs.disk]]
ignore_fs = ["tmpfs", "devtmpfs", "none"]
[[inputs.diskio]]
# Kernel
########
[[inputs.kernel]]
# Memory
#########
[[inputs.mem]]
# NET
######
[[inputs.net]]
interfaces = ["eth0"]
# Netstat
#########
[[inputs.netstat]]
# Processes
############
[[inputs.processes]]
# System
#########
[[inputs.system]]
===== Integraciones =====
* https://www.influxdata.com/products/integrations/