php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Request #37865 The SNMP extension does not support setting multiple OIDs
Submitted: 2006-06-21 00:09 UTC Modified: 2011-03-20 20:47 UTC
Votes:15
Avg. Score:4.9 ± 0.5
Reproduced:15 of 15 (100.0%)
Same Version:7 (46.7%)
Same OS:7 (46.7%)
From: lee dot duncan at intel dot com Assigned: lytboris (profile)
Status: Closed Package: SNMP related
PHP Version: 5.1.4 OS: SUSE, Kernel 2.6.8-24.21-smp
Private report: No CVE-ID: None
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
24 + 22 = ?
Subscribe to this entry?

 
 [2006-06-21 00:09 UTC] lee dot duncan at intel dot com
Description:
------------
In order to add an entry to many SNMP tables, you need to 
be able to set multiple OIDs (values) at the same time. The 
net-snmp "snmpset" command allows this, as do the 
libnetsnmp APIs, but the SNMP extension to PHP does not 
support this. 
 
I added a new function to ext/snmp.c to support setting 
multiple values at once, and I'd like to see it added to 
the PHP SNMP extension for all to use. 

Reproduce code:
---------------
Just try to set multiple SNMP OIDs (object IDs) with the current API, which is:

proto int snmp2_set(string host, string community, string object_id, string type, mixed value [, int timeout [, int retries]])

I added:

proto int snmp2_set_arr(string host, string community, array oids, array types, array values [, int timeout [, int retries]])

This way, no current programs break and new programs can use this functionality.

Expected result:
----------------
I'd like to be able to manage things like Marvell switches, 
which only allow adding a Table entry (e.g. for a new VLAN) 
if you can set multiple values (OIDs) at the same time. 

Actual result:
--------------
Right now I can't do this without hacking the PHP SNMP 
extension. 

Patches

ext_snmp_v1.0.1.patch (last revision 2010-08-11 07:59 UTC by saimoun at saimoun dot fr)
ext_snmp.patch (last revision 2010-07-28 09:55 UTC by saimoun at saimoun dot fr)

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2007-03-16 15:11 UTC] eqguy2002 at yahoo dot com
Version: 5.2.1
OS: Windows 2003

PHP's snmpset extension does not support setting multiple OIDs at once. Doing so from the command line using snmpset from Net-SNMP works fine.

I need to set multiple OIDs at once in order to manage switches
 [2008-05-21 12:21 UTC] daniel dot buschke at nextiraone dot de
Lee, would you please add an attachment with your patch? TIA
 [2009-03-17 11:59 UTC] yanirj at orckit dot com
It would be great if you post the patch.
Thanks!
 [2009-05-13 12:25 UTC] yanirj at orckit dot com
Hi,

On behalf of Lee Duncan's good will and Murali Sundar's kindess I've uploaded the patch for everyone to download.

I truly hope this will get merged into the CVS tree for everyone to enjoy.

URL: http://sphinx.not.nu/php_snmp_patch.zip

Regards,
Yanir.
 [2009-11-27 13:26 UTC] ch at lathspell dot de
The above patch URL is no longer available. Does anybody still have the patch? I could put it on my web page until somebody adds it to the PHP upstream.
 [2010-07-28 12:01 UTC] saimoun at saimoun dot fr
Hello :) 

I added my patch, it just contains a function, "snmp3_mset", which has the same prototype that snmp2_set_arr (function of eqguy2002).
For SNMP version 1 and 2 you can easily adapt source code by modifying the beginning of the function snmp3_mset.

For apply patch you need to copy patch file in root directory of all php sources, and type "patch -p0 < ext_snmp.patch" (in Unix).

Don't hesitate to mail me for any question.

Saimoun.
 [2010-08-11 10:00 UTC] saimoun at saimoun dot fr
Sorry, my patch did not work.
I add a new version, and this version works perfectly, I have made many tests on it.
 [2011-02-21 21:25 UTC] jani@php.net
-Package: Feature/Change Request +Package: SNMP related
 [2011-03-20 20:47 UTC] lytboris@php.net
-Status: Open +Status: Closed -Assigned To: +Assigned To: lytboris
 [2011-03-20 20:47 UTC] lytboris@php.net
This bug has been fixed in SVN.

Snapshots of the sources are packaged every three hours; this change
will be in the next snapshot. You can grab the snapshot at
http://snaps.php.net/.
 
Thank you for the report, and for helping us make PHP better.

fixed as a part of new OO API.
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Fri Apr 19 05:01:29 2024 UTC