Re: Working a whole device with Net::SNMP with Perl

"Dave Shield" <[email protected]>
Newsgroups gmane.network.net-snmp.user
Message-ID <[email protected]>
2008/6/11 Thomas Bonham <[email protected]>:
> The only other big thing that I need to figure out how to do is tell it
> to just work one little part of something.  As a example just have it
> work "system"

There are two aspects to this:
  -  how to tell it where to start
  -  how to tell it where to stop


You can specify a starting point when you create the initial
Varbind object.   Instead of simply

      $vb = new SNMP::Varbind();
try
      $vb = new SNMP::Varbind(["system"]);

Telling it where to stop is handled by the termination condition
at the end of the look.  The initial code fragment I posted used

       do {
          ...
       } until ($sess->{ErrorNum});

which keeps going until it reaches the end.
Try something like:

       do {
          ...
       } until (${$vb}[0] !~ /^sys/ );

which will print the system group only.

That's not exactly right, since it will actually print
the first entry *after* the system group as well,
before realising that it should have finished.
This might be better re-worked to use a while loop
instead.
  And you might find a different test works
better for you.   But that shows the basic idea.

Dave

-------------------------------------------------------------------------
Check out the new SourceForge.net Marketplace.
It's the best place to buy or sell services for
just about anything Open Source.
http://sourceforge.net/services/buy/index.php
_______________________________________________
Net-snmp-users mailing list
[email protected]
Please see the following page to unsubscribe or change other options:
https://lists.sourceforge.net/lists/listinfo/net-snmp-users
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.