Skip to content

Commit

Permalink
Adding c:\program files\telegraf\telegraf.conf
Browse files Browse the repository at this point in the history
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
  • Loading branch information
sparrc committed Aug 8, 2016
1 parent 7b6713b commit 8e22526
Show file tree
Hide file tree
Showing 4 changed files with 31 additions and 33 deletions.
21 changes: 5 additions & 16 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,23 +1,11 @@
## 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

- 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
aerospike_node. Aerospike namespace measurements have been renamed to
aerospike_namespace. They will also now be tagged with the node_name
Expand Down Expand Up @@ -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
- [#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.
- [#1543](https://github.com/influxdata/telegraf/pull/1543): Official Windows service.

### Bugfixes

Expand Down
20 changes: 10 additions & 10 deletions cmd/telegraf/telegraf.go
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@ var fOutputList = flag.Bool("output-list", false,
"print available output plugins.")
var fUsage = flag.String("usage", "",
"print usage for a plugin, ie, 'telegraf -usage mysql'")
var fService = flag.String("service", "",
"operate on the service")

// Telegraf version, populated linker.
// ie, -ldflags "-X main.version=`git describe --always --tags`"
Expand Down Expand Up @@ -172,9 +174,7 @@ func reloadLoop(stop chan struct{}, s service.Service) {
}
}
return
}

if *fService != "" && runtime.GOOS == "windows" {
case *fService != "" && runtime.GOOS == "windows":
if *fConfig != "" {
(*svcConfig).Arguments = []string{"-config", *fConfig}
}
Expand Down Expand Up @@ -240,13 +240,13 @@ func reloadLoop(stop chan struct{}, s service.Service) {
go func() {
select {
case sig := <-signals:
if sig == os.Interrupt {
close(shutdown)
}
if sig == syscall.SIGHUP {
log.Printf("Reloading Telegraf config\n")
<-reload
reload <- true
if sig == os.Interrupt {
close(shutdown)
}
if sig == syscall.SIGHUP {
log.Printf("Reloading Telegraf config\n")
<-reload
reload <- true
close(shutdown)
}
case <-stop:
Expand Down
19 changes: 12 additions & 7 deletions docs/WINDOWS_SERVICE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,20 +6,25 @@ 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)
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
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
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:
```ps
net start telegraf

```
> net start telegraf
```

## Other supported operations
Expand Down
4 changes: 4 additions & 0 deletions internal/config/config.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import (
"os"
"path/filepath"
"regexp"
"runtime"
"sort"
"strings"
"time"
Expand Down Expand Up @@ -432,6 +433,9 @@ func getDefaultConfigPath() (string, error) {
envfile := os.Getenv("TELEGRAF_CONFIG_PATH")
homefile := os.ExpandEnv("${HOME}/.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} {
if _, err := os.Stat(path); err == nil {
log.Printf("Using config file: %s", path)
Expand Down

0 comments on commit 8e22526

Please sign in to comment.