Prometheus Node Exporter磁盘问题求助:无卷信息及设备错误
Troubleshooting Node Exporter Disk Volume Issues: Missing Metrics &
node_filesystem_device_error Yep, this is a super common pain point with Node Exporter—lots of folks hit these exact issues when dealing with non-root filesystems. Let’s walk through how to fix both problems step by step:
1. Unable to Retrieve Disk Volume Information
First, let’s rule out the most common culprits:
- Check collector flags: By default, Node Exporter enables the
filesystemcollector, but it ignores certain filesystem types (liketmpfs,devtmpfs,squashfs) out of the box. If your/diruses a filesystem that’s being filtered, adjust the--collector.filesystem.ignored-fs-typesflag to exclude your filesystem type. For example, if it’sext4, update your startup command to:./node_exporter --collector.filesystem.ignored-fs-types="^(tmpfs|devtmpfs|squashfs)$" - Verify mount status: Double-check that
/dev/vdbis actually mounted at/dirusing themountcommand. If the mount is broken or incomplete, Node Exporter won’t pick up the volume. - Check permissions: The user running Node Exporter needs read access to the
/dirmount point. If you’re using a non-root user, make sure they have at leastr-xpermissions on/dir(runchmod 755 /dirif needed).
2. node_filesystem_device_error=1 for Non-Root Disks
This error almost always boils down to permissions or filesystem compatibility issues:
- Fix permissions with capabilities: If you’re running Node Exporter as a non-root user, it likely lacks the permissions to read disk metrics from
/dev/vdbor system paths like/proc/mounts. Instead of running it as root (which isn’t ideal for security), add Linux capabilities to the binary:
This gives Node Exporter the necessary permissions to access filesystem stats without full root access.sudo setcap cap_dac_read_search,cap_sys_admin+ep /path/to/node_exporter - Check mount options: If you mounted
/dev/vdbwith restrictive options likenoexec,nodev, ornosuid, these can block Node Exporter from reading critical filesystem data. Test by remounting without these options:
If the error goes away, adjust yoursudo mount -o remount,rw /dir/etc/fstabentry to remove the problematic options. - Upgrade Node Exporter: Older versions may have bugs or limited support for newer filesystem types (like XFS or Btrfs). Grab the latest stable version and try again—v1.8+ has improved filesystem handling for many edge cases.
Quick Verification Steps
After making changes:
- Restart Node Exporter to apply the new flags/capabilities.
- Run this command to check if your
/dirmetrics show up and the error is resolved:curl http://your-node-ip:9100/metrics | grep -E "(node_filesystem_size_bytes.*dir|node_filesystem_device_error.*dir)" - Check Node Exporter’s logs for any startup errors related to the filesystem collector—this can clue you in on missing permissions or unsupported types.
内容的提问来源于stack exchange,提问作者James Pei
相关产品推荐
相关产品推荐

