From robert at robertblackwell.com Wed Jan 20 13:26:03 2010 From: robert at robertblackwell.com (Robert Blackwell) Date: Wed, 20 Jan 2010 16:26:03 -0500 Subject: [pgh-pm] Future Monger meetings Message-ID: <4B5774EB.5010301@robertblackwell.com> Hello, I have come to the conclusion I do not have time to organize future Pittsburgh Perl Monger meetings. Anyone wishing to do so good luck. Thanks Robert From casey at geeknest.com Wed Jan 20 13:28:37 2010 From: casey at geeknest.com (Casey West) Date: Wed, 20 Jan 2010 16:28:37 -0500 Subject: [pgh-pm] Future Monger meetings In-Reply-To: <4B5774EB.5010301@robertblackwell.com> References: <4B5774EB.5010301@robertblackwell.com> Message-ID: I'd like to. I'll make pgh.pm.org point to something we can use to plan meetings. Unless there are differing opinions, it's probably going to be a Wordpress blog. Let me know if you have differing opinions. Solutions will be handy as well. :-) Casey On Wed, Jan 20, 2010 at 4:26 PM, Robert Blackwell < robert at robertblackwell.com> wrote: > > Hello, > > I have come to the conclusion I do not have time to organize future > Pittsburgh Perl Monger meetings. > Anyone wishing to do so good luck. > > Thanks > Robert > _______________________________________________ > pgh-pm mailing list > pgh-pm at pm.org > http://mail.pm.org/mailman/listinfo/pgh-pm > -------------- next part -------------- An HTML attachment was scrubbed... URL: From barries at slaysys.com Thu Jan 21 13:12:47 2010 From: barries at slaysys.com (Barrie Slaymaker) Date: Thu, 21 Jan 2010 16:12:47 -0500 Subject: [pgh-pm] Future Monger meetings In-Reply-To: References: <4B5774EB.5010301@robertblackwell.com> Message-ID: <4B58C34F.4000103@slaysys.com> I can again offer our offices as a meeting place, I just need to know a month or so in advance to make sure I can be there (my wife works some evenings). - Barrie On 1/20/2010 4:28 PM, Casey West wrote: > I'd like to. I'll make pgh.pm.org point to > something we can use to plan meetings. Unless there are differing > opinions, it's probably going to be a Wordpress blog. > > Let me know if you have differing opinions. Solutions will be handy as > well. :-) > > Casey > > On Wed, Jan 20, 2010 at 4:26 PM, Robert Blackwell > > wrote: > > > Hello, > > I have come to the conclusion I do not have time to organize > future Pittsburgh Perl Monger meetings. > Anyone wishing to do so good luck. > > Thanks > Robert > _______________________________________________ > pgh-pm mailing list > pgh-pm at pm.org > http://mail.pm.org/mailman/listinfo/pgh-pm > > > > _______________________________________________ > pgh-pm mailing list > pgh-pm at pm.org > http://mail.pm.org/mailman/listinfo/pgh-pm -------------- next part -------------- An HTML attachment was scrubbed... URL: From gpitman at gmail.com Fri Jan 22 07:44:48 2010 From: gpitman at gmail.com (G.Pitman) Date: Fri, 22 Jan 2010 10:44:48 -0500 Subject: [pgh-pm] perl net snmp Message-ID: <833c3f771001220744y3478f404me153ba86f8a1e0a9@mail.gmail.com> Hi, I used to use perl a bit but I am very rusty. I am trying to walk the ifIndex portion of a cisco switch so that I can either get the last index number or build an array of index numbers to use for queries. I have tried using a get_request in a loop until I get an error but there is a break in list. When I do an snmpwalk I see index numbers from 1-105 and 154-224 with the break in the middle so my script stops at 105 indicating that it is the last. If I use get_next_request it does not error out. Can anyone guide my failing logic? --------- #!/usr/bin/perl -w use Net::SNMP; my $OID_vLanID = '1.3.6.1.2.1.2.2.1.1.'; my ($session, $error) = Net::SNMP->session( -hostname => 'SWITCH_IP', -community => 'public' ); if (!defined $session) { printf "ERROR: %s.\n", $error; exit 1; } $foundLast = 0; $item = 1; while ($foundLast != 1) { $getValue = "$OID_vLanID" . "$item"; $result = $session->get_request(-varbindlist => [ $getValue ],); if (!defined $result) { $item--; printf "ITEM is $item-- -- ERROR: %s.\n", $session->error(); $foundLast = 1; $session->close(); } else { $item++; } } print "Total: $item\n"; $session->close(); exit 0; -------------- next part -------------- An HTML attachment was scrubbed... URL: From m.nooning at comcast.net Fri Jan 22 08:21:55 2010 From: m.nooning at comcast.net (Malcolm Nooning) Date: Fri, 22 Jan 2010 11:21:55 -0500 Subject: [pgh-pm] perl net snmp In-Reply-To: <833c3f771001220744y3478f404me153ba86f8a1e0a9@mail.gmail.com> References: <833c3f771001220744y3478f404me153ba86f8a1e0a9@mail.gmail.com> Message-ID: <4B59D0A3.3050608@comcast.net> Obviously your script is letting you know when get_request returns an undefined value. If get_request is supposed to give back that undefined value when there is nothing there (i.e. when106 is hit), well, then your script is correct. If that is the case, then perhaps you may want to first decide on the full range of your possible Cisco switches to check for. Say for example, 1 to 256, and traverse all numbers until all 255 indexes have been checked. Along the way you could printf or otherwise collect only the ones whose get_request returned a defined value. I hope I understood your question correctly. G.Pitman wrote: > Hi, > I used to use perl a bit but I am very rusty. I am trying to walk the > ifIndex portion of a cisco switch so that I can either get the last > index number or build an array of index numbers to use for queries. > > I have tried using a get_request in a loop until I get an error but > there is a break in list. When I do an snmpwalk I see index numbers > from 1-105 and 154-224 with the break in the middle so my script stops > at 105 indicating that it is the last. If I use get_next_request it > does not error out. Can anyone guide my failing logic? > > --------- > > > > #!/usr/bin/perl -w > > use Net::SNMP; > my $OID_vLanID = '1.3.6.1.2.1.2.2.1.1.'; > > my ($session, $error) = Net::SNMP->session( > -hostname => 'SWITCH_IP', > -community => 'public' > ); > > if (!defined $session) { > printf "ERROR: %s.\n", $error; > exit 1; > } > $foundLast = 0; > $item = 1; > while ($foundLast != 1) > { > $getValue = "$OID_vLanID" . "$item"; > $result = $session->get_request(-varbindlist => [ $getValue ],); > if (!defined $result) > { > $item--; > printf "ITEM is $item-- -- ERROR: %s.\n", > $session->error(); > $foundLast = 1; > $session->close(); > } > else > { > $item++; > } > } > > print "Total: $item\n"; > $session->close(); > > exit 0; > ------------------------------------------------------------------------ > > _______________________________________________ > pgh-pm mailing list > pgh-pm at pm.org > http://mail.pm.org/mailman/listinfo/pgh-pm