Skip Menu |

This queue is for tickets about the SNMP-Extension-PassPersist CPAN distribution.

Report information
The Basics
Id: 43579
Status: resolved
Priority: 0/
Queue: SNMP-Extension-PassPersist

People
Owner: SAPER [...] cpan.org
Requestors: ablazy [...] mte-madrid.com
Cc:
AdminCc:

Bug Information
Severity: Wishlist
Broken in: 0.03
Fixed in: 0.05



Subject: Fetch first entry bug
Hello Sébastien, I'm using your module in pass persist mode through this kind of config. pass_persist .1.3.6.1.4.1.2021.51 /etc/snmp/test.pl The tree I need to get with a walk is of kind '.1.3.6.1.4.1.2021.51.1', '.1.3.6.1.4.1.2021.51.2.1', '.1.3.6.1.4.1.2021.51.2.2', '.1.3.6.1.4.1.2021.51.4' Without any change the first OID I get with a walk to ".1.3.6.1.4.1.2021.51" is the 51.2.1 node. It should be "51.1". I corrected it changing the code block # prefix match of the requested entry $curr_entry_idx = $i - 1 if index($entries->[$i], $req_oid) >= 0 and $curr_entry_idx == -1; by # prefix match of the requested entry $curr_entry_idx = $i - 1 if index($entries->[$i], $req_oid) >= 0 and $curr_entry_idx == -1 and $i == 0; Anmyway, in my case the module should return the first entry of the sorted tree and I'm sure it could be done in the code in any other way. BR Aymeric BLAZY test.pl: #!/usr/bin/perl use strict; use warnings; use SNMP::Extension::PassPersist; my $extsnmp = SNMP::Extension::PassPersist->new( backend_collect => \&update_tree, idle_count => 10, # no more than 10 idle cycles refresh => 10, # refresh every 10 sec ); my $oid = ".1.3.6.1.4.1.2021.51."; sub update_tree { $extsnmp->add_oid_entry($oid."1", "string", "TEST"); $extsnmp->add_oid_entry($oid."2.1", "string", "2.1"); $extsnmp->add_oid_entry($oid."2.2", "string", "2.2"); $extsnmp->add_oid_entry($oid."4", "integer", 1); } # run the program $extsnmp->run;
Subject: Re: [rt.cpan.org #43579] Fetch first entry bug
Date: Wed, 25 Feb 2009 01:22:38 +0100
To: bug-SNMP-Extension-PassPersist [...] rt.cpan.org
From: Sébastien Aperghis-Tramoni <saper [...] cpan.org>
Aymeric BLAZY wrote via RT: Show quoted text
> Hello Sébastien,
Hello Aymeric, Show quoted text
> I'm using your module in pass persist mode through this kind of > config. > > pass_persist .1.3.6.1.4.1.2021.51 /etc/snmp/test.pl > > The tree I need to get with a walk is of kind > '.1.3.6.1.4.1.2021.51.1', > '.1.3.6.1.4.1.2021.51.2.1', > '.1.3.6.1.4.1.2021.51.2.2', > '.1.3.6.1.4.1.2021.51.4' > > Without any change the first OID I get with a walk to > ".1.3.6.1.4.1.2021.51" is the 51.2.1 node. It should be "51.1".
Agreed. I confirm that I can reproduce the problem with the attached example. Show quoted text
> I corrected it changing the code block > > # prefix match of the requested entry > $curr_entry_idx = $i - 1 > if index($entries->[$i], $req_oid) >= 0 and > $curr_entry_idx > == -1; > > by > > # prefix match of the requested entry > $curr_entry_idx = $i - 1 > if index($entries->[$i], $req_oid) >= 0 and > $curr_entry_idx > == -1 and $i == 0; > > Anmyway, in my case the module should return the first entry of the > sorted tree and I'm sure it could be done in the code in any other > way.
In fact, I forgot to end the loop when $curr_entry_idx is affected. Also, thank you for your example program. I'll make it a non- regression test. Thanks for using this module and reporting this bug. -- Sébastien Aperghis-Tramoni Close the world, txEn eht nepO.
RT-Send-CC: saper [...] cpan.org
Apologies for being so long before releasing the new version. SNMP::Extension::PassPersist v0.05 is now available on the CPAN. -- Close the world, txEn eht nepO.