[ First - *please* don't mail me privately, without copying any responses to the mailing list. I don't have the time or inclination to offer private, unpaid, SNMP consultancy. Keep discussions to the list, where others can both learn and offer advice. Thanks. ]
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 >> >> > > This part I don't get. I does it matter if I put the "system" mib in the > "[]" because of the fact it will still go on after the system mib is out. Yes - because the ["system"] bit is concerned with where the walk *starts*, not where it stops. Try running this script with ["system"] and look at the first two or three lines of output. Then change the script to use ["ifTable"] and run it again. You should see that the output begins at (or shortly after) the specified point. But this is *only* concerned with the starting point. It has no effect on when the walk ends. That's covered by the next bit of my earlier response: >> 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. Note the change to the exit condition here. > So say to walk "ipAdEntAddr" to get the ip address on my computers. What I > would have to do is to look for where it start and where it ends? You would specify where it starts using $vb = new SNMP::Varbind(["ipAdEntAddr"]); You would specify where it ends by putting a suitable test in the "until" check above. > I do just the basic idea and I will problem try and rework it into a while > loop because I think it will be simply easer to look for the start and the > stop of some of the "mib" that I'm going to be using. > > Also I do plain on sharing this function when I get it done. > > Thanks for all of the help and know that this isn't like most question that > I see through this group. 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 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