Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

Net::SNMP method efficiency

by LazerRed (Pilgrim)
on Jul 22, 2003 at 01:56 UTC ( #276559=perlquestion: print w/ replies, xml ) Need Help??
LazerRed has asked for the wisdom of the Perl Monks concerning the following question:

I have a question about the module Net::SNMP (4.0.3). I'm currently using this module to query a compaq server, to gather temperature metrics from it's various onboard thermoresistors. Below is my current method:

foreach my $probe ( 1 .. $probe_count ) { my $location = "$thermbase.1.3.0.$probe"; my $temp = "$thermbase.1.4.0.$probe"; my $thresh = "$thermbase.1.5.0.$probe"; my $cond = "$thermbase.1.6.0.$probe"; my $result = $session->get_request( -varbindlist => [ $location, $temp, $thresh, $cond ] ); if ( !defined($result) ) { printf( "ERROR: %s.\n", $session->error ); $session->close; return; }

This loops $probe_count times, and pushes the results onto an array later in the script. I'm only grabbing 4 things out of a table that has 8 objects. My question is, Would it be more efficient to do a get_table in one go (and dig around in the returned hash), even though I do not want every piece of data in that table? Essentialy throwing out half the data I collect?

LR

Whip me, Beat me, Make me use Y-ModemG.

Comment on Net::SNMP method efficiency
Select or Download Code
Re: Net::SNMP method efficiency
by bobn (Chaplain) on Jul 22, 2003 at 02:08 UTC

    It' not more efficient for the hardware or the network. When you walk an SNMP table, you do it by retriving the first value, then sending a get_next over and over until a value is received that isn't in the table. So however many entries are in the table, you've sent that many requests and received that many responses.

    Update: If your're using other than v1 of SNMP, what I sadi above may be untrue.

    --Bob Niederman, http://bob-n.com

      true, unless you can use SNMPv2/3 bulk(get/walk) commands, then you just might get them in all in one packet. or at least get N values per packet vs 1 value per packet.

        oops, found out the same thing, updated before seeing your response.

        Unfortunately, most implmentations are v1, so far as I know. The standards never coalesced and the vendors sat out the battle.

        --Bob Niederman, http://bob-n.com

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://276559]
Approved by The Mad Hatter
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others lurking in the Monastery: (4)
As of 2014-10-26 08:50 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    For retirement, I am banking on:










    Results (152 votes), past polls