Skip to content

Commit 05dd36b

Browse files
committed
Update the SnmpWalk documentation.
1 parent d94fbed commit 05dd36b

File tree

1 file changed

+40
-0
lines changed

1 file changed

+40
-0
lines changed

docs/Client/SNMP-Walk.md

+40
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,7 @@ has several methods to help control various aspects of the walk.
66

77
* [Basic Use](#basic-use)
88
* [API](#api)
9+
* [getOid](#getoid)
910
* [next](#next)
1011
* [skipTo](#skipto)
1112
* [restart](#restart)
@@ -14,6 +15,9 @@ has several methods to help control various aspects of the walk.
1415
* [count](#count)
1516
* [isComplete](#iscomplete)
1617
* [hasOids](#hasoids)
18+
* [subtreeOnly](#subtreeonlybool-subtreeonly--true)
19+
* [maxRepetitions](#maxrepetitionsint-maxrepetitions)
20+
* [useGetBulk](#usegetbulkbool-usegetbulk)
1721

1822
## Basic Use
1923

@@ -44,8 +48,19 @@ while($walk->hasOids()) {
4448
echo sprintf("Walked a total of %s OIDs.", $walk->count()).PHP_EOL;
4549
```
4650

51+
By default the client will send a getBulk request if you are using SNMP v2/v3, which improves performance.
52+
4753
## API
4854

55+
### getOid
56+
57+
An alias of `next()` for getting the next OID in the walk.
58+
59+
```php
60+
$oid = $walk->getOid();
61+
echo sprintf("%s = %s", $oid->getOid(), $oid->getValue()).PHP_EOL;
62+
```
63+
4964
### next
5065

5166
Get the next OID in the walk.
@@ -152,3 +167,28 @@ Whether or not to walk only the subtree specified by the starting OID. The defau
152167
# Walk past the subtree...
153168
$walk->subtreeOnly(false);
154169
```
170+
171+
### maxRepetitions(int $maxRepetitions)
172+
173+
Specifies the maximum amount of OIDs to attempt to retrieve at a time during a getBulk request (SNMP v2/v3) during the
174+
walk. This defaults to 100. You may have to modify this depending on device behavior. The larger this is set, the faster
175+
the walk will likely complete.
176+
177+
**Note**: Per SNMP RFCs, devices are only supposed to return the max amount of OIDs that can fit within a UDP packet,
178+
regardless of how high this is set. However, not all devices seem to behave this way and may have specific maximums for
179+
this value. If you notice issues, setting this lower may help.
180+
181+
```php
182+
# Walk past the subtree...
183+
$walk->maxRepetitions(10);
184+
```
185+
186+
### useGetBulk(bool $useGetBulk)
187+
188+
Specifies whether a getBulk request should be sent for the walk. By default it will send using a getBulk request if you
189+
are using SNMP v2/v3.
190+
191+
```php
192+
# Explicitly disable getBulk requests if you want...
193+
$walk->useGetBulk(false);
194+
```

0 commit comments

Comments
 (0)