1.2 KiB
1.2 KiB
Running Telegraf as a Windows Service
Telegraf natively supports running as a Windows Service. Outlined below is are the general steps to set it up.
- Obtain the telegraf windows distribution
- Create the directory C:\telegraf (if you install in a different location you
will need to edit
cmd/telegraf/telegraf.go
and change the config file location and recompile to use your location) - Place the executable and the config file into C:\telegraf
- Run
C:\telegraf\telegraf.exe --service install
as an administrator - Edit the configuration file to meet your needs
- Run
C:\telegraf\telegraf.exe --config C:\telegraf\telegraf.conf --test
to check that it works - Run
net start telegraf
to start collecting data
Other supported operations
Telegraf can manage its own service through the --service flag:
Command | Effect |
---|---|
telegraf.exe --service install |
Install telegraf as a service |
telegraf.exe --service uninstall |
Remove the telegraf service |
telegraf.exe --service start |
Start the telegraf service |
telegraf.exe --service stop |
Stop the telegraf service |