Adding c:\program files\telegraf\telegraf.conf

this will now be the default config file location on windows, basically
it is the windows equivalent of /etc/telegraf/telegraf.conf

also updating the changelog

closes #1543
This commit is contained in:
Cameron Sparr 2016-08-08 15:55:16 +01:00 committed by Aurélien Hébert
parent fdfe08275d
commit 84fb279736
4 changed files with 31 additions and 33 deletions

View File

@ -1,23 +1,11 @@
## v1.0 [unreleased] ## v1.0 [unreleased]
### Features
- [#1413](https://github.com/influxdata/telegraf/issues/1413): Separate container_version from container_image tag.
- [#1525](https://github.com/influxdata/telegraf/pull/1525): Support setting per-device and total metrics for Docker network and blockio.
- [#860](https://github.com/influxdata/telegraf/issues/860): Make Telegraf run as a Windows service
### Bugfixes
- [#1519](https://github.com/influxdata/telegraf/pull/1519): Fix error race conditions and partial failures.
- [#1477](https://github.com/influxdata/telegraf/issues/1477): nstat: fix inaccurate config panic.
- [#1481](https://github.com/influxdata/telegraf/issues/1481): jolokia: fix handling multiple multi-dimensional attributes.
- [#1430](https://github.com/influxdata/telegraf/issues/1430): Fix prometheus character sanitizing. Sanitize more win_perf_counters characters.
- [#1534](https://github.com/influxdata/telegraf/pull/1534): Add diskio io_time to FreeBSD & report timing metrics as ms (as linux does).
## v1.0 beta 3 [2016-07-18]
### Release Notes ### Release Notes
- Telegraf now supports being installed as an official windows service,
which can be installed via
`> C:\Program Files\Telegraf\telegraf.exe --service install`
**Breaking Change**: Aerospike main server node measurements have been renamed **Breaking Change**: Aerospike main server node measurements have been renamed
aerospike_node. Aerospike namespace measurements have been renamed to aerospike_node. Aerospike namespace measurements have been renamed to
aerospike_namespace. They will also now be tagged with the node_name aerospike_namespace. They will also now be tagged with the node_name
@ -91,6 +79,7 @@ consistent with the behavior of `collection_jitter`.
- [#1278](https://github.com/influxdata/telegraf/pull/1278) & [#1288](https://github.com/influxdata/telegraf/pull/1288) & [#1295](https://github.com/influxdata/telegraf/pull/1295): RabbitMQ/Apache/InfluxDB inputs: made url(s) parameter optional by using reasonable input defaults if not specified - [#1278](https://github.com/influxdata/telegraf/pull/1278) & [#1288](https://github.com/influxdata/telegraf/pull/1288) & [#1295](https://github.com/influxdata/telegraf/pull/1295): RabbitMQ/Apache/InfluxDB inputs: made url(s) parameter optional by using reasonable input defaults if not specified
- [#1296](https://github.com/influxdata/telegraf/issues/1296): Refactor of flush_jitter argument. - [#1296](https://github.com/influxdata/telegraf/issues/1296): Refactor of flush_jitter argument.
- [#1213](https://github.com/influxdata/telegraf/issues/1213): Add inactive & active memory to mem plugin. - [#1213](https://github.com/influxdata/telegraf/issues/1213): Add inactive & active memory to mem plugin.
- [#1543](https://github.com/influxdata/telegraf/pull/1543): Official Windows service.
### Bugfixes ### Bugfixes

View File

@ -41,6 +41,8 @@ var fOutputList = flag.Bool("output-list", false,
"print available output plugins.") "print available output plugins.")
var fUsage = flag.String("usage", "", var fUsage = flag.String("usage", "",
"print usage for a plugin, ie, 'telegraf -usage mysql'") "print usage for a plugin, ie, 'telegraf -usage mysql'")
var fService = flag.String("service", "",
"operate on the service")
// Telegraf version, populated linker. // Telegraf version, populated linker.
// ie, -ldflags "-X main.version=`git describe --always --tags`" // ie, -ldflags "-X main.version=`git describe --always --tags`"
@ -172,9 +174,7 @@ func reloadLoop(stop chan struct{}, s service.Service) {
} }
} }
return return
} case *fService != "" && runtime.GOOS == "windows":
if *fService != "" && runtime.GOOS == "windows" {
if *fConfig != "" { if *fConfig != "" {
(*svcConfig).Arguments = []string{"-config", *fConfig} (*svcConfig).Arguments = []string{"-config", *fConfig}
} }
@ -240,13 +240,13 @@ func reloadLoop(stop chan struct{}, s service.Service) {
go func() { go func() {
select { select {
case sig := <-signals: case sig := <-signals:
if sig == os.Interrupt { if sig == os.Interrupt {
close(shutdown) close(shutdown)
} }
if sig == syscall.SIGHUP { if sig == syscall.SIGHUP {
log.Printf("Reloading Telegraf config\n") log.Printf("Reloading Telegraf config\n")
<-reload <-reload
reload <- true reload <- true
close(shutdown) close(shutdown)
} }
case <-stop: case <-stop:

View File

@ -6,20 +6,25 @@ the general steps to set it up.
1. Obtain the telegraf windows distribution 1. Obtain the telegraf windows distribution
2. Create the directory `C:\Program Files\Telegraf` (if you install in a different 2. Create the directory `C:\Program Files\Telegraf` (if you install in a different
location simply specify the `-config` parameter with the desired location) location simply specify the `-config` parameter with the desired location)
3. Place the executable and the config file into `C:\Program Files\Telegraf` 3. Place the telegraf.exe and the config file into `C:\Program Files\Telegraf`
4. To install the service into the Windows Service Manager, run (as an 4. To install the service into the Windows Service Manager, run (as an
administrator): administrator):
```ps
C:\Program Files\Telegraf\telegraf.exe --service install
``` ```
> C:\Program Files\Telegraf\telegraf.exe --service install
```
5. Edit the configuration file to meet your needs 5. Edit the configuration file to meet your needs
6. To check that it works, run: 6. To check that it works, run:
```ps
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 --test
```
7. To start collecting data, run: 7. To start collecting data, run:
```ps
net start telegraf ```
> net start telegraf
``` ```
## Other supported operations ## Other supported operations

View File

@ -9,6 +9,7 @@ import (
"os" "os"
"path/filepath" "path/filepath"
"regexp" "regexp"
"runtime"
"sort" "sort"
"strings" "strings"
"time" "time"
@ -432,6 +433,9 @@ func getDefaultConfigPath() (string, error) {
envfile := os.Getenv("TELEGRAF_CONFIG_PATH") envfile := os.Getenv("TELEGRAF_CONFIG_PATH")
homefile := os.ExpandEnv("${HOME}/.telegraf/telegraf.conf") homefile := os.ExpandEnv("${HOME}/.telegraf/telegraf.conf")
etcfile := "/etc/telegraf/telegraf.conf" etcfile := "/etc/telegraf/telegraf.conf"
if runtime.GOOS == "windows" {
etcfile = `C:\Program Files\Telegraf\telegraf.conf`
}
for _, path := range []string{envfile, homefile, etcfile} { for _, path := range []string{envfile, homefile, etcfile} {
if _, err := os.Stat(path); err == nil { if _, err := os.Stat(path); err == nil {
log.Printf("Using config file: %s", path) log.Printf("Using config file: %s", path)