Public Repository

Last pushed: 2 years ago
Short Description
Alpine image with Telegraf
Full Description

Tags & Dockerfile

What is Telegraf?

Telegraf is an agent written in Go for collecting metrics from the system it's running on, or from other services, and writing them into InfluxDB or other outputs.


Create the configuration file

Telegraf comes with no input and output configuration so we have to create one.

We can create a full telegraf.conf configuration file and configure the required inputs and outputs.

$ docker run -it --rm jfusterm/telegraf telegraf -sample-config > telegraf.conf

Another approach is to generate the configuration with just the inputs and outputs we need. For example with Docker and Nginx inputs and InfluxDB output.

$ docker run -it --rm jfusterm/telegraf telegraf -sample-config -input-filter docker:nginx -output-filter influxdb > telegraf.conf

Note: For a detailed list of the input and output plugins, check the Github repository.

Create the container

Use your own image

  • Create a Dockerfile
FROM jfusterm/telegraf
COPY telegraf.conf /etc/telegraf
  • Build the image
$ docker build -t my-telegraf .
  • Run the container
$ docker run -d --name my-telegraf my-telegraf

Copy the telegraf.conf to the container

  • Create the container
$ docker create --name telegraf jfusterm/telegraf
  • Copy the configuration file to the container
$ docker cp telegraf.conf telegraf:/etc/telegraf
  • Start the container
$ docker start telegraf

Bind mount the configuration file

$ docker run --name telegraf -v /dir/telegraf.conf:/etc/telegraf/telegraf.conf jfusterm/telegraf
Docker Pull Command