سؤال

all. I have a question about the snmp2_real_walk.
my PHP version:PHP 5.1.6 OS: Red Hat Enterprise Linux Server release 5.5.I have a remost host with 8 core. And the localhost's machine cpu number is also 8 core.
When i use the snmpwalk command like following:

[root@webjk tmp]# snmpwalk -v 2c -c public xxx.xxx.xxx.xxx .1.3.6.1.2.1.25.3.3.1
HOST-RESOURCES-MIB::hrProcessorFrwID.768 = OID: SNMPv2-SMI::zeroDotZero  
HOST-RESOURCES-MIB::hrProcessorFrwID.769 = OID: SNMPv2-SMI::zeroDotZero  
HOST-RESOURCES-MIB::hrProcessorFrwID.770 = OID: SNMPv2-SMI::zeroDotZero  
HOST-RESOURCES-MIB::hrProcessorFrwID.771 = OID: SNMPv2-SMI::zeroDotZero  
HOST-RESOURCES-MIB::hrProcessorFrwID.772 = OID: SNMPv2-SMI::zeroDotZero  
HOST-RESOURCES-MIB::hrProcessorFrwID.773 = OID: SNMPv2-SMI::zeroDotZero  
HOST-RESOURCES-MIB::hrProcessorFrwID.774 = OID: SNMPv2-SMI::zeroDotZero   
HOST-RESOURCES-MIB::hrProcessorFrwID.775 = OID: SNMPv2-SMI::zeroDotZero  
HOST-RESOURCES-MIB::hrProcessorLoad.768 = INTEGER: 1  
HOST-RESOURCES-MIB::hrProcessorLoad.769 = INTEGER: 1  
HOST-RESOURCES-MIB::hrProcessorLoad.770 = INTEGER: 2  
HOST-RESOURCES-MIB::hrProcessorLoad.771 = INTEGER: 1  
HOST-RESOURCES-MIB::hrProcessorLoad.772 = INTEGER: 3  
HOST-RESOURCES-MIB::hrProcessorLoad.773 = INTEGER: 1  
HOST-RESOURCES-MIB::hrProcessorLoad.774 = INTEGER: 6  
HOST-RESOURCES-MIB::hrProcessorLoad.775 = INTEGER: 13  
HOST-RESOURCES-MIB::hrProcessorLoad.775 = No more variables left in this MIB View (It is past the end of the MIB tree)

Then i use the following php code:

<?php
$a=snmp2_real_walk("58.211.72.38:161", "public", ".1.3.6.1.2.1.25.3.3.1", (500 * 1000), 1);
print_r($a);
?>  

It comes with the result:

Array
(
    [HOST-RESOURCES-MIB::hrProcessorFrwID.768] => OID: SNMPv2-SMI::zeroDotZero
    [HOST-RESOURCES-MIB::hrProcessorFrwID.769] => OID: SNMPv2-SMI::zeroDotZero
    [HOST-RESOURCES-MIB::hrProcessorFrwID.770] => OID: SNMPv2-SMI::zeroDotZero
    [HOST-RESOURCES-MIB::hrProcessorFrwID.771] => OID: SNMPv2-SMI::zeroDotZero
    [HOST-RESOURCES-MIB::hrProcessorFrwID.772] => OID: SNMPv2-SMI::zeroDotZero
    [HOST-RESOURCES-MIB::hrProcessorFrwID.773] => OID: SNMPv2-SMI::zeroDotZero
    [HOST-RESOURCES-MIB::hrProcessorFrwID.774] => OID: SNMPv2-SMI::zeroDotZero
    [HOST-RESOURCES-MIB::hrProcessorFrwID.775] => OID: SNMPv2-SMI::zeroDotZero
    [HOST-RESOURCES-MIB::hrProcessorLoad.768] => INTEGER: 1
    [HOST-RESOURCES-MIB::hrProcessorLoad.769] => INTEGER: 1
    [HOST-RESOURCES-MIB::hrProcessorLoad.770] => INTEGER: 2
    [HOST-RESOURCES-MIB::hrProcessorLoad.771] => INTEGER: 1
    [HOST-RESOURCES-MIB::hrProcessorLoad.772] => INTEGER: 2
    [HOST-RESOURCES-MIB::hrProcessorLoad.773] => INTEGER: 1
    [HOST-RESOURCES-MIB::hrProcessorLoad.774] => INTEGER: 7
    [HOST-RESOURCES-MIB::hrProcessorLoad.775] => No more variables left in this MIB View (It is past the end of the MIB tree)
)  

When use snmp2_real_walk,it just find 7 cpu cores, not the snmpwalk's 8 cpu cores.But when i use the snmp2_real_walk to query localhost's cpu information or some remote host with 4 cores, it will comes the right result.
PS: i find this problem when i use the cacti 0.8.7e. I tried to use the SNMP - Get Processor Information data query to graph the 8 cores remote machine. But it only detect 7 cores. I find the cacti use the snmp2_real_walk function to get the cpu's information.

هل كانت مفيدة؟

المحلول

I have find out the problem. snmp2_real_walk need PHP >= 5.2 and my host's PHP version is 5.1.
So i upgrade the PHP and the problem solved.

مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top