pull/3216/merge
Alfredo Funicello 5 days ago committed by GitHub
commit 1f28d1265a
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
  1. 2
      collector/diskstats_linux.go
  2. 4
      collector/paths.go

@ -251,7 +251,7 @@ func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) {
}
// Only enable getting device properties from udev if the directory is readable.
if stat, err := os.Stat(*udevDataPath); err != nil || !stat.IsDir() {
if stat, err := os.Stat(udevDataFilePath("")); err != nil || !stat.IsDir() {
logger.Error("Failed to open directory, disabling udev device properties", "path", *udevDataPath)
} else {
collector.getUdevDeviceProperties = getUdevDeviceProperties

@ -42,6 +42,10 @@ func rootfsFilePath(name string) string {
}
func udevDataFilePath(name string) string {
// If rootfsPath flag is set, prepend to the udev data path
if *rootfsPath != "/" {
return filepath.Join(*rootfsPath, *udevDataPath, name)
}
return filepath.Join(*udevDataPath, name)
}

Loading…
Cancel
Save