Infiniband metrics not collected if irdma kernel module is loaded
Host operating system: output of uname -a
Linux xxxxx 5.15.0-73-generic #80-Ubuntu SMP Mon May 15 15:18:26 UTC 2023 x86_64 x86_64 x86_64 GNU/Linux
node_exporter version: output of node_exporter --version
node_exporter, version 1.6.1 (branch: HEAD, revision: 4a1b77600c1873a8233f3ffb55afcedbb63b8d84)
build user: root@586879db11e5
build date: 20230717-12:10:52
go version: go1.20.6
platform: linux/amd64
tags: netgo osusergo static_build
node_exporter command line flags
/usr/local/bin/node_exporter --web.listen-address=0.0.0.0:9100 --collector.textfile.directory=/var/lib/prometheus/textfile --collector.buddyinfo --collector.processes --collector.ntp --collector.network_route
node_exporter log output
Are you running node_exporter in Docker?
No
What did you do that produced an error?
n/a
What did you expect to see?
Infiniband metrics, and node_scrape_collector_success would return 1
What did you see instead?
node_scrape_collector_success returns 0
More info
This seems like it might be a bug in the procfs package, since with irdma loaded, there are irdmaX devices in /sys/class/infiniband:
# ls -l /sys/class/infiniband/
total 0
lrwxrwxrwx 1 root root 0 Jul 25 01:25 irdma0 -> ../../devices/pci0000:80/0000:80:05.0/0000:82:00.0/infiniband/irdma0
lrwxrwxrwx 1 root root 0 Jul 25 01:25 irdma1 -> ../../devices/pci0000:80/0000:80:05.0/0000:82:00.1/infiniband/irdma1
lrwxrwxrwx 1 root root 0 Jul 25 01:25 mlx5_0 -> ../../devices/pci0000:15/0000:15:01.0/0000:16:00.0/0000:17:00.0/0000:18:00.0/infiniband/mlx5_0
lrwxrwxrwx 1 root root 0 Jul 25 01:25 mlx5_1 -> ../../devices/pci0000:24/0000:24:01.0/0000:25:00.0/0000:26:00.0/0000:27:00.0/0000:28:00.0/0000:29:00.0/infiniband/mlx5_1
Once I rmmod irdma these devices (irdma0, irdma1) no longer show up in /sys/class/infiniband, and node_exporter begins emitting infiniband metrics, and node_scrape_collector_success returns 1 as expected.
Please include log output (ideally with --log.level=debug). If there is an error occurring in the procfs package InfiniBand parser, it should bubble up and be logged by node_exporter.
I suspect it might be tripping up due to a missing board_id entry in sysfs for these irdma devices. Not all InfiniBand drivers expose a board_id, although the procfs InfiniBand parser currently assumes that they do (see https://github.com/prometheus/procfs/pull/556).
Can you please list the contents of the /sys/class/infiniband/irdma0 directory and also /sys/class/infiniband/irdma0/ports/1?
We have stumbled upon the same issue in the past weeks and we have assumed it could be linked to an old version of the exporter that we were using (1.3.1) but we have switched to the latest version recently and we have experienced the same problem.
And we have experienced that the same workaround solves the problem: once the irdma module is removed, the node exporter reports again node_infiniband_* metrics.
Host Platform
~$ uname -a
Linux (...) 4.18.0-372.32.1.el8_6.x86_64 #1 SMP Thu Oct 27 15:18:36 UTC 2022 x86_64 x86_64 x86_64 GNU/Linux
~$ cat /etc/rocky-release
Rocky Linux release 8.6 (Green Obsidian)
Node Exporter
~$ node_exporter --version
node_exporter, version 1.6.1 (branch: HEAD, revision: 4a1b77600c1873a8233f3ffb55afcedbb63b8d84)
build user: root@586879db11e5
build date: 20230717-12:10:52
go version: go1.20.6
platform: linux/amd64
tags: netgo osusergo static_build
Test
- Setup NS on a specific port to only collect IB metrics:
~$ /usr/sbin/node_exporter --web.disable-exporter-metrics --web.listen-address=":9111" --log.level=debug --collector.disable-defaults --collector.infiniband
ts=2023-08-07T07:42:38.420Z caller=node_exporter.go:180 level=info msg="Starting node_exporter" version="(version=1.6.1, branch=HEAD, revision=4a1b77600c1873a8233f3ffb55afcedbb63b8d84)"
ts=2023-08-07T07:42:38.420Z caller=node_exporter.go:181 level=info msg="Build context" build_context="(go=go1.20.6, platform=linux/amd64, user=root@586879db11e5, date=20230717-12:10:52, tags=netgo osusergo static_build)"
- Collect info from the host:
~$ curl http://lx0001.domain:9111/metrics
# HELP node_exporter_build_info A metric with a constant '1' value labeled by version, revision, branch, goversion from which node_exporter was built, and the goos and goarch for the build.
# TYPE node_exporter_build_info gauge
node_exporter_build_info{branch="HEAD",goarch="amd64",goos="linux",goversion="go1.20.6",revision="4a1b77600c1873a8233f3ffb55afcedbb63b8d84",tags="netgo osusergo static_build",version="1.6.1"} 1
# HELP node_scrape_collector_duration_seconds node_exporter: Duration of a collector scrape.
# TYPE node_scrape_collector_duration_seconds gauge
node_scrape_collector_duration_seconds{collector="infiniband"} 0.00041954
# HELP node_scrape_collector_success node_exporter: Whether a collector succeeded.
# TYPE node_scrape_collector_success gauge
node_scrape_collector_success{collector="infiniband"} 0
# HELP promhttp_metric_handler_errors_total Total number of internal errors encountered by the promhttp metric handler.
# TYPE promhttp_metric_handler_errors_total counter
promhttp_metric_handler_errors_total{cause="encoding"} 0
promhttp_metric_handler_errors_total{cause="gathering"} 0
- Node Exporter responds as follows:
ts=2023-08-07T07:42:38.421Z caller=node_exporter.go:186 level=debug msg="Go MAXPROCS" procs=1
ts=2023-08-07T07:42:38.421Z caller=node_exporter.go:110 level=info msg="Enabled collectors"
ts=2023-08-07T07:42:38.421Z caller=node_exporter.go:117 level=info collector=infiniband
ts=2023-08-07T07:42:38.427Z caller=tls_config.go:274 level=info msg="Listening on" address=0.0.0.0:9111
ts=2023-08-07T07:42:38.427Z caller=tls_config.go:277 level=info msg="TLS is disabled." http2=false address=0.0.0.0:9111
ts=2023-08-07T07:43:19.353Z caller=node_exporter.go:78 level=debug msg="collect query:" filters="unsupported value type"
ts=2023-08-07T07:43:19.353Z caller=infiniband_linux.go:119 level=debug collector=infiniband msg="infiniband statistics not found, skipping"
ts=2023-08-07T07:43:19.353Z caller=collector.go:167 level=debug msg="collector returned no data" name=infiniband duration_seconds=0.00041954 err="collector returned no data"
Content of related /sys entries
~$ ls -la /sys/class/infiniband/irdma0
lrwxrwxrwx. 1 root root 0 Jun 22 15:48 /sys/class/infiniband/irdma0 -> ../../devices/pci0000:17/0000:17:00.0/0000:18:00.0/0000:19:03.0/0000:1a:00.0/infiniband/irdma0
~$ ls -l # contents of the symlink
total 0
lrwxrwxrwx. 1 root root 0 Jul 19 11:33 device -> ../../../0000:1a:00.0
-r--r--r--. 1 root root 4096 Aug 7 11:33 fw_ver
-rw-r--r--. 1 root root 4096 Aug 7 11:33 node_desc
-r--r--r--. 1 root root 4096 Jun 22 16:51 node_guid
-r--r--r--. 1 root root 4096 Jun 22 16:52 node_type
drwxr-xr-x. 3 root root 0 Jun 22 15:48 ports
drwxr-xr-x. 2 root root 0 Aug 7 11:33 power
lrwxrwxrwx. 1 root root 0 Jul 19 14:29 subsystem -> ../../../../../../../../class/infiniband
-r--r--r--. 1 root root 4096 Jun 22 16:51 sys_image_guid
-rw-r--r--. 1 root root 4096 Jul 19 14:29 uevent
~$ ls -l /sys/class/infiniband/irdma0/ports/1/
total 0
-r--r--r--. 1 root root 4096 Aug 7 11:32 cap_mask
drwxr-xr-x. 4 root root 0 Aug 7 11:32 gid_attrs
drwxr-xr-x. 2 root root 0 Jun 22 15:48 gids
drwxr-xr-x. 2 root root 0 Aug 7 11:32 hw_counters
-r--r--r--. 1 root root 4096 Jun 22 16:51 lid
-r--r--r--. 1 root root 4096 Jun 22 16:51 lid_mask_count
-r--r--r--. 1 root root 4096 Aug 7 11:32 link_layer
-r--r--r--. 1 root root 4096 Jul 18 14:36 phys_state
-r--r--r--. 1 root root 4096 Jul 18 14:36 rate
-r--r--r--. 1 root root 4096 Aug 7 11:32 sm_lid
-r--r--r--. 1 root root 4096 Aug 7 11:32 sm_sl
-r--r--r--. 1 root root 4096 Jul 18 14:36 state
The irdma module is Intel's replacement for the legacy i40iw module, which was the iWARP driver for the Intel X722. The irdma module is a complete rewrite, which landed in mainline kernel 5.14, and which also now supports the Intel E810 (iWARP & RoCE).
The addition of the irdma module was rip-and-replace, i.e. the legacy i40iw module was immediately dropped from the kernel. The i40iw module previously exposed a board_id item in sysfs up to kernel 5.13.x, courtesy of this function in i40iw_verbs.c:
static ssize_t board_id_show(struct device *dev,
struct device_attribute *attr, char *buf)
{
return sysfs_emit(buf, "%.*s\n", 32, "I40IW Board ID");
}
static DEVICE_ATTR_RO(board_id);
The irdma module has no such equivalent function (yet). This causes the procfs infiniband collector to bail out early.
@dswarbrick Thanks for pointing it out the relationship with board_id and for the link to the issue 556 on prometheus/procfs.
Indeed, the main difference is that for our HCAs supported via mlx5_* modules, we do have board id exposed:
~$ cat /sys/class/infiniband/mlx5_0/board_id
MT_0000000222
I guess it will be necessary to patch again sysfs/class_infiniband.go on https://github.com/prometheus/procfs/.
Please include log output (ideally with
--log.level=debug). If there is an error occurring in the procfs package InfiniBand parser, it should bubble up and be logged by node_exporter.I suspect it might be tripping up due to a missing
board_identry in sysfs for these irdma devices. Not all InfiniBand drivers expose aboard_id, although the procfs InfiniBand parser currently assumes that they do (see prometheus/procfs#556).Can you please list the contents of the
/sys/class/infiniband/irdma0directory and also/sys/class/infiniband/irdma0/ports/1?
# ./node_exporter-1.6.1.linux-amd64 --collector.disable-defaults --collector.infiniband --web.listen-address=:19100 --log.level=debug
ts=2023-08-10T15:20:36.303Z caller=node_exporter.go:180 level=info msg="Starting node_exporter" version="(version=1.6.1, branch=HEAD, revision=4a1b77600c1873a8233f3ffb55afcedbb63b8d84)"
ts=2023-08-10T15:20:36.312Z caller=node_exporter.go:181 level=info msg="Build context" build_context="(go=go1.20.6, platform=linux/amd64, user=root@586879db11e5, date=20230717-12:10:52, tags=netgo osusergo static_build)"
ts=2023-08-10T15:20:36.313Z caller=node_exporter.go:183 level=warn msg="Node Exporter is running as root user. This exporter is designed to run as unprivileged user, root is not required."
ts=2023-08-10T15:20:36.313Z caller=node_exporter.go:186 level=debug msg="Go MAXPROCS" procs=1
ts=2023-08-10T15:20:36.313Z caller=node_exporter.go:110 level=info msg="Enabled collectors"
ts=2023-08-10T15:20:36.313Z caller=node_exporter.go:117 level=info collector=infiniband
ts=2023-08-10T15:20:36.320Z caller=tls_config.go:274 level=info msg="Listening on" address=0.0.0.0:19100
ts=2023-08-10T15:20:36.321Z caller=tls_config.go:277 level=info msg="TLS is disabled." http2=false address=0.0.0.0:19100
ts=2023-08-10T15:20:54.611Z caller=node_exporter.go:78 level=debug msg="collect query:" filters="unsupported value type"
ts=2023-08-10T15:20:54.616Z caller=infiniband_linux.go:119 level=debug collector=infiniband msg="infiniband statistics not found, skipping"
ts=2023-08-10T15:20:54.616Z caller=collector.go:167 level=debug msg="collector returned no data" name=infiniband duration_seconds=0.000239879 err="collector returned no data"
root@hostname:~# ls -l /sys/class/infiniband/irdma0/
total 0
lrwxrwxrwx 1 root root 0 Jul 26 23:08 device -> ../../../0000:82:00.0
-r--r--r-- 1 root root 4096 Jul 26 20:46 fw_ver
-rw-r--r-- 1 root root 4096 Aug 10 15:22 node_desc
-r--r--r-- 1 root root 4096 Jul 24 22:27 node_guid
-r--r--r-- 1 root root 4096 Jul 26 20:46 node_type
drwxr-xr-x 3 root root 0 Jul 24 22:27 ports
drwxr-xr-x 2 root root 0 Aug 10 15:22 power
lrwxrwxrwx 1 root root 0 Aug 10 15:22 subsystem -> ../../../../../../class/infiniband
-r--r--r-- 1 root root 4096 Jul 24 22:27 sys_image_guid
-rw-r--r-- 1 root root 4096 Jul 24 22:27 uevent
root@hostname:~# ls -l /sys/class/infiniband/irdma0/ports/1/
total 0
-r--r--r-- 1 root root 4096 Jul 26 20:46 cap_mask
drwxr-xr-x 2 root root 0 Aug 10 15:22 cm_rx_duplicates
drwxr-xr-x 2 root root 0 Aug 10 15:22 cm_rx_msgs
drwxr-xr-x 2 root root 0 Aug 10 15:22 cm_tx_msgs
drwxr-xr-x 2 root root 0 Aug 10 15:22 cm_tx_retries
drwxr-xr-x 4 root root 0 Aug 10 15:22 gid_attrs
drwxr-xr-x 2 root root 0 Jul 24 22:28 gids
drwxr-xr-x 2 root root 0 Aug 10 15:22 hw_counters
-r--r--r-- 1 root root 4096 Jul 24 22:28 lid
-r--r--r-- 1 root root 4096 Jul 24 22:28 lid_mask_count
-r--r--r-- 1 root root 4096 Jul 26 20:46 link_layer
-r--r--r-- 1 root root 4096 Jul 26 20:46 phys_state
drwxr-xr-x 2 root root 0 Jul 26 20:46 pkeys
-r--r--r-- 1 root root 4096 Jul 24 22:27 rate
-r--r--r-- 1 root root 4096 Jul 26 20:46 sm_lid
-r--r--r-- 1 root root 4096 Jul 26 20:46 sm_sl
-r--r--r-- 1 root root 4096 Jul 24 22:27 state
root@hostname:~#
Thank you @evandhoffman, that confirms my suspicion.