File: index.rst

package info (click to toggle)
snimpy 0.8.3-1
  • links: PTS, VCS
  • area: main
  • in suites: jessie, jessie-kfreebsd
  • size: 484 kB
  • ctags: 435
  • sloc: python: 3,361; makefile: 6
file content (66 lines) | stat: -rw-r--r-- 2,139 bytes parent folder | download | duplicates (2)
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
54
55
56
57
58
59
60
61
62
63
64
65
66
Snimpy: interactive SNMP tool
====================================================

*Snimpy* is a Python-based tool providing a simple interface to build
SNMP query. Here is a very simplistic example that allows us to
display the routing table of a given host::

    load("IP-FORWARD-MIB")
    m=M("localhost", "public", 2)
    routes = m.ipCidrRouteNextHop
    for x in routes:
        net, netmask, tos, src = x
        print("%15s/%-15s via %-15s src %-15s" % (net, netmask, routes[x], src))

You can either use *Snimpy* interactively throught its console
(derived from Python own console or from IPython_ if available) or
write *Snimpy* scripts which are just Python scripts with some global
variables available.

.. _IPython: http://ipython.org

Why another tool?
-----------------

There are a lot of SNMP tools available but most of them have
important drawback when you need to reliably automatize operations.

`snmpget`, `snmpset` and `snmpwalk` are difficult to use in
scripts. Errors are printed on standard output and there is no easy
way to tell if the command was successful or not. Moreover, results
can be multiline (a long HexString for example). At least,
automatisation is done through the shell and OID or bit manipulation
are quite difficult.

Net-SNMP provides officiel bindings for Perl and
Python. Unfortunately, the integration is quite poor. You don't have
an easy way to load and browse MIBs and error handling is
inexistant. For example, the Python bindings will return None for a
non-existant OID. Having to check for this on each request is quite
cumbersome.

For Python, there are other bindings. For example, pysnmp_ provides a
pure Python implementation. However, MIBs need to be
compiled. Moreover, the exposed interface is still low-level. Sending
a simple SNMP GET can either take 10 lines or one line wrapped into 10
lines.

.. _pysnmp: http://pysnmp.sourceforge.net/

The two main points of *Snimpy* are:

* very high-level interface
* raise exceptions when something goes wrong

Contents:
---------

.. toctree::
   :maxdepth: 1

   installation
   usage
   api
   contributing
   license
   history