SNMP poller oriented to poll bunch of hosts in short time. Package include poller and SNMP library
Project description
fastsnmp
SNMP poller oriented to poll bunch of hosts in short time. Package include poller and SNMP coder/encoder library.
[Reference manual] (http://fastsnmp.readthedocs.org/)
Example:
from fastsnmp import snmp_poller
hosts = ("127.0.0.1",)
# oids in group must be with same indexes
oid_group = {"1.3.6.1.2.1.2.2.1.2": "ifDescr",
"1.3.6.1.2.1.2.2.1.10": "ifInOctets",
}
community = "public"
snmp_data = snmp_poller.poller(hosts, [list(oid_group)], community)
for d in snmp_data:
print ("host=%s oid=%s.%s value=%s" % (d[0], oid_group[d[1]], d[2], d[3]))
Output:
host=127.0.0.1 oid=ifInOctets.1 value=243203744
host=127.0.0.1 oid=ifDescr.1 value=b'lo'
host=127.0.0.1 oid=ifInOctets.2 value=1397428486
host=127.0.0.1 oid=ifDescr.2 value=b'eth0'
Type conversion:
SNMP | Python |
---|---|
octetstring, ipaddress | bytes |
null | None |
objectid | str |
counter32, unsigned32, gauge32, counter64, integer | int |
noSuchInstance | None |
noSuchObject | None |
endOfMibView | None |
Notices:
- ipaddress can be converted to string using
str(ipaddress.IPv4Address(b"\x01\x01\x01\x01"))
orsocket.inet_ntoa(b"\x01\x01\x01\x01")
Another python SNMP libraries:
- PySNMP - very good SNMP library
- libsnmp - SNMP coder/decoder (abandoned project)
- Bindings to Net-SNMP
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
fastsnmp-0.13.tar.gz
(155.9 kB
view details)
File details
Details for the file fastsnmp-0.13.tar.gz
.
File metadata
- Download URL: fastsnmp-0.13.tar.gz
- Upload date:
- Size: 155.9 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/4.0.0 CPython/3.9.15
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 88381402a46e1cd58a3a57fc0079f39ad68705621772c0c70b67605217e1fb8e |
|
MD5 | 30a6e0f3e192fd0f12bde52357fe4d2c |
|
BLAKE2b-256 | 0ec7c94dac2da8db520687656c404f5c66fe9c26597a39cf53eb1a5c100692ac |