[racktables-users] Re: Chassi ID / Serial number

Hi today I found a bug with this patch of mine.

If the switch does not support the OID you get an error message like this
one:

Warning: snmpget() [function.snmpget]: Error in packet: (noSuchName) There
is no such variable name in this MIB. in /var/www/racktables/inc/snmp.php
on line 96
Warning: snmpget() [function.snmpget]: This name does not exist:
SNMPv2-SMI::enterprises.9.3.6.3.0 in /var/www/racktables/inc/snmp.php on
line 96
Warning: Cannot modify header information - headers already sent by (output
started at /var/www/racktables/inc/snmp.php:96) in
/var/www/racktables/process.php on line 30

Easy enough to fix
Instead of using
$sysChassi = snmpget ($endpoints[0], $community, '1.3.6.1.4.1.9.3.6.3.0');
just use
$sysChassi = snmp2_get ($endpoints[0], $community,
'1.3.6.1.4.1.9.3.6.3.0');

Seems to be some problem with the snmpget function.

gretz Killsystem
On Tue, 20 May 2008 18:47:52 +0400, Denis Ovsienko <pilot@xxxxxxxxxx>
wrote:
>> Since I love the SNMP port finder feature I want to contribute this
>> piece of code.
>> It get the chassi id from the switch and modifies the "OEM S/N 1"
>> value. This should work with mostly every Cisco switch.
> 
> Hello.
> 
> I have merged this patch into SVN, it will be available in the next
> release.
> 
> Thank you!
> 
>
96c96
<       $sysChassi = snmpget ($endpoints[0], $community, 
'1.3.6.1.4.1.9.3.6.3.0');
---
>       $sysChassi = snmp2_get ($endpoints[0], $community, 
> '1.3.6.1.4.1.9.3.6.3.0');

Other related posts: