#34910 [Opn->Fbk]: snmp does not parse OID with string index
ID: 34910
Updated by: sniper@php.net
Reported By: ch at westend dot com
-Status: Open
+Status: Feedback
Bug Type: SNMP related
Operating System: Debian GNU/Linux
PHP Version: 5.0.5
New Comment:
Please try using this CVS snapshot:
http://snaps.php.net/php5-latest.tar.gz
For Windows:
http://snaps.php.net/win32/php5-win32-latest.zip
Previous Comments:
------------------------------------------------------------------------
[2005-10-18 18:22:45] ch at westend dot com
Description:
------------
The SNMP function seem to not know that it is possible
to have string indices like:
$ snmpwalk -Ir myhost \
'ASCEND-MIBINET-MIB::internetProfile-Active."cir-1-26"'
which gives:
ASCEND-MIBINET-MIB::internetProfile-Active."cir-1-26" =
INTEGER: yes(2)
(keep the single and double quotes in the example!)
It seems that setting the "-Ir" flag is not possible.
Reproduce code:
---------------
$x = snmprealwalk('myhost', 'mypassword',
"ASCEND-MIBINET-MIB::internetProfile-Station");
var_export($x); print("\n");
gives:
array (
'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-2"' => 'STRING:
"bras-1-2"',
'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-3"' => 'STRING:
"bras-1-3"',
'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-4"' => 'STRING:
"bras-1-4"',
'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-48"' => 'STRING:
"bras-1-48"',
'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-5"' => 'STRING:
"bras-1-5"',
'ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-6"' => 'STRING:
"bras-1-6"',
Numerically this OID looks like:
$ snmpwalk -Ir -On myhost \
'ASCEND-MIBINET-MIB::internetProfile-Active."cir-1-26"'
.1.3.6.1.4.1.529.23.1.1.1.2.8.99.105.114.45.49.45.50.54 = INTEGER:
yes(2)
The MIB definition looks like this:
mibinternetProfileTable OBJECT-TYPE
SYNTAX SEQUENCE OF MibinternetProfileEntry
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "A list of mibinternetProfile profile
entries."
::= { mibinternetProfile 1 }
mibinternetProfileEntry OBJECT-TYPE
SYNTAX MibinternetProfileEntry
ACCESS not-accessible
STATUS mandatory
DESCRIPTION "A mibinternetProfile entry containing objects
that
maps to the parameters of mibinternetProfile
profile."
INDEX { internetProfile-Station }
::= { mibinternetProfileTable 1 }
MibinternetProfileEntry ::=
SEQUENCE {
internetProfile-Station
DisplayString,
internetProfile-Active
INTEGER,
....
internetProfile-Active OBJECT-TYPE
SYNTAX INTEGER {
no (1),
yes (2)
}
ACCESS read-write
STATUS mandatory
DESCRIPTION "A profile can be disabled by setting this
field to no. There is no difference between an inactive pr
::= { mibinternetProfileEntry 2 }
Expected result:
----------------
I would have expected to be able to use every OID that the
above snmpwalk returns. But they are claimed to be invalid.
Actual result:
--------------
Warning: snmpget(): Invalid object identifier:
ASCEND-MIBINET-MIB::internetProfile-Station."bras-1-2" in
/home/ch/t.php on line 10
------------------------------------------------------------------------
--
Edit this bug report at http://bugs.php.net/?id=34910&edit=1
Thread (6 messages)