Linux, CPU metrics, count, (online/offline), ...

Started by sodalist, April 25, 2024, 04:00:34 PM

Previous topic - Next topic

sodalist

Hello,

Would it be possible to extend/add System.CPU.Count() metric provided by subagents/linux with parametrized one that would enable count of online/offline CPUs in the system.

Example system with 24 cores with 2 cores online:
...:# lscpu --online --extended
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE    MAXMHZ    MINMHZ       MHZ
 12    0      0    0 0:0:0:0          yes 3200.0000 1200.0000 1197.3630
 13    0      0    1 1:1:1:0          yes 3200.0000 1200.0000 1197.3240

...:# lscpu --offline --extended
CPU NODE SOCKET CORE L1d:L1i:L2:L3 ONLINE    MAXMHZ    MINMHZ       MHZ
  0    0      0    0 0:0:0:0           no 3200.0000 1200.0000 1197.3800
  1    0      0    1 1:1:1:0           no 3200.0000 1200.0000 1197.4100
  2    0      0    2 2:2:2:0           no 3200.0000 1200.0000 1197.3630
  3    0      0    3 3:3:3:0           no 3200.0000 1200.0000 1200.0000
  4    0      0    4 4:4:4:0           no 3200.0000 1200.0000 1197.8280
  5    0      0    5 5:5:5:0           no 3200.0000 1200.0000 1197.4139
  6    1      1    6 8:8:8:1           no 3200.0000 1200.0000 1197.3640
  7    1      1    7 9:9:9:1           no 3200.0000 1200.0000 1197.5330
  8    1      1    8 10:10:10:1        no 3200.0000 1200.0000 1197.4250
  9    1      1    9 11:11:11:1        no 3200.0000 1200.0000 1198.4170
 10    1      1   10 12:12:12:1        no 3200.0000 1200.0000 1197.3580
 11    1      1   11 13:13:13:1        no 3200.0000 1200.0000 1197.4180
 14    0      0    2 2:2:2:0           no 3200.0000 1200.0000 1197.5649
 15    0      0    3 3:3:3:0           no 3200.0000 1200.0000 1197.3621
 16    0      0    4 4:4:4:0           no 3200.0000 1200.0000 1200.0000
 17    0      0    5 5:5:5:0           no 3200.0000 1200.0000 1197.4301
 18    1      1    6 8:8:8:1           no 3200.0000 1200.0000 1200.0000
 19    1      1    7 9:9:9:1           no 3200.0000 1200.0000 1197.5850
 20    1      1    8 10:10:10:1        no 3200.0000 1200.0000 1197.5100
 21    1      1    9 11:11:11:1        no 3200.0000 1200.0000 1197.5310
 22    1      1   10 12:12:12:1        no 3200.0000 1200.0000 1197.5060
 23    1      1   11 13:13:13:1        no 3200.0000 1200.0000 1197.3719

Metric is provided via sysfs:

# cat /sys/devices/system/cpu/present
0-23

# cat /sys/devices/system/cpu/online
12-13

Etc:
- on this exact system System.CPU.Count will return: 14 for number of CPU's.

thank you,

Br, Ales