1.4 KiB
1.4 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:\Program Files\Telegraf
(if you install in a different location simply specify the-config
parameter with the desired location) -
Place the telegraf.exe and the config file into
C:\Program Files\Telegraf
-
To install the service into the Windows Service Manager, run (as an administrator):
> C:\Program Files\Telegraf\telegraf.exe --service install
-
Edit the configuration file to meet your needs
-
To check that it works, run:
> C:\Program Files\Telegraf\telegraf.exe --config C:\Program Files\Telegraf\telegraf.conf --test
-
To start collecting data, run:
> net start telegraf
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 |