php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #32074 OID's missing from PHP snmpwalk compared with command line snmpwalk
Submitted: 2005-02-23 04:38 UTC Modified: 2005-03-20 18:09 UTC
Votes:2
Avg. Score:5.0 ± 0.0
Reproduced:1 of 2 (50.0%)
Same Version:0 (0.0%)
Same OS:1 (100.0%)
From: Gregg dot Nelson at Co dot Ramsey dot MN dot US Assigned:
Status: No Feedback Package: SNMP related
PHP Version: 5.0.3 OS: ReHat 9.0
Private report: No CVE-ID: None
View Developer Edit
Welcome! If you don't have a Git account, you can't do anything here.
If you reported this bug, you can edit this bug over here.
(description)
Block user comment
Status: Assign to:
Package:
Bug Type:
Summary:
From: Gregg dot Nelson at Co dot Ramsey dot MN dot US
New email:
PHP Version: OS:

 

 [2005-02-23 04:38 UTC] Gregg dot Nelson at Co dot Ramsey dot MN dot US
Description:
------------
Running:

	PHP-5.0.3
	Net-SNMP-5.2.1
	Apache-(httpd-2.0.530)

PHP config Line

./configure --with-apxs2=/usr/local/apache2/bin/apxs --with-snmp

No changes to php.ini
-----------------------------------------------------------------------

Executing snmpwalk from command line (RH Linux 9) produces different
results from snmpwalk called from php.

I have a Cisco 6509 configured for Server Load Balancing.
The MIB tree for this starts at OID .1.3.6.1.4.1.9.9.161

With the following command from the Linux shell I get the folowing results:
---------------------------------------------------------------------------
 snmpwalk -v2c -crmsy 192.168.108.254 .1.3.6.1.4.1.9.9.161

SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.2.0 = Counter32: 49602212
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.3.0 = Counter64: 49602212
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.4.0 = Counter32: 2776480
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.5.0 = Counter64: 2776480
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.6.0 = Counter32: 26014
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.7.0 = Counter64: 26014
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.8.0 = Counter32: 26013
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.9.0 = Counter64: 26013
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.10.0 = Counter32: 26014
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.11.0 = Counter64: 26014
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.12.0 = Counter32: 6
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.13.0 = Counter64: 6
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.14.0 = Counter32: 0
SNMPv2-SMI::enterprises.9.9.161.1.1.1.1.15.0 = Counter64: 0
SNMPv2-SMI::enterprises.9.9.161.1.2.1.1.2.0.8.67.65.70.69.84.69.83.84 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.161.1.2.1.1.3.0.8.67.65.70.69.84.69.83.84 = INTEGER: 3
SNMPv2-SMI::enterprises.9.9.161.1.2.1.1.4.0.8.67.65.70.69.84.69.83.84 = Gauge32: 2
SNMPv2-SMI::enterprises.9.9.161.1.2.1.1.5.0.8.67.65.70.69.84.69.83.84 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.2.1.1.6.0.8.67.65.70.69.84.69.83.84 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.4.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = INTEGER: 2
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.4.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = INTEGER: 2
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.5.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.5.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.6.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.6.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.7.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 4294967295
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.7.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 4294967295
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.8.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 8
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.8.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 8
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.9.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 8
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.9.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 8
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.10.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.10.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.11.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 1
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.11.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 1
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.12.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = INTEGER: 360
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.12.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = INTEGER: 360
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.13.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 1
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.13.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 1
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.14.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 1
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.14.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 1
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.15.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.15.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.16.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Counter32: 5
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.16.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Counter32: 2
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.17.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.17.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.18.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Counter32: 12890
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.18.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Counter32: 13123
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.19.0.8.67.65.70.69.84.69.83.84.192.168.110.15.0 = Counter64: 12890
SNMPv2-SMI::enterprises.9.9.161.1.3.1.1.19.0.8.67.65.70.69.84.69.83.84.192.168.110.46.0 = Counter64: 13123
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.2.0.10.72.83.67.65.70.69.84.69.83.84 = INTEGER: 2
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.3.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 7
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.4.0.10.72.83.67.65.70.69.84.69.83.84 = IpAddress: 192.168.110.110
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.5.0.10.72.83.67.65.70.69.84.69.83.84 = INTEGER: 80
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.6.0.10.72.83.67.65.70.69.84.69.83.84 = INTEGER: 6
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.7.0.10.72.83.67.65.70.69.84.69.83.84 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.8.0.10.72.83.67.65.70.69.84.69.83.84 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.9.0.10.72.83.67.65.70.69.84.69.83.84 = STRING: "CAFETEST"
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.10.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 10
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.11.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 3600
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.12.0.10.72.83.67.65.70.69.84.69.83.84 = INTEGER: 0
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.13.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.14.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.15.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 10
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.11.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 3600
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.12.0.10.72.83.67.65.70.69.84.69.83.84 = INTEGER: 0
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.13.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.14.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.15.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.16.0.10.72.83.67.65.70.69.84.69.83.84 = INTEGER: 1
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.17.0.10.72.83.67.65.70.69.84.69.83.84 = Gauge32: 0
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.18.0.10.72.83.67.65.70.69.84.69.83.84 = Counter32: 26014
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.19.0.10.72.83.67.65.70.69.84.69.83.84 = Counter64: 26014
SNMPv2-SMI::enterprises.9.9.161.1.4.1.1.20.0.10.72.83.67.65.70.69.84.69.83.84 = IpAddress: 255.255.255.255
SNMPv2-SMI::enterprises.9.9.161.1.8.1.0 = INTEGER: 2
SNMPv2-SMI::enterprises.9.9.161.1.8.2.0 = INTEGER: 2
-----------------------------------------------------------------------------------


Running the following php script produces the following results.

<html><head><title> SLB info</title></head><body>
<?php
$a = snmpwalk("192.168.108.254", "rmsy", ".1.3.6.1.4.1.9.9.161");
for ($i=0; $i < count($a); $i++) {echo " {$a[$i]}<br />";}
?>
</body></html>

-----------------------------------------------------------------------------------
Counter32: 49609797
Counter32: 2776670
Counter32: 26014
Counter32: 26013
Counter32: 26014
Counter32: 6
Counter32: 0
INTEGER: 1
INTEGER: 3
Gauge32: 2
Gauge32: 0
INTEGER: 1
INTEGER: 2
INTEGER: 2
Gauge32: 0
Gauge32: 0
Gauge32: 0
Gauge32: 0
Gauge32: 4294967295
Gauge32: 4294967295
Gauge32: 8
Gauge32: 8
Gauge32: 8
Gauge32: 8
Gauge32: 0
Gauge32: 0
Gauge32: 1
Gauge32: 1
INTEGER: 360
INTEGER: 360
Gauge32: 1
Gauge32: 1
Gauge32: 1
Gauge32: 1
Gauge32: 0
Gauge32: 0
Counter32: 5
Counter32: 2
INTEGER: 1
INTEGER: 1
Counter32: 12890
Counter32: 13123
INTEGER: 2
Gauge32: 7
IpAddress: 192.168.110.110
INTEGER: 80
INTEGER: 6
INTEGER: 1
INTEGER: 1
STRING: "CAFETEST"
Gauge32: 10
Gauge32: 3600
INTEGER: 0
Gauge32: 0
Gauge32: 0
Gauge32: 0
INTEGER: 1
Gauge32: 0
Counter32: 26014
IpAddress: 255.255.255.255
INTEGER: 2
INTEGER: 2
------------------------------------------------------------------------------------------

Most of the indexed items are missing from the output. I believe this is because 
the php snmpwalk function does not actually call snmpwalk. It uses a combination
of snmpget and snmpgetnext calls which do not visit every branch in the MIB tree.

Because the indexes are part of the OID field the output of snmpget and snmpgetnext
calls are missing vital information.

I would suggest the php snmpwalk function be coded to call the actual snmpwalk routine. 
There would then be no need for the snmprealwalk and snmpwalkoid functions.

Reproduce code:
---------------
command line call:
---------------------------------------------------------
snmpwalk -v2c -crmsy 192.168.108.254 .1.3.6.1.4.1.9.9.161


php script:
---------------------------------------------------------
<html><head><title> SLB info</title></head><body>
<?php
$a = snmpwalk("192.168.108.254", "rmsy", ".1.3.6.1.4.1.9.9.161");
for ($i=0; $i < count($a); $i++) {echo " {$a[$i]}<br />";}
?>
</body></html>



Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2005-02-23 21:18 UTC] Gregg dot Nelson at Co dot Ramsey dot MN dot US
The following bash script shows that snmpwalk and snmpget/getnext produce the same number of lines and output
when called from the command line....

#!/bin/bash
#
#       Compare snmpwalk and snmpget/getnext output. 
#
#set -vx
        walkoid="SNMPv2-SMI::enterprises.9.9.161"
        lc=$(snmpwalk -v2c -crmsy 192.168.108.254 $walkoid|wc -l)
        echo snmpwalk: $lc lines.
        startmib="$walkoid.1.1.1.1.2.0"
        nextmib=$startmib
        oper="snmpget";lc=0
        while :; do
        mib=$($oper -v2c -crmsy 192.168.108.254 $nextmib)
        oper="snmpgetnext"
        if [ $(echo $mib|grep ".9.9.161"|wc -l) -eq 0 ];then break;fi
#       echo $mib
        let lc=lc+1
        nextmib=${mib%%\ =\ *}
        done
        echo snmpget/next: $lc lines.
        exit
 [2005-02-23 21:30 UTC] Gregg dot Nelson at Co dot Ramsey dot MN dot US
After a more careful comparison of the command line snmpwalk and the PHP snmpwalk it appears the items missing from the PHP snmpwalk are the Counter64 items.
 [2005-03-20 18:09 UTC] sniper@php.net
No feedback was provided. The bug is being suspended because
we assume that you are no longer experiencing the problem.
If this is not the case and you are able to provide the
information that was requested earlier, please do so and
change the status of the bug back to "Open". Thank you.


 [2008-07-31 01:09 UTC] carlosmeyeramor at gmail dot com
This problem is still there the snmp walk doesn't get into the sub-trees of the SNMP object structure.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC