2016-04-02 10:28:44 +00:00
|
|
|
# Running Telegraf as a Windows Service
|
|
|
|
|
2016-07-15 21:00:16 +00:00
|
|
|
Telegraf natively supports running as a Windows Service. Outlined below is are
|
|
|
|
the general steps to set it up.
|
|
|
|
|
|
|
|
1. Obtain the telegraf windows distribution
|
|
|
|
2. Create the directory `C:\Program Files\Telegraf` (if you install in a different
|
|
|
|
location simply specify the `-config` parameter with the desired location)
|
2016-08-08 14:55:16 +00:00
|
|
|
3. Place the telegraf.exe and the config file into `C:\Program Files\Telegraf`
|
2016-08-24 07:50:47 +00:00
|
|
|
4. To install the service into the Windows Service Manager, run (as an
|
|
|
|
administrator):
|
2016-08-08 14:55:16 +00:00
|
|
|
|
|
|
|
```
|
2016-08-24 07:50:47 +00:00
|
|
|
> C:\Program Files\Telegraf\telegraf.exe --service install
|
2016-07-15 21:00:16 +00:00
|
|
|
```
|
2016-08-08 14:55:16 +00:00
|
|
|
|
2016-07-15 21:00:16 +00:00
|
|
|
5. Edit the configuration file to meet your needs
|
|
|
|
6. To check that it works, run:
|
2016-08-08 14:55:16 +00:00
|
|
|
|
2016-07-15 21:00:16 +00:00
|
|
|
```
|
2016-08-24 07:50:47 +00:00
|
|
|
> C:\Program Files\Telegraf\telegraf.exe --config C:\Program Files\Telegraf\telegraf.conf --test
|
2016-08-08 14:55:16 +00:00
|
|
|
```
|
|
|
|
|
2016-07-15 21:00:16 +00:00
|
|
|
7. To start collecting data, run:
|
2016-08-08 14:55:16 +00:00
|
|
|
|
|
|
|
```
|
|
|
|
> net start telegraf
|
2016-07-15 21:00:16 +00:00
|
|
|
```
|
|
|
|
|
|
|
|
## 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 |
|
2016-04-02 10:28:44 +00:00
|
|
|
|