Skip to main content

A blazingly fast and Pythonic SNMP library based on the official Net-SNMP bindings

Project description

Build Status Join the Discussions! License

Easy SNMP Logo

Artwork courtesy of Open Clip Art Library

Introduction

Easy SNMP is a fork of Net-SNMP Python Bindings that attempts to bring a more Pythonic interface to the library. Check out the Net-SNMP website for more information about SNMP.

This module provides a full-featured SNMP client API and supports all dialects of the SNMP protocol.

Why Another Library?

  • The original Net-SNMP Python library is a great starting point but is quite un-Pythonic and lacks proper unit tests and documentation.

  • PySNMP is entirely written in Python and therefore has a huge performance hit. In some brief tests, I estimate that both the Net-SNMP Python bindings and Easy SNMP are more than 4 times faster than PySNMP. Further to this, PySNMP has an even less Pythonic interface than the official Net-SNMP bindings.

  • Many other libraries like Snimpy are sadly based on PySNMP, so they also suffer performance penalty.

Quick Start

There are primarily two ways you can use the Easy SNMP library:

1. By using a Session object which is most suitable when you want to request multiple pieces of SNMP data from a source:

from easysnmp import Session

# Create an SNMP session to be used for all our requests
session = Session(hostname='localhost', community='public', version=2)

# You may retrieve an individual OID using an SNMP GET
location = session.get('sysLocation.0')

# You may also specify the OID as a tuple (name, index)
# Note: the index is specified as a string as it can be of other types than
# just a regular integer
contact = session.get(('sysContact', '0'))

# And of course, you may use the numeric OID too
description = session.get('.1.3.6.1.2.1.1.1.0')

# Set a variable using an SNMP SET
session.set('sysLocation.0', 'The SNMP Lab')

# Perform an SNMP walk
system_items = session.walk('system')

# Each returned item can be used normally as its related type (str or int)
# but also has several extended attributes with SNMP-specific information
for item in system_items:
    print '{oid}.{oid_index} {snmp_type} = {value}'.format(
        oid=item.oid,
        oid_index=item.oid_index,
        snmp_type=item.snmp_type,
        value=item.value
    )

2. By using Easy SNMP via its simple interface which is intended for one-off operations (where you wish to specify all details in the request):

from easysnmp import snmp_get, snmp_set, snmp_walk

# Grab a single piece of information using an SNMP GET
snmp_get('sysDescr.0', hostname='localhost', community='public', version=1)

# Perform an SNMP SET to update data
snmp_set(
    'sysLocation.0', 'My Cool Place',
    hostname='localhost', community='public', version=1
)

# Perform an SNMP walk
snmp_walk('system', hostname='localhost', community='public', version=1)

Documentation

Please check out the Easy SNMP documentation at Read the Docs. This includes installation instructions for various operating systems.

You may generate the documentation as follows:

# Install Sphinx
pip install sphinx

# You may optionally export the READTHEDOCS environment variable to build docs
# on systems where you haven't built the C interface
export READTHEDOCS=1

# Build the documentation into static HTML pages
cd docs
make html

Acknowledgments

I’d like to say thanks to the following folks who have made this project possible:

  • Giovanni Marzot: the original author

  • ScienceLogic, LLC: sponsored the initial development of this module

  • Wes Hardaker and the net-snmp-coders: for their hard work and dedication

  • fgimian and nnathan: the original contributors to this codebase

Running Tests

You may run the unit tests as follows:

git clone https://github.com/fgimian/painter.git
cd painter
python setup.py test

License

Easy SNMP is released under the BSD license. Please see the LICENSE file for more details.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

easysnmp-0.2.6a1.tar.gz (178.3 kB view details)

Uploaded Source

Built Distributions

If you're not sure about the file name format, learn more about wheel file names.

easysnmp-0.2.6a1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl (1.5 MB view details)

Uploaded PyPymacOS 10.9+ x86-64

easysnmp-0.2.6a1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl (1.5 MB view details)

Uploaded PyPymacOS 10.9+ x86-64

easysnmp-0.2.6a1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl (1.5 MB view details)

Uploaded PyPymacOS 10.9+ x86-64

easysnmp-0.2.6a1-cp310-cp310-manylinux_2_24_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.10manylinux: glibc 2.24+ x86-64

easysnmp-0.2.6a1-cp310-cp310-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.10macOS 10.9+ x86-64

easysnmp-0.2.6a1-cp39-cp39-manylinux_2_24_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.9manylinux: glibc 2.24+ x86-64

easysnmp-0.2.6a1-cp39-cp39-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.9macOS 10.9+ x86-64

easysnmp-0.2.6a1-cp38-cp38-manylinux_2_24_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.8manylinux: glibc 2.24+ x86-64

easysnmp-0.2.6a1-cp38-cp38-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.8macOS 10.9+ x86-64

easysnmp-0.2.6a1-cp37-cp37m-manylinux_2_24_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.7mmanylinux: glibc 2.24+ x86-64

easysnmp-0.2.6a1-cp37-cp37m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.7mmacOS 10.9+ x86-64

easysnmp-0.2.6a1-cp36-cp36m-manylinux_2_24_x86_64.whl (1.5 MB view details)

Uploaded CPython 3.6mmanylinux: glibc 2.24+ x86-64

easysnmp-0.2.6a1-cp36-cp36m-macosx_10_9_x86_64.whl (1.4 MB view details)

Uploaded CPython 3.6mmacOS 10.9+ x86-64

File details

Details for the file easysnmp-0.2.6a1.tar.gz.

File metadata

  • Download URL: easysnmp-0.2.6a1.tar.gz
  • Upload date:
  • Size: 178.3 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.0 CPython/3.10.1

File hashes

Hashes for easysnmp-0.2.6a1.tar.gz
Algorithm Hash digest
SHA256 2ad2551bb81a5237b4ab48bc5091171754ddbaf8a89f0c9d57e7b88ecec80a77
MD5 3f20c1c5cc7e95def0e6bc3325f64443
BLAKE2b-256 c0843f38ac5f490888ef94a7d335edfaabd9d586e21a1ea14f420623eab7bc5f

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 5de5adda90b25aede956abca4979560c19dd5ae03682f7c650e74dee29b57195
MD5 3c2f40a4f0cdbf386ae0a61252fca4bf
BLAKE2b-256 79c225324830c479c69e34e580edd3e7a359dbc4904ce3b9d18b9b7f3c7e532a

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 80b644e25716457a7af17e382dfdd96cb2e39ffdd9d9b49dbfb5e61f94927e53
MD5 7be14eafb10d9abb98cae2e7c5ed4433
BLAKE2b-256 1e84442e10b84e34fcf4290901b5f8cf7026595143553ce76754b4edbbd570e8

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 1662c53b0d1f6d6bcf00ae4610ba6cb8e87fe4cfa9c7f7b5e05ba3991cee640b
MD5 d42575f2c9913a6c70b18b272a31277d
BLAKE2b-256 11c9151be36bcea3c4caba3e3ddcf6c4ac2821e60ae3514e3c7246f74f1fc1af

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp310-cp310-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 7607d44c7bf809dd689ead7db8adcdc44dcd0c744dac28c32e17afb997d41056
MD5 a16c45b3dec2211df15b35ac443e378f
BLAKE2b-256 40194e366694ac24fb37648b0537cf96562e485d592ca378df8cea51d4185aa8

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp310-cp310-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 c052a6ca8e2f2054ad7067eac3dcb42990d20245c5efafca468caaa8254ff4eb
MD5 a756c8a86303f242381db9d4231d0207
BLAKE2b-256 828eedf45f59774985a1bbdf8d685ec9bf005bbf679ff8b22b8cae70ece906e6

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp39-cp39-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 1b506b6872c581d48fc8806326df57213532fe857d7d3a454e89ac81c1e3d0db
MD5 c17b8a94d7b52873453f87f8979fafe5
BLAKE2b-256 497b6031af4864f63ba5bf79bb0c724c857b2c7a5bff215e0e3b7e075e615547

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp39-cp39-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 772224a75e364bc5c69b37a95f4396dc7d15d357f56f4044a0dd8c4a153f8122
MD5 741788b21979073f89629cc775169345
BLAKE2b-256 39ccf9cbf7f3248d0bd69d7a77b4fa597c22ddc929197a5698fb656ba1385f0e

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp38-cp38-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 d1c83c84f7934f4967e247e808a6e20dc0f54550a8f7dab3a70cffd15e4eddd7
MD5 51ba0c8d7f64ada54401e8e5cecce984
BLAKE2b-256 55df8a99e06d11a271acd7c742011cbf019ec5f3f7b9fcd0a787cd42810afd2c

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp38-cp38-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 0b6d499c0174208aa518c6dc6b6fd53ce12738555baa966be5fcee506cf2461c
MD5 dd1cefb938de0453529fde9d9720b7dc
BLAKE2b-256 0e986bec618e2ebba265017f5598bf90851926640f31f2bfee364e2160b8bb27

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp37-cp37m-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 711cf92e3c7410a0fa3dc5f61d87b9a06d0590bbf9f05e2cfb8b6cdde1096b94
MD5 45ad738370fc35d329ef4749ead7898b
BLAKE2b-256 51dec281a81a992f495e48474ebca4d63534d214cc261a15d59787cff8aaced0

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp37-cp37m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e55b9ad286089ab295d493e1a126251e418b5633d66c750f6695cc70264c6980
MD5 28945c6fd6ce5c98c2e7750adae991e1
BLAKE2b-256 0d950463ad2cb087d2f58fc189ff608a5baf258b4dc6c61013dde449f6a81af8

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp36-cp36m-manylinux_2_24_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp36-cp36m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 535ac102a3cab4038cf26a90771af5b6c37bd0fa0bc38945e6e45ed5484f7808
MD5 b0cb13e0fbe16c5734efeeb2985c34b1
BLAKE2b-256 5f4a70b6260a0c9a69febe28c819668b3ddb55fefb9006e5e8f8703d92dba877

See more details on using hashes here.

File details

Details for the file easysnmp-0.2.6a1-cp36-cp36m-macosx_10_9_x86_64.whl.

File metadata

File hashes

Hashes for easysnmp-0.2.6a1-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 2f7ea81ace9a5602eb660da3fa94290d52059ff329e10ee2417fd7d4ac5ee5c8
MD5 75296eee1229dd44de70721db532af30
BLAKE2b-256 3d31a76684db4569b494980819dfce31aeccc6e41388b81707b09aaebc7041ee

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page