Set path to / if HOST_MOUNT_PREFIX matches full path (#3736)

This commit is contained in:
Daniel Nelson
2018-01-30 18:06:53 -08:00
committed by GitHub
parent 3a85e7b1f0
commit 10e51e4b49
2 changed files with 136 additions and 1 deletions

View File

@@ -2,6 +2,7 @@ package system
import (
"os"
"path/filepath"
"strings"
"github.com/influxdata/telegraf"
@@ -129,7 +130,7 @@ func (s *systemPS) DiskUsage(
continue
}
du.Path = strings.TrimPrefix(p.Mountpoint, hostMountPrefix)
du.Path = filepath.Join("/", strings.TrimPrefix(p.Mountpoint, hostMountPrefix))
du.Fstype = p.Fstype
usage = append(usage, du)
partitions = append(partitions, &p)