Add -config-directory argument to Windows service

Fixes https://github.com/influxdata/telegraf/issues/1797
This commit is contained in:
Cosmo Petrich 2017-01-24 12:19:40 +11:00
parent 80411f99f0
commit fa8f9b534e
3 changed files with 8 additions and 4 deletions

View File

@ -11,6 +11,7 @@
- [#2077](https://github.com/influxdata/telegraf/issues/2077): SQL Server Input - Arithmetic overflow error converting numeric to data type int.
- [#2262](https://github.com/influxdata/telegraf/issues/2262): Flush jitter can inhibit metric collection.
- [#1797](https://github.com/influxdata/telegraf/issues/1797): Windows service does not support config directory.
## v1.2 [2017-01-00]

View File

@ -313,7 +313,10 @@ func main() {
DisplayName: "Telegraf Data Collector Service",
Description: "Collects data using a series of plugins and publishes it to" +
"another series of plugins.",
Arguments: []string{"-config", "C:\\Program Files\\Telegraf\\telegraf.conf"},
Arguments: []string{
"-config", "C:\\Program Files\\Telegraf\\telegraf.conf",
"-config-directory", "C:\\Program Files\\Telegraf\\telegraf.d",
},
}
prg := &program{}

View File

@ -4,8 +4,8 @@ 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)
2. Create the directories `C:\Program Files\Telegraf` and `C:\Program Files\Telegraf\telegraf.d`
(if you install in a different location simply specify the `-config` and `-config-directory` parameters with the desired location)
3. Place the telegraf.exe and the telegraf.conf config file into `C:\Program Files\Telegraf`
4. To install the service into the Windows Service Manager, run the following in PowerShell as an administrator (If necessary, you can wrap any spaces in the file paths in double quotes ""):
@ -17,7 +17,7 @@ the general steps to set it up.
6. To check that it works, run:
```
> C:\"Program Files"\Telegraf\telegraf.exe --config C:\"Program Files"\Telegraf\telegraf.conf --test
> C:\"Program Files"\Telegraf\telegraf.exe --config C:\"Program Files"\Telegraf\telegraf.conf --config-directory C:\"Program Files"\Telegraf\telegraf.d --test
```
7. To start collecting data, run: