forked from etingof/pysnmp
-
-
Notifications
You must be signed in to change notification settings - Fork 19
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
27 changed files
with
241 additions
and
80 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
docs/source/docs/hlapi/v1arch/asyncio/agent/ntforg/notification.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
TRAP/INFORM notification | ||
======================== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
.. autofunction:: pysnmp.hlapi.v1arch.asyncio.sendNotification |
8 changes: 8 additions & 0 deletions
8
docs/source/docs/hlapi/v1arch/asyncio/manager/cmdgen/bulkcmd.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
GETBULK command | ||
=============== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
.. autofunction:: pysnmp.hlapi.v1arch.asyncio.bulkCmd |
8 changes: 8 additions & 0 deletions
8
docs/source/docs/hlapi/v1arch/asyncio/manager/cmdgen/bulkwalkcmd.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
BULK WALK Operation | ||
=================== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
.. autofunction:: pysnmp.hlapi.v1arch.asyncio.bulkWalkCmd |
8 changes: 8 additions & 0 deletions
8
docs/source/docs/hlapi/v1arch/asyncio/manager/cmdgen/getcmd.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
GET command | ||
=========== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
.. autofunction:: pysnmp.hlapi.v1arch.asyncio.getCmd |
8 changes: 8 additions & 0 deletions
8
docs/source/docs/hlapi/v1arch/asyncio/manager/cmdgen/nextcmd.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
GETNEXT command | ||
=============== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
.. autofunction:: pysnmp.hlapi.v1arch.asyncio.nextCmd |
8 changes: 8 additions & 0 deletions
8
docs/source/docs/hlapi/v1arch/asyncio/manager/cmdgen/setcmd.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
|
||
SET command | ||
=========== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
.. autofunction:: pysnmp.hlapi.v1arch.asyncio.setCmd |
7 changes: 7 additions & 0 deletions
7
docs/source/docs/hlapi/v1arch/asyncio/manager/cmdgen/walkcmd.rst
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
WALK Operation | ||
============== | ||
|
||
.. toctree:: | ||
:maxdepth: 2 | ||
|
||
.. autofunction:: pysnmp.hlapi.v1arch.asyncio.walkCmd |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
examples/hlapi/v1arch/asyncio/manager/cmdgen/v1-get-slim.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
""" | ||
SNMPv1 | ||
++++++ | ||
Send SNMP GET request using the following options: | ||
* with SNMPv1, community 'public' | ||
* over IPv4/UDP | ||
* to an Agent at demo.pysnmp.com:161 | ||
* for an instance of SNMPv2-MIB::sysDescr.0 MIB object | ||
* Based on asyncio I/O framework | ||
Functionally similar to: | ||
| $ snmpget -v1 -c public demo.pysnmp.com SNMPv2-MIB::sysDescr.0 | ||
""" # | ||
import asyncio | ||
from pysnmp.hlapi.v1arch.asyncio.slim import Slim | ||
from pysnmp.smi.rfc1902 import ObjectIdentity, ObjectType | ||
|
||
|
||
async def run(): | ||
with Slim(1) as slim: | ||
errorIndication, errorStatus, errorIndex, varBinds = await slim.get( | ||
"public", | ||
"demo.pysnmp.com", | ||
161, | ||
ObjectType(ObjectIdentity("SNMPv2-MIB", "sysDescr", 0)), | ||
) | ||
|
||
if errorIndication: | ||
print(errorIndication) | ||
elif errorStatus: | ||
print( | ||
"{} at {}".format( | ||
errorStatus.prettyPrint(), | ||
errorIndex and varBinds[int(errorIndex) - 1][0] or "?", | ||
) | ||
) | ||
else: | ||
for varBind in varBinds: | ||
print(" = ".join([x.prettyPrint() for x in varBind])) | ||
|
||
|
||
asyncio.run(run()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
46 changes: 46 additions & 0 deletions
46
examples/hlapi/v1arch/asyncio/manager/cmdgen/v2c-get-slim.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
""" | ||
SNMPv2c | ||
+++++++ | ||
Send SNMP GET request using the following options: | ||
* with SNMPv2c, community 'public' | ||
* over IPv4/UDP | ||
* to an Agent at demo.pysnmp.com:161 | ||
* for an instance of SNMPv2-MIB::sysDescr.0 MIB object | ||
* Based on asyncio I/O framework | ||
Functionally similar to: | ||
| $ snmpget -v2c -c public demo.pysnmp.com SNMPv2-MIB::sysDescr.0 | ||
""" # | ||
import asyncio | ||
from pysnmp.hlapi.v1arch.asyncio.slim import Slim | ||
from pysnmp.smi.rfc1902 import ObjectIdentity, ObjectType | ||
|
||
|
||
async def run(): | ||
with Slim() as slim: | ||
errorIndication, errorStatus, errorIndex, varBinds = await slim.get( | ||
"public", | ||
"demo.pysnmp.com", | ||
161, | ||
ObjectType(ObjectIdentity("SNMPv2-MIB", "sysDescr", 0)), | ||
) | ||
|
||
if errorIndication: | ||
print(errorIndication) | ||
elif errorStatus: | ||
print( | ||
"{} at {}".format( | ||
errorStatus.prettyPrint(), | ||
errorIndex and varBinds[int(errorIndex) - 1][0] or "?", | ||
) | ||
) | ||
else: | ||
for varBind in varBinds: | ||
print(" = ".join([x.prettyPrint() for x in varBind])) | ||
|
||
|
||
asyncio.run(run()) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.