php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #38516 functions snmpgetnext and snmp2_getnext do not work
Submitted: 2006-08-20 03:08 UTC Modified: 2011-03-20 22:19 UTC
From: larryjadams at comcast dot net Assigned:
Status: Closed Package: SNMP related
PHP Version: 5.1.5 OS: Win32
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: larryjadams at comcast dot net
New email:
PHP Version: OS:

 

 [2006-08-20 03:08 UTC] larryjadams at comcast dot net
Description:
------------
The snmpgetnext function does not work in the PHP distributions.  This has been an issue for a while, but I am just getting around to publishing the bug.  Sorry...

Reproduce code:
---------------
<?php
print snmp2_getnext("localhost","pubilc",".1.3.6.1.2");
?>

or 

<?php
print snmpgetnext("localhost","pubilc",".1.3.6.1.2");
?>


Expected result:
----------------
If you run the following command:

snmpgetnext -v 1 -c public localhost you would get

.1.3.6.1.2.1.1.1.0 = STRING: Hardware: x86 Family 6 Model 13 Stepping 8 AT/AT COMPATIBLE - Software: Windows 2000 Versio
n 5.1 (Build 2600 Uniprocessor Free)

Actual result:
--------------
Warning: snmp2_getnext(): No response from localhost in C:\test.php on line 2

Patches

Pull Requests

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2006-08-23 12:27 UTC] metaur at telia dot com
Wrong community string? (One of your examples say "public" and the other says "pubilc".)

// Ulf H?rnhammar
 [2006-08-23 15:18 UTC] larryjadams at comcast dot net
You are right, daddy needs a new pair of glasses.  However, if you set the OID string to "", it still fails, while, if you run the following command from the command line it will still work:

snmpgetnext -c public -v 1 localhost

The php_snmp requires the OID to be something other than a blank string.
 [2006-08-23 15:39 UTC] larryjadams at comcast dot net
Tony,

How bout I send you a fix.  I can do that much np.  I could also send you the fix to build net-snmp for windows rather than ucd-snmp if you like.
 [2006-08-23 17:05 UTC] tony2001@php.net
What fix are you talking about?
Please explain first what do you think is wrong and how to reproduce it.
 [2006-08-23 17:33 UTC] larryjadams at comcast dot net
Sorry Tony, the OID should be optional in this call.  If it is found to be blank, the function should behave like net-snmp's getnext when it is called without an OID, which is to return the first OID from the entire tree, typically sysDescr.

Today it is not optional and fails when left to a blank string.
 [2011-02-21 21:23 UTC] jani@php.net
-Package: Feature/Change Request +Package: SNMP related
 [2011-03-20 15:24 UTC] ch at lathspell dot de
At least it works as supposed on Linux with Net-SNMP and PHP-5.3.6...

 $ php -r 'print_r(snmpwalkoid("localhost", "public", ""));' | head
 Array
 ( 
    [SNMPv2-MIB::sysDescr.0] => STRING: Linux james 2.6.37-2-amd64 #1 SMP Sun  Feb 27 10:12:22 UTC 2011 x86_64
     [SNMPv2-MIB::sysObjectID.0] => OID: NET-SNMP-MIB::netSnmpAgentOIDs.10
     ...
 [2011-03-20 22:19 UTC] larryjadams at comcast dot net
-Status: Open +Status: Closed
 [2011-03-20 22:19 UTC] larryjadams at comcast dot net
Not a problem.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Dec 21 11:01:30 2024 UTC