Telegraf agent configuration (file-2-file, file-2-amqp, file-2-zabbix, disk-2-influxdb etc

Github repos

linux-and-azure/azure-extra-linux-vm/telegraf/README.md at main · spawnmarvel/linux-and-azure · GitHub

Section

Tutorial

Steps

Remote telegraf

Install as Win Service and read json file in and output

RabbitMQ output

Zabbix output

Influxdb output

Configuration options and continue tutorial

Telegraf, a server-based agent, collects and sends metrics and events from databases, systems, and IoT sensors. Written in Go, Telegraf compiles into a single binary with no external dependencies–requiring very minimal memory.

Telegraf Documentation (influxdata.com)

https://github.com/influxdata/telegraf

Our tutorial

https://docs.influxdata.com/influxdb/v2/write-data/no-code/use-telegraf

Steps

Remote telegraf

How To Monitor System Metrics with the TICK Stack on Ubuntu 16.04 | DigitalOcean

Install as Win Service

After install you get:

Follow the steps on github, make a agent conf, telegraf.conf

Read a file in and append on to a file out, keep rolling in test mode

Test mode

In and out file, log and folders

It reads the text file and appends to the out file, in interval in the [Agent] section

Install as Windows Service when you are happy / view github ps1

You get this service

log file

and output file is growing

Lets explorer the agent parameters and store them in the config file.

linux-and-azure/azure-extra-linux-vm/influxdb-telegraf/telegraf_file.conf at main · spawnmarvel/linux-and-azure · GitHub

Example edit log mode

quiet = false # quiet: True, Log only error level messages, or false.

Example Agent section

[agent]
 interval = "30s" 
 round_interval = true
 metric_batch_size = 1000 
 metric_buffer_limit = 10000 
 collection_jitter = "0s" 
 flush_interval = "30s"
 flush_jitter = "5s" precision = ""
 debug = true
 quiet = false # quiet: Log only error level messages.
 logfile = "C://Program Files//Telegraf//telegraf-1.32.0//telegraf.logs"
 logfile_rotation_max_size = "10MB"
 logfile_rotation_max_archives = 10

RabbitMQ ouput

Lets assume the same json input file

linux-and-azure/azure-extra-linux-vm/influxdb-telegraf/telegraf_file_rabbitmq.conf at main · spawnmarvel/linux-and-azure · GitHub

Stop the service and update the \conf\telegraf.conf with above file.

Make a amqp user and password in RabbitMQ.

Start the Telegraf service and verify logs

Now verify the new exchange in RabbitMQ

Make a queue and bind to the exchange “telegraf”

Verify that you are receiving data on the queue from.telegraf with above exchange.

Telegraf logs

Queue

Inspect one message.

View connections

Disconnect it and see if if it reconnects?

Logs Telegraf

All good, perfect.

Influxdb output, we had disk as input

# Read metrics about disk usage by mount point
[[inputs.disk]]
  ## Ignore mount points by filesystem type.
  ignore_fs = ["tmpfs", "devtmpfs", "devfs", "iso9660", "overlay", "aufs", "squashfs"]

We wrote the disk output

# Configuration for sending metrics to InfluxDB 2.0
[[outputs.influxdb_v2]]
urls = ["http://xx.xxx.xxx.241:8086"]
## Token for authentication.
token = "make a token in inflyxdb for the bucket"
## Organization is the name of the organization you wish to write to.
organization = "lima"
## Destination bucket to write into.
bucket = "testTelegraf"

Choose all parameters for c:

Zabbix output

Host in zabbix

Items

Result success

Configuration options and continue tutorial

Agent, we have spent some time here and this config is straight forward.

After generating a config with and input and output, telegraf.conf had a big section on processors and smaller section on aggregator.

# make a new conf with input cpu and output file

PS C:\Program Files\Telegraf\telegraf-1.32.0> .\telegraf.exe --input-filter cpu --output-filter file config > telegraf.conf

Example file output

Input

Aggregator

Processor

Output

https://docs.influxdata.com/telegraf/v1/configuration

Scroll to Top