Telegraf on Windows as a Service

Telegraf can be easily downloaded by following the download instructions here. Make sure to select the right version for your distribution. At the time of this page's creation, Telegraf is at version 1.11.0.

This guide will be covering how to install Telegraf as a service [TaaS] on Windows.

This guide is written with Powershell commands!

1. Download and extract Telegraf.

cd "~\Downloads"
wget "C:\Users\$($env:USERPROFILE)\Downloads\"
Expand-Archive -Path "C:\Users\$($env:USERPROFILE)\Downloads\" -DestinationPath "C:\Program Files\Telegraf"

2. Configure Telegraf.conf.

notepad "C:\Program Files\Telegraf\telegraf.conf"

3. Edit the config file as needed.

Here is what you will need to change to get Telegraf to communicate to InfluxDB as an example.


#full HTTP or UDP url of your InfluxDB instance:
urls = ["ip.of.influx.db:8086"]

#Database name where Telegraf will store metrics
database = "telegraf"

#HTTP username and password for logging into the Telegraf DB:
username = "telegraf"
password = "telegraf"

#Enable this option if you want Telegraf to create the DB where it will store its metrics in Influx. 
#Telegraf will need DB write permissions to create it!
skip_database_creation = false

4. Install Telegraf as a Service.

cd "C:\Program Files\Telegraf"
telegraf.exe --service install --config "C:\Program Files\Telegraf\telegraf.conf"

5. Test Telegraf with the edited config file.

cd "C:\Program Files\Telegraf"
telegraf.exe --config "C:\Program Files\Telegraf\telegraf.conf" --test

6. Start Telegraf.

net start telegraf

7. Check if Telegraf is running.

Get-Service -Name telegraf



Telegraf installation docs:

Telegraf as a Service docs:

Back to top