Closed simPod closed 5 years ago
You could pass a start and end OID to the walk()
method. I just realized that the current walk does not behave like the snmpwalk command. Such that it continues past the subtree like you'd expect (when specifying a start). I should probably change this behavior. You could also use the getBulk()
method of the client. I do not have getbulk worked into the walk utility yet.
I've added some additional logic for the walk helper to behave more as expected. I'll soon commit it after I look it over a bit more and add some docs. It will now stop at the end of the subtree by default. And calls to hasOids()
and isComplete()
will take the next OID in the tree into account if subtree is specified.
Added commit https://github.com/FreeDSx/SNMP/commit/e99d6bd96f79e8186cba4a26b2b956a3fecb303d. So now you should be able to do...
$walk = $snmp->walk('1.3.6.1.2.1.47.1.1.1.1.2');
...and get just that subtree. Let me know if it doesn't work as expected for you.
I have also optimized the walk component to use GetBulk requests by default if using SNMP v2/v3. This makes it way faster by default. For example, a typical complete walk at the default start OID on my machine now talks about 1.5 seconds instead of more than 2 minutes.
Closing this out. Feel free to open it again if you still have issues.
Just tested it. It seems faster than ext-snmp 🤔 Looks promising
@ChadSikorra I decided to finish the task I started but when I run
$walk = $snmp->walk('1.3.6.1.2.1.47.1.1.1.1.2');
it returns no items (count = 0). isComplete()
returns true. Any idea what am I doing wrong?
When manually querying the oid using snmpbulkwalk
it returns results.
I'm using v0.4.
What does snmbulkwalk it return in that case (ending OID)? Does a walk starting at 1.3.6.1.2.1.47.1.1.1
return the full tree?
The thing is that .1.3.6.1.2.1.47.1.1.1.1.2
is already a tree. Returns
.1.3.6.1.2.1.47.1.1.1.1.2.1
.1.3.6.1.2.1.47.1.1.1.1.2.2
.1.3.6.1.2.1.47.1.1.1.1.2.1000
etc.
.1.3.6.1.2.1.47.1.1.1.1
has the same behaviour
Any idea?
Ok sorry. I should go home today already. I just realised I can debug it :D Gimme few mins
Is there a way, how to get sub tree for lets say
1.3.6.1.2.1.47.1.1.1.1.2
? I studied the docs but couldn't find a way how to get array of sub tree results. Thanks!