mirror of
				https://github.com/prometheus/node_exporter.git
				synced 2025-08-20 18:33:52 -07:00 
			
		
		
		
	Merge e22301c0dd into be19d537cd
				
					
				
			This commit is contained in:
		
						commit
						3c0a3d75c8
					
				| 
						 | 
					@ -260,7 +260,7 @@ func NewDiskstatsCollector(logger *slog.Logger) (Collector, error) {
 | 
				
			||||||
	}
 | 
						}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
	// Only enable getting device properties from udev if the directory is readable.
 | 
						// 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)
 | 
							logger.Error("Failed to open directory, disabling udev device properties", "path", *udevDataPath)
 | 
				
			||||||
	} else {
 | 
						} else {
 | 
				
			||||||
		collector.getUdevDeviceProperties = getUdevDeviceProperties
 | 
							collector.getUdevDeviceProperties = getUdevDeviceProperties
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -42,6 +42,10 @@ func rootfsFilePath(name string) string {
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
func udevDataFilePath(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)
 | 
						return filepath.Join(*udevDataPath, name)
 | 
				
			||||||
}
 | 
					}
 | 
				
			||||||
 | 
					
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
		Reference in a new issue