php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #37213 snmpwalk not displaying oid
Submitted: 2006-04-26 19:33 UTC Modified: 2006-04-30 08:34 UTC
Votes:3
Avg. Score:4.7 ± 0.5
Reproduced:3 of 3 (100.0%)
Same Version:3 (100.0%)
Same OS:3 (100.0%)
From: marty at upbeatmms dot com Assigned:
Status: Not a bug Package: SNMP related
PHP Version: 5.1.2 OS: Windows 2000
Private report: No CVE-ID: None
 [2006-04-26 19:33 UTC] marty at upbeatmms dot com
Description:
------------
In the following code below the OID is not displayed - just the data.  The command line version of UCD-SNMP displays both the OID and Data. 



Reproduce code:
---------------
<?php
	snmp_set_quick_print(0);
	$a = snmpwalk("192.168.1.1", "Read",".1.3.6.1.2.1.17.4.3.1.1"); 

	foreach ($a as $val) {
  	echo "$val\n<br>";
}

?> 

Expected result:
----------------
I excpect to see both the OID and the data

Actual result:
--------------
Just the data is displayed

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-04-29 11:41 UTC] mike@php.net
What's in the array keys?
 [2006-04-29 23:36 UTC] marty at upbeatmms dot com
The array keys contain a numeric value starting at 0 that have no relevance to the OID.
 [2006-04-30 03:00 UTC] marty at upbeatmms dot com
Updated Code (still not working but displays the keys):

<?php
	snmp_set_quick_print(0);
	echo "find Mac address in above results - make note of OID<br>";
	$a = snmpwalk("192.168.1.1", "read",".1.3.6.1.2.1.17.4.3.1.1"); 
	$keys=array_keys($a);
	while (list($key, $val) = each($a))
	{
   		echo "$key => $val\n<br>";
	}
?> 

Here is the output from the code:

0 => Hex: 00 06 5B F3 A9 84 
1 => Hex: 00 08 7C EB 54 80 
2 => Hex: 00 0C 41 9B B3 31 
3 => Hex: 00 12 43 B1 13 06 
4 => Hex: 00 A0 C9 25 C8 DE 
5 => Hex: 00 D0 01 5F 54 00 
6 => Hex: 00 D0 01 75 64 00 
7 => Hex: 00 D0 01 75 A8 00 
8 => Hex: 00 D0 B7 7A 1D 9E 
9 => Hex: 00 D0 B7 94 22 5C 

==================================================

Here is the output using the snmpwalk from UCD SNMP:

.iso.3.6.1.2.1.17.4.3.1.1.0.6.91.243.169.132 =  Hex: 00 06 5B F3 A9 84
.iso.3.6.1.2.1.17.4.3.1.1.0.8.124.235.84.128 =  Hex: 00 08 7C EB 54 80
.iso.3.6.1.2.1.17.4.3.1.1.0.12.65.155.179.49 =  Hex: 00 0C 41 9B B3 31
.iso.3.6.1.2.1.17.4.3.1.1.0.18.67.177.19.6 =  Hex: 00 12 43 B1 13 06
.iso.3.6.1.2.1.17.4.3.1.1.0.160.201.37.200.222 =  Hex: 00 A0 C9 25 C8 DE
.iso.3.6.1.2.1.17.4.3.1.1.0.208.1.95.84.0 =  Hex: 00 D0 01 5F 54 00
.iso.3.6.1.2.1.17.4.3.1.1.0.208.1.117.100.0 =  Hex: 00 D0 01 75 64 00
.iso.3.6.1.2.1.17.4.3.1.1.0.208.1.117.168.0 =  Hex: 00 D0 01 75 A8 00
.iso.3.6.1.2.1.17.4.3.1.1.0.208.183.122.29.158 =  Hex: 00 D0 B7 7A 1D 9E
.iso.3.6.1.2.1.17.4.3.1.1.0.208.183.148.34.92 =  Hex: 00 D0 B7 94 22 5C

Hope the additional info will help.
 [2006-04-30 08:34 UTC] mike@php.net
RTFM: 
snmprealwalk --  Return all objects including their respective object ID within the specified one
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 18 23:01:27 2024 UTC