My mistake, sorry about that, it was tough to track down support for Net::SNMP and I thought I had the right mailing list.
Thanks! -john ---- Original message ---- >Date: Tue, 26 Jan 2010 21:04:14 -0500 >From: max.schub...@gmail.com (on behalf of Max <perld...@webwizarddesign.com>) >Subject: Re: Net::SNMP usage >To: John Fulton <jful...@arctic.net> >Cc: net-snmp-users@lists.sourceforge.net > >Hi John, > >Wrong list, Net::SNMP is not associated with the Net-SNMP project, >though Net::SNMP works very well with the Net-SNMP agent. > >See the perldoc for Net::SNMP, it explains clearly how to access >variables in the returned hash. > >I use Net::SNMP extensively, if you have problems after reading the >perldoc for Net::SNMP and looking at the examples that come with the >module I would be glad to answer you off list. > >- Max > >On Tue, Jan 26, 2010 at 7:42 PM, John Fulton <jful...@arctic.net> wrote: >> I have several monitoring scripts that pull SNMP stats off of switches and >> routers that I have used for the past 10 years using perl by running snmpget >> and parsing the program output into variables: >> >> Ex: >> === >> open(GETIN, "/usr/bin/snmpget -Oqf -v2c -c public 192.168.1.20 >> interfaces.ifTable.ifEntry.ifInOctets.1 |"); >> (@temp) = split(/\s+/, <GETIN>); >> $inBytes = $temp[$#temp]; >> === >> >> Pretty rough, but it's worked for us for over 10 years. >> >> I have decided to torture myself by learning to use Net::SNMP instead of >> modifying our older scripts for pulling stats off of some of our newer >> equipment. >> >> The purpose is to create a comma delimited file of statistics from these >> devices (satellite modems). I have created the array of OID values to >> retrieve, and have pulling the info from the device, but have hit a bit of a >> roadblock in my understanding on parsing the output to get the returned >> values. >> >> Here is what I have sofar: >> ------------------------------------------------- >> #!/usr/bin/perl >> >> use Net::SNMP; >> >> $SNMP_COMMUNITY = "public"; >> $SNMP_VERSION = "2"; >> >> $VSAT_ANCH_IP = "172.16.0.40"; >> >> @VSAT_ANCH_OID = ('1.3.6.1.4.1.2591.26.1.8.1.1.8.1.1', #CA Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.3.1', #UN Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.3.2', #GA Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.3.4', #CB Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.3.5', #SG Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.4.1', #SP Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.4.2', #KC Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.4.3', #NO Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.4.4', #FY Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.4.5', #SA Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.4.6', #AN Rx >> '1.3.6.1.4.1.2591.26.1.8.1.1.8.4.7', #IL Rx >> '1.3.6.1.4.1.2591.26.1.1.3.0'); #Tx Power Level >> >> ($session, $error) = Net::SNMP->session( >> -hostname => $VSAT_ANCH_IP, >> -version => $SNMP_VERSION, >> -community => $SNMP_COMMUNITY, >> ); >> >> >> $VSAT_ANCH = $session->get_request(-varbindlist => \...@vsat_anch_oid, >> ); >> >> snmp_dispatcher(); >> >> $session->close(); >> ------------------------------------------------- >> Each of those OID values should return an integer value from 10000 to -2500. >> >> I do not quite understand how to access the returned results in $VSAT_ANCH >> as what I see in the variable is "HASH(0x9c75270)" when referenced. >> >> Thanks for any help in pointing me in the right direction. >> >> -John Fulton >> >> >> ------------------------------------------------------------------------------ >> The Planet: dedicated and managed hosting, cloud storage, colocation >> Stay online with enterprise data centers and the best network in the business >> Choose flexible plans and management services without long-term contracts >> Personal 24x7 support from experience hosting pros just a phone call away. >> http://p.sf.net/sfu/theplanet-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 >> ------------------------------------------------------------------------------ The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away. http://p.sf.net/sfu/theplanet-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