Skip to content

Telegraf

Telegraf: metrics collector

Install

For Debian 9 Stretch:

cat <<EOF | sudo tee /etc/apt/sources.list.d/influxdata.list
deb https://repos.influxdata.com/debian stretch stable
EOF
curl -sL https://repos.influxdata.com/influxdb.key | apt-key add -
apt update && apt install telegraf -y
systemctl enable --now telegraf

Config

Docker

usermod -a -G docker telegraf

Nginx logparser

usermod -a -G adm telegraf

Nginx status

Enable stub_status:

location /nginx_status {
   stub_status on;
   allow 127.0.0.1;        #only allow requests from localhost
   deny all;               #deny all other hosts
}

Smartctl

Install smartmontools and add with visudo the following lines:

# Monitoring tool
telegraf  ALL=(ALL) NOPASSWD: /usr/sbin/smartctl