summaryrefslogtreecommitdiff
path: root/docs/source/quick-start.rst
blob: 8bcf6bb8db8e53dc1b528f9576bc11aa2b3f348e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53

Quick start
===========

.. toctree::
   :maxdepth: 2

Once you downloaded and installed PySNMP library on your Linux/Windows/OS-X
system, you should be able to solve the very basic SNMP task right from 
your Python prompt - fetch some data from a remote SNMP Agent (you'd need 
at least version 4.3.0 to run code from this page).

Fetch SNMP variable
-------------------

So just cut&paste the following code right into your Python prompt. The 
code will performs SNMP GET operation for a sysDescr.0 object at a 
publically available SNMP Agent at **demo.snmplabs.com**:

.. literalinclude:: /../../examples/v3arch/asyncore/oneliner/manager/cmdgen/get-v1.py
   :start-after: """#
   :language: python

:download:`Download</../../examples/v3arch/asyncore/oneliner/manager/cmdgen/get-v1.py>` script.

If everything works as it should you will get:

.. code-block:: python

   ...
   SNMPv2-MIB::sysDescr."0" = SunOS zeus.snmplabs.com 4.1.3_U1 1 sun4m
   >>> 

on your console.

Send SNMP TRAP
--------------

To send a trivial TRAP message to your local Notification Receiver
just cut&paste the following code into your interactive Python session:

.. literalinclude:: /../../examples/v3arch/asyncore/oneliner/agent/ntforg/trap-v2c-with-mib-lookup.py
   :start-after: """#
   :language: python

:download:`Download</../../examples/v3arch/asyncore/oneliner/agent/ntforg/trap-v2c-with-mib-lookup.py>` script.

For more sophisticated examples and uses cases please refer to the examples 
and documentation pages.