Skip to main content

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

Project description

Python Code Style 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

Tests use Pytest. You can run them with the following:

git clone https://github.com/easysnmp/easysnmp.git
cd easysnmp
pip install pytest
pytest

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.6.tar.gz (43.0 kB view details)

Uploaded Source

Built Distributions

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

Uploaded PyPy macOS 10.9+ x86-64

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

Uploaded PyPy macOS 10.9+ x86-64

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

Uploaded PyPy macOS 10.9+ x86-64

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

Uploaded CPython 3.10 manylinux: glibc 2.24+ x86-64

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

Uploaded CPython 3.10 macOS 10.9+ x86-64

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

Uploaded CPython 3.9 manylinux: glibc 2.24+ x86-64

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

Uploaded CPython 3.9 macOS 10.9+ x86-64

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

Uploaded CPython 3.8 manylinux: glibc 2.24+ x86-64

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

Uploaded CPython 3.8 macOS 10.9+ x86-64

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

Uploaded CPython 3.7m manylinux: glibc 2.24+ x86-64

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

Uploaded CPython 3.7m macOS 10.9+ x86-64

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

Uploaded CPython 3.6m manylinux: glibc 2.24+ x86-64

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

Uploaded CPython 3.6m macOS 10.9+ x86-64

File details

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

File metadata

  • Download URL: easysnmp-0.2.6.tar.gz
  • Upload date:
  • Size: 43.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.1 CPython/3.9.13

File hashes

Hashes for easysnmp-0.2.6.tar.gz
Algorithm Hash digest
SHA256 8326df1bc8d9cdb29e3e43d55d56cb24c0d98f6997a7a1571f32815e8bdfef15
MD5 dfa90969d1a44cc02b62106ff5ba51b8
BLAKE2b-256 21d16681212ad035c6421f529bbbea52330c4575979f5eea5e8aad6eb54bf45d

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-pp39-pypy39_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 9fc6dee930f31d34cf37153dccc2df343afc3aaa2cd35bf0d54250f61b6f7d96
MD5 241399d6286de4c90919a9133bff4997
BLAKE2b-256 4634f9f548c4b32d1b1861a7437e67f9039fec88ceb7b74c0ca0cc1540329b4c

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-pp38-pypy38_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a57b2fe7c8f49b0bacb12214f0fb952ffed4a40326faa30dc417f04a68d2fb2d
MD5 e9ef26443c0246016ae469f436d19cd7
BLAKE2b-256 a6e236d2df30665aacd87d202a7ebde435698fb2b2dd3d87e2186fb26373517e

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-pp37-pypy37_pp73-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 41273ce4e073847441eb9e9b576d3018c11916fa6ef33dbdbe995830c9711bf3
MD5 e647c5403cca70003c5a8cbfa20c9766
BLAKE2b-256 543e2df8190be076d6e1adaa150c0acc33a52b95c7597fa7332b0014f437f6ec

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp310-cp310-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 f76feb57e2649ae38ccfd5fd03d695b35734c1217151ca5d868fd0efe5849c46
MD5 4053d2584a2b50e3f2ff8b6541d82a90
BLAKE2b-256 69b31313e7366a976e4ae0ff6f7977f691f9b332fa5257278bbaabcb715222ee

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp310-cp310-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 e7a1a0f7b9672a132b22a486117781285c22faa5fe55d9a53e57ba79eb28f92e
MD5 f2cf6273513a6dfbbc2de4b983ba603a
BLAKE2b-256 dece01a6d7fa1650a37963ff933dc91b9db3d66a23c44ac74a0551e546260a43

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp39-cp39-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 6600d7be6a01e7339887e01e99651cc3654bacf5579660ad25a92f874a5c2f31
MD5 d51104f3229f7b657e78b3631835898b
BLAKE2b-256 b94c5945dacb7672df5fdf56f0f456d9ca1615352f676ee89e30fba161e090e3

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp39-cp39-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d50fe515e5f5e04967deabddf56f343727a0c223013342e9ac96db6cc36a14e1
MD5 1a46264facd7a3d329c79bcc31dd7bfc
BLAKE2b-256 d280907aaa82f3427b73064cb04b1b93040f426dd835f559f4d2ebc863c39f4a

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp38-cp38-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 081b1d11662c94a621867514c5111484039011945c83eb0b25778c3992c1fdaa
MD5 c078381fab73a6f58c1d47c84249dd8b
BLAKE2b-256 0c60f4bffda46f1f9e5b39ec7ec0e8b40e29346b78104f112d5e6ed36035f1d6

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp38-cp38-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 a2f772217278cf7e4176ae25c171f44533b5e31d8f6c88202ea99a08a806aeb7
MD5 f58c3427e3259b8561af4e2400d9dd2a
BLAKE2b-256 145369c6a1e74314665fd77081a5060a0d56b3ffce094de42ad6a49e0677b535

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp37-cp37m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e1df508e28aa055bd7deeb13394d7821b6d341a9eacce5aefbc4a8c143801ff8
MD5 3cb685d8d89cb98c2b9203ced935226d
BLAKE2b-256 d32c52923cc205b5836fb4b3f94fb50cccbc98753d59fe83562c8480dec542ce

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp37-cp37m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 d5e98cbbe57b8198c0e79cec1d6c0ef567f91375f2e720a001db8990363958d5
MD5 024a0c89a3626c0d9c1b9e99bedb68cb
BLAKE2b-256 11da539aedacf8e94cc5f6fbee9dcdb07c6fc9892fd38387cec5a507e1e4a873

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp36-cp36m-manylinux_2_24_x86_64.whl
Algorithm Hash digest
SHA256 e6a2e97cd69fdb73a92f626a56ff022f909884e65dc1958ce9d77677aa69af57
MD5 1cba628f0d2e1807abb8f563f6237c82
BLAKE2b-256 ed2f39a18f8beede767905e7d9ec421c160539e9958d897e7b69a47c6ba45c70

See more details on using hashes here.

File details

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

File metadata

File hashes

Hashes for easysnmp-0.2.6-cp36-cp36m-macosx_10_9_x86_64.whl
Algorithm Hash digest
SHA256 6eed5df81a2fff46aa8035bfdc66fda1da525e7cd7159676ab264f1ab3a55897
MD5 520e64a46fa9725065d27da9d849f6bd
BLAKE2b-256 ab6556568f386c62251dd8b83af943f5da4830fc39475eb140ec2b32cecf71d6

See more details on using hashes here.

Supported by

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