RE: sysUpTimeInstance vs sysUpTime.0
> From: Peter Hicks [mailto:peter.hi...@poggs.co.uk] > Sent: Thursday, May 07, 2009 5:53 AM > DISMAN-EVENT-MIB defines sysUpTime.0 as sysUpTimeInstance, > which appears > to confuse SNMP.pm, returning a VarBind without an instance: > > $VAR1 = bless( [ > 'sysUpTimeInstance', > '', > '139192193', > 'TICKS' >], 'SNMP::Varbind' ); > > Is this intended behaviour? How should I work around it in an > application which assumes that requesting OID 'sysUpTime' and > instance 0 > will return the same OID and instance in the returned VarBind? Use numerical OIDs - they will always match. HTH, Mike -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Re: sysUpTimeInstance vs sysUpTime.0
Mike Ayers wrote: >> From: Peter Hicks [mailto:peter.hi...@poggs.co.uk] >> Sent: Thursday, May 07, 2009 5:53 AM > >> DISMAN-EVENT-MIB defines sysUpTime.0 as sysUpTimeInstance, >> which appears to confuse SNMP.pm, returning a VarBind without >> an instance... >> >> [snip] >> >> Is this intended behaviour? How should I work around it in an >> application which assumes that requesting OID 'sysUpTime' and >> instance 0 will return the same OID and instance in the returned VarBind? > > Use numerical OIDs - they will always match. Ick, that's horrendously ugly and makes code very difficult to read. What I did was to check for an instance in the returned VarBind, and if there's no instance, convert the OID to numeric format, lop off the last element (in this case, "0") and use that as the instance, then convert the OID back to text. Works like a treat and I save my full-stop key and the sanity of anyone else looking at my code :-) Peter -- Peter Hicks | e: my.n...@poggs.co.uk | g: 0x5DA31330 | w: www.poggs.com A: Because it destroys the flow of the conversation Q: Why is top-posting bad? -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Re: sysUpTimeInstance vs sysUpTime.0
2009/5/7 Peter Hicks : > What I did was to check for an instance in the returned VarBind, and if > there's no instance, convert the OID to numeric format, lop off the last > element (in this case, "0") and use that as the instance, then convert > the OID back to text. Another possibility would be to tweak the DISMAN-EVENT-MIB file, and comment out the definition of sysUpTimeInstance. It's generally recognised that this was a bad idea in the first place. Dave -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users
Re: sysUpTimeInstance vs sysUpTime.0
Dave Shield wrote: > 2009/5/7 Peter Hicks : > >> What I did was to check for an instance in the returned VarBind, and if >> there's no instance, convert the OID to numeric format, lop off the last >> element (in this case, "0") and use that as the instance, then convert >> the OID back to text. > > Another possibility would be to tweak the DISMAN-EVENT-MIB file, > and comment out the definition of sysUpTimeInstance. > > It's generally recognised that this was a bad idea in the first place. I thought about that - seriously, I did - as well as automagically unloading DISMAN-EVENT-MIB if it were loaded. I turned both options down as non-obvious requires-the-user-to-understand hacks. In case anyone's interested or wants to patch SNMP.pm: if($vb->[1] eq "") { my $numeric_oid = &SNMP::translateObj($vb->[0]); $numeric_oid =~ m/(.+)\.(\d+)/; $vb->[0] = &SNMP::translateObj($1); $vb->[1] = $2; } Peter -- Peter Hicks | e: my.n...@poggs.co.uk | g: 0x5DA31330 | w: www.poggs.com A: Because it destroys the flow of the conversation Q: Why is top-posting bad? -- The NEW KODAK i700 Series Scanners deliver under ANY circumstances! Your production scanning environment may not be a perfect world - but thanks to Kodak, there's a perfect scanner to get the job done! With the NEW KODAK i700 Series Scanner you'll get full speed at 300 dpi even with all image processing features enabled. http://p.sf.net/sfu/kodak-com ___ Net-snmp-users mailing list Net-snmp-users@lists.sourceforge.net Please see the following page to unsubscribe or change other options: https://lists.sourceforge.net/lists/listinfo/net-snmp-users