Compare commits

...

7 Commits

Author SHA1 Message Date
Daniel Nelson
8385206e68 Update changelog
(cherry picked from commit 2c5a5373f6)
2017-12-01 11:42:34 -08:00
Daniel Nelson
07e268f39e Update changelog
(cherry picked from commit cabe10b88a)
2017-12-01 11:25:18 -08:00
Daniel Nelson
c095876442 Fix HOST_MOUNT_PREFIX in docker with disk input (#3529)
(cherry picked from commit 7f66863b87)
2017-12-01 11:25:03 -08:00
Daniel Nelson
809ed511dd Update changelog
(cherry picked from commit 24d82aebe6)
2017-11-29 12:12:54 -08:00
Daniel Nelson
741022b656 Update gopsutil version to include netstat fix (#3513)
(cherry picked from commit 7dc256e845)
2017-11-29 12:11:12 -08:00
Daniel Nelson
34d3bf4fa0 Update changelog
(cherry picked from commit a9ada5f65b)
2017-11-27 12:33:17 -08:00
Laurent Gosselin
700b52dbd1 Fix global variable collection when using interval_slow option in mysql input (#3500)
(cherry picked from commit f758d0c6c3)
2017-11-27 12:33:17 -08:00
6 changed files with 31 additions and 15 deletions

View File

@@ -1,5 +1,15 @@
## v1.4.5 [2017-12-01]
### Bugfixes
- [#3500](https://github.com/influxdata/telegraf/issues/3500): Fix global variable collection when using interval_slow option in mysql input.
- [#3486](https://github.com/influxdata/telegraf/issues/3486): Fix error getting net connections info in netstat input.
- [#3529](https://github.com/influxdata/telegraf/issues/3529): Fix HOST_MOUNT_PREFIX in docker with disk input.
## v1.4.4 [2017-11-08] ## v1.4.4 [2017-11-08]
### Bugfixes
- [#3401](https://github.com/influxdata/telegraf/pull/3401): Use schema specified in mqtt_consumer input. - [#3401](https://github.com/influxdata/telegraf/pull/3401): Use schema specified in mqtt_consumer input.
- [#3419](https://github.com/influxdata/telegraf/issues/3419): Redact datadog API key in log output. - [#3419](https://github.com/influxdata/telegraf/issues/3419): Redact datadog API key in log output.
- [#3311](https://github.com/influxdata/telegraf/issues/3311): Fix error getting pids in netstat input. - [#3311](https://github.com/influxdata/telegraf/issues/3311): Fix error getting pids in netstat input.

2
Godeps
View File

@@ -60,7 +60,7 @@ github.com/prometheus/procfs 1878d9fbb537119d24b21ca07effd591627cd160
github.com/rcrowley/go-metrics 1f30fe9094a513ce4c700b9a54458bbb0c96996c github.com/rcrowley/go-metrics 1f30fe9094a513ce4c700b9a54458bbb0c96996c
github.com/samuel/go-zookeeper 1d7be4effb13d2d908342d349d71a284a7542693 github.com/samuel/go-zookeeper 1d7be4effb13d2d908342d349d71a284a7542693
github.com/satori/go.uuid 5bf94b69c6b68ee1b541973bb8e1144db23a194b github.com/satori/go.uuid 5bf94b69c6b68ee1b541973bb8e1144db23a194b
github.com/shirou/gopsutil 48fc5612898a1213aa5d6a0fb2d4f7b968e898fb github.com/shirou/gopsutil 384a55110aa5ae052eb93ea94940548c1e305a99
github.com/shirou/w32 3c9377fc6748f222729a8270fe2775d149a249ad github.com/shirou/w32 3c9377fc6748f222729a8270fe2775d149a249ad
github.com/Shopify/sarama c01858abb625b73a3af51d0798e4ad42c8147093 github.com/Shopify/sarama c01858abb625b73a3af51d0798e4ad42c8147093
github.com/Sirupsen/logrus 61e43dc76f7ee59a82bdf3d71033dc12bea4c77d github.com/Sirupsen/logrus 61e43dc76f7ee59a82bdf3d71033dc12bea4c77d

View File

@@ -588,17 +588,12 @@ func (m *Mysql) gatherServer(serv string, acc telegraf.Accumulator) error {
// Global Variables may be gathered less often // Global Variables may be gathered less often
if len(m.IntervalSlow) > 0 { if len(m.IntervalSlow) > 0 {
if uint32(time.Since(lastT).Seconds()) > scanIntervalSlow { if uint32(time.Since(lastT).Seconds()) >= scanIntervalSlow {
err = m.gatherGlobalVariables(db, serv, acc) err = m.gatherGlobalVariables(db, serv, acc)
if err != nil { if err != nil {
return err return err
} }
lastT = time.Now() lastT = time.Now()
} else {
err = m.gatherGlobalVariables(db, serv, acc)
if err != nil {
return err
}
} }
} }

View File

@@ -20,9 +20,11 @@ Additionally, the behavior of resolving the `mount_points` can be configured by
When present, this variable is prepended to the mountpoints discovered by the plugin before retrieving stats. When present, this variable is prepended to the mountpoints discovered by the plugin before retrieving stats.
The prefix is stripped from the reported `path` in the measurement. The prefix is stripped from the reported `path` in the measurement.
This settings is useful when running `telegraf` inside a docker container to report host machine metrics. This settings is useful when running `telegraf` inside a docker container to report host machine metrics.
In this case, the host's root volume should be mounted into the container and the `HOST_MOUNT_PREFIX` and `HOST_ETC` environment variables set. In this case, the host's root volume should be mounted into the container and the `HOST_MOUNT_PREFIX` and `HOST_PROC` environment variables set.
`docker run -v /:/hostfs:ro -e HOST_MOUNT_PREFIX=/hostfs -e HOST_ETC=/hostfs/etc telegraf-docker` ```
docker run -v /:/hostfs:ro -e HOST_MOUNT_PREFIX=/hostfs -e HOST_PROC=/hostfs/proc telegraf
```
### Measurements & Fields: ### Measurements & Fields:

View File

@@ -62,8 +62,6 @@ func TestDiskUsage(t *testing.T) {
mps.On("Partitions", true).Return(psAll, nil) mps.On("Partitions", true).Return(psAll, nil)
mps.On("OSGetenv", "HOST_MOUNT_PREFIX").Return("") mps.On("OSGetenv", "HOST_MOUNT_PREFIX").Return("")
mps.On("OSStat", "/").Return(MockFileInfo{}, nil)
mps.On("OSStat", "/home").Return(MockFileInfo{}, nil)
mps.On("PSDiskUsage", "/").Return(&duAll[0], nil) mps.On("PSDiskUsage", "/").Return(&duAll[0], nil)
mps.On("PSDiskUsage", "/home").Return(&duAll[1], nil) mps.On("PSDiskUsage", "/home").Return(&duAll[1], nil)

View File

@@ -2,6 +2,7 @@ package system
import ( import (
"os" "os"
"strings"
"github.com/influxdata/telegraf" "github.com/influxdata/telegraf"
"github.com/influxdata/telegraf/internal" "github.com/influxdata/telegraf/internal"
@@ -84,9 +85,14 @@ func (s *systemPS) DiskUsage(
for _, filter := range fstypeExclude { for _, filter := range fstypeExclude {
fstypeExcludeSet[filter] = true fstypeExcludeSet[filter] = true
} }
paths := make(map[string]bool)
for _, part := range parts {
paths[part.Mountpoint] = true
}
var usage []*disk.UsageStat var usage []*disk.UsageStat
var partitions []*disk.PartitionStat var partitions []*disk.PartitionStat
hostMountPrefix := s.OSGetenv("HOST_MOUNT_PREFIX")
for i := range parts { for i := range parts {
p := parts[i] p := parts[i]
@@ -105,15 +111,20 @@ func (s *systemPS) DiskUsage(
continue continue
} }
mountpoint := s.OSGetenv("HOST_MOUNT_PREFIX") + p.Mountpoint // If there's a host mount prefix, exclude any paths which conflict
if _, err := s.OSStat(mountpoint); err != nil { // with the prefix.
if len(hostMountPrefix) > 0 &&
!strings.HasPrefix(p.Mountpoint, hostMountPrefix) &&
paths[hostMountPrefix+p.Mountpoint] {
continue continue
} }
du, err := s.PSDiskUsage(mountpoint)
du, err := s.PSDiskUsage(p.Mountpoint)
if err != nil { if err != nil {
continue continue
} }
du.Path = p.Mountpoint
du.Path = strings.TrimPrefix(p.Mountpoint, hostMountPrefix)
du.Fstype = p.Fstype du.Fstype = p.Fstype
usage = append(usage, du) usage = append(usage, du)
partitions = append(partitions, &p) partitions = append(partitions, &p)