#2551 Cannot get CPU utilization numbers for non-sequential CPUs

hpux
closed
None
5
2014-08-25
2014-05-27
Dave Olker
No

I am using Net-SNMP 5.7.2.1 on HP-UX 11i v3 (11.31). When I attempt to retrieve CPU utilization information either in a Virtual Partition or a physical server with hyper-threading disabled I only get utilization numbers for the first CPU core.

snmpwalk -v 2c -c public 127.0.0.1:1161 .1.3.6.1.2.1.25.3.3.1

HOST-RESOURCES-MIB::hrProcessorFrwID.196608 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrProcessorFrwID.196609 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrProcessorFrwID.196610 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrProcessorFrwID.196611 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrProcessorLoad.196608 = INTEGER: 100

This system has 4 CPU cores and all are 100% busy but only the first core reports utilization. The underlying reason is in the file:
net-snmp-5.7.2.1/agent/mibgroup/hardware/cpu/cpu_pstat.c

The code is calling pstat_getdynamic() to retrieve the number of CPU cores in the system but it then assumes the cores will be sequentially numbered. This is not always the case on HP-UX systems, both physical and virtual. On my test system these are my configured CPU cores:

mpsched -S

System Topology

Locality Domain Count: 1
Processor Count : 4

Domain: 1
Proximity SPU set 0:
Socket 1 : [0] [10] [12] [14]

The CPU cores on my system are numbered 0, 10, 12, 14 but the SNMP code expects them to be numbered 0,1,2,3.

One possible solution would be to use the pstat_getprocessor() call to instantiate the actual processors on the system. I have attached a modified version of the cpu_pstat.c code that calls pstat_getprocessor(). Using this modified code I get the expected output:

snmpwalk -v 2c -c public 127.0.0.1:1161 .1.3.6.1.2.1.25.3.3.1

HOST-RESOURCES-MIB::hrProcessorFrwID.196608 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrProcessorFrwID.196609 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrProcessorFrwID.196610 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrProcessorFrwID.196611 = OID: SNMPv2-SMI::zeroDotZero
HOST-RESOURCES-MIB::hrProcessorLoad.196608 = INTEGER: 100
HOST-RESOURCES-MIB::hrProcessorLoad.196609 = INTEGER: 100
HOST-RESOURCES-MIB::hrProcessorLoad.196610 = INTEGER: 100
HOST-RESOURCES-MIB::hrProcessorLoad.196611 = INTEGER: 100

Thanks for your consideration,

Dave

1 Attachments

Discussion

  • Dave Olker

    Dave Olker - 2014-05-27

    Here is another possible version of cpu_pstat.c using a slightly different logic. I'm submitting both for your consideration.

    Dave

     
  • Niels Baggesen

    Niels Baggesen - 2014-06-30
    • assigned_to: Niels Baggesen
    • Group: 64-bit --> hpux
     
  • Niels Baggesen

    Niels Baggesen - 2014-06-30

    I like the _jk version the best, so I am going to apply that.

    Thank for the patch!

     
  • Niels Baggesen

    Niels Baggesen - 2014-06-30
    • status: open --> closed
     
  • Dave Olker

    Dave Olker - 2014-06-30

    Thanks Niels. Can you tell me what the process is to get an official patched version with the code change? How often does your team release new versions? How will I know when the change is rolled into a new version?

    Thanks!

     

Get latest updates about Open Source Projects, Conferences and News.

Sign up for the SourceForge newsletter:





No, thanks