Edit report at https://bugs.php.net/bug.php?id=40816&edit=1
ID: 40816
Updated by: lytboris@php.net
Reported by: ch at westend dot com
Summary: Add "snmptranslate" function
-Status: Assigned
+Status: Feedback
Type: Feature/Change Request
Package: SNMP related
Operating System: linux
PHP Version: 5.2.1
Assigned To: lytboris
Block user comment: N
Private report: N
New Comment:
Indeed. Commited sources into PHP_5_4 branch.
Previous Comments:
------------------------------------------------------------------------
[2011-08-30 09:52:01] ch at westend dot com
As of SVN revision 315762 from now, the constant only appears in the tests, not in the class source.
Running the tests yield to:
Fatal error: Undefined class constant 'ERRNO_OID_PARSING_ERROR' in
/home/chammers/workspace/php-src-5.4/ext/snmp/tests/snmp-object-errno-errstr.php on line 45
Maybe it's not yet committet?
------------------------------------------------------------------------
[2011-08-30 09:42:08] lytboris@php.net
Please check that you have ERRNO_OID_PARSING_ERROR in snmp extension sources. This constant appeared
on 27th of august.
------------------------------------------------------------------------
[2011-08-30 09:21:17] ch at westend dot com
The idea sounds good but it does not seem to work. The "Invalid object identifier" is
thrown only as PHP Warning, not set in SNMP->error:
$ cat test.php
<?php
$snmp = new SNMP(SNMP::VERSION_1, 'localhost', 'public', 0, 0);
$oid1 = 'IF-MIB::ifAlias.1';
$oid2 = 'DOES-NOT-EXIST-MIB::FOO';
$oid3 = 'NOTIFICATION-LOG-MIB::nlmConfigGlobalEntryLimit.0';
$snmp->get(array($oid1, $oid2, $oid3));
printf("-------\n%s (%d)\n--------\n", $snmp->getError(), $snmp->errno);
$ ../php-src-5.4/sapi/cli/php -d include_path=.:/usr/share/php test.php
Warning: SNMP::get(): Invalid object identifier: DOES-NOT-EXIST-MIB::FOO in
/home/chammers/workspace/php_test/test.php on line 8
-------
(0)
--------
------------------------------------------------------------------------
[2011-08-27 08:54:31] lytboris@php.net
Please try using this snapshot:
http://snaps.php.net/php5.4-latest.tar.gz
For Windows:
http://windows.php.net/snapshots/
Please try another approach: all methods that performs remote agent query raise $object->errno ==
SNMP::ERRNO_OID_PARSING_ERROR even before query itself, indicating that some of OID (and/or type for
set method) was not parsed correctly.
Since OO API allows to set multiple OID on single method call this should help.
Mind that OID parsing is made in chunks with length of $object->max_oids.
Thus if you supply array of OIDs that is bigger than $object->max_oids and bogus OID will be in
the end of array, this error will be raised *after* processing (e.g. making query) the first part.
------------------------------------------------------------------------
[2007-03-15 11:05:51] ch at westend dot com
Description:
------------
Hello
Please make a PHP pendant to /usr/bin/snmptranslate. It's handy
to check if all MIBs are installed so that the program does not
crash somewhere after already having set the first X OIDs and then
encountering one untranslatable.
bye,
-christian-
Reproduce code:
---------------
-
Expected result:
----------------
-
Actual result:
--------------
-
------------------------------------------------------------------------
--
Edit this bug report at https://bugs.php.net/bug.php?id=40816&edit=1