note 32229 deleted from function.snmpwalk by sniper

From: Date: Thu, 24 Jul 2003 12:33:30 +0000
Subject: note 32229 deleted from function.snmpwalk by sniper
References: 1  Groups: php.notes 
Request: Send a blank email to php-notes+get-52563@lists.php.net to get a copy of this message
Note Submitter: tony@uwood.net ---- I upgraded to net-snmp-5.0.6 and php 4.3.1 and had major league problems with my snmp. 1. snmpgets and walks started returning as "INTEGER: 1" or "STRING: POS2/0" and such in stead of just the value. snmp_set_quick_print(1) cured this problem. 2.snmpwalk no longer supported the "interfaces.ifTable.ifEntry.ifDescr" string format for the string object_id. I used snmpbulkwalk from the commandline to see what the new way was. "snmpbulkwalk -v2c -c public 1.2.3.4" IF-MIB::ifDescr.1 = STRING: POS2/0 IF-MIB::ifDescr.2 = STRING: FastEthernet0/0 IF-MIB::ifDescr.3 = STRING: GigabitEthernet1/0 IF-MIB::ifDescr.4 = STRING: Ethernet4/0 ... /********old code for snmpwalk of ifDescr**********/ <?php $ifDesc = snmpwalk("1.2.3.4", "public", "interfaces.ifTable.ifEntry.ifDescr"); for ($i = 0; $i < count($ifDesc); ++$i) { print "$ifDesc[$i]\n"; } ?> /*end old*/ /********new code for snmpwalk of ifDescr**********/ <?php snmp_set_quick_print(1); //prevent "STRING: " output $host = "1.2.3.4"; $community = "public"; $ifDesc = snmpwalk($host, $community, "IF-MIB::ifDescr"); for ($i = 0; $i < count($ifDesc); ++$i) { print "$ifDesc[$i]\n"; } ?> /*end new*/

« previous php.notes (#52563) next »