All Projects → etingof → Pysnmp

etingof / Pysnmp

Licence: bsd-2-clause
Python SNMP library

Programming Languages

python
139335 projects - #7 most used programming language

Labels

Projects that are alternatives of or similar to Pysnmp

snmp notifier
A webhook to relay Prometheus alerts as SNMP traps, because sometimes, you have to deal with legacy
Stars: ✭ 33 (-91.56%)
Mutual labels:  snmp
noc
Official read only mirror for
Stars: ✭ 84 (-78.52%)
Mutual labels:  snmp
influx snmp
SNMP Data Collection and Analytics with the TICK Stack (Telegraf, InfluxDB, Chronograf and Kapacitor)
Stars: ✭ 28 (-92.84%)
Mutual labels:  snmp
Cocoa-Printer-Server
Make your USB Printers to IP Printers.
Stars: ✭ 22 (-94.37%)
Mutual labels:  snmp
gondul
Network management/monitoring system specialized for temporary events
Stars: ✭ 40 (-89.77%)
Mutual labels:  snmp
scotty
A Tcl extension for building network management (SNMP, ICMP, UDP, DNS) applications
Stars: ✭ 29 (-92.58%)
Mutual labels:  snmp
fapro
Fake Protocol Server
Stars: ✭ 1,338 (+242.2%)
Mutual labels:  snmp
Ipt Netflow
Netflow iptables module for Linux kernel (official)
Stars: ✭ 357 (-8.7%)
Mutual labels:  snmp
dnms
Another network monitoring app built with nodejs.
Stars: ✭ 18 (-95.4%)
Mutual labels:  snmp
hnmp
High-level Python SNMP library
Stars: ✭ 44 (-88.75%)
Mutual labels:  snmp
zabbix-templates
Zabbix templates
Stars: ✭ 104 (-73.4%)
Mutual labels:  snmp
snmp-formula
docs.saltstack.com/en/latest/topics/development/conventions/formulas.html
Stars: ✭ 16 (-95.91%)
Mutual labels:  snmp
tnm4j
A simplified SNMP API for Java, based on Jürgen Schönwälder's Tnm extension for Tcl.
Stars: ✭ 34 (-91.3%)
Mutual labels:  snmp
snmp-elixir
An SNMP client library for Elixir
Stars: ✭ 27 (-93.09%)
Mutual labels:  snmp
ruby-netsnmp
SNMP library in ruby (v1, v2c, v3)
Stars: ✭ 31 (-92.07%)
Mutual labels:  snmp
GPONMonitor
GPON Monitoring tool for Dasan Networks GPON OLTs
Stars: ✭ 26 (-93.35%)
Mutual labels:  snmp
tdm
Telemetry Data Mapper to ease data discovery, correlation, and usage with YANG, MIBs, etc.
Stars: ✭ 33 (-91.56%)
Mutual labels:  snmp
Python code samples network
A collection of Python Code Samples for Network Management. Includes samples to run on-box and off-box.
Stars: ✭ 384 (-1.79%)
Mutual labels:  snmp
Pandorafms
Pandora FMS is a flexible and highly scalable monitoring system ready for big environments. It uses agents (Linux, Windows, AIX, HP-UX, Solaris and BSD systems) and can do both local and remote network monitoring (SNMP v3, TCP checks, WMI, etc).
Stars: ✭ 311 (-20.46%)
Mutual labels:  snmp
rabe-zabbix
Collection of various Zabbix templates and helper scripts created or used by Radio Bern RaBe
Stars: ✭ 93 (-76.21%)
Mutual labels:  snmp

SNMP library for Python

PyPI Python Versions GitHub license Build status Downloads

This is a pure-Python, open source and free implementation of v1/v2c/v3 SNMP engine distributed under 2-clause BSD license.

The PySNMP project was initially sponsored by a PSF grant. Thank you!

Features

  • Complete SNMPv1/v2c and SNMPv3 support
  • SMI framework for resolving MIB information and implementing SMI Managed Objects
  • Complete SNMP entity implementation
  • USM Extended Security Options support (3DES, 192/256-bit AES encryption)
  • Extensible network transports framework (UDP/IPv4, UDP/IPv6)
  • Asynchronous socket-based IO API support
  • Twisted, Asyncio and Trollius integration
  • PySMI integration for dynamic MIB compilation
  • Built-in instrumentation exposing protocol engine operations
  • Python eggs and py2exe friendly
  • 100% Python, works with Python 2.6 though 3.7
  • MT-safe (if SnmpEngine is thread-local)

Features, specific to SNMPv3 model include:

  • USM authentication (MD5/SHA-1/SHA-2) and privacy (DES/AES) protocols (RFC3414, RFC7860)
  • View-based access control to use with any SNMP model (RFC3415)
  • Built-in SNMP proxy PDU converter for building multi-lingual SNMP entities (RFC2576)
  • Remote SNMP engine configuration
  • Optional SNMP engine discovery
  • Shipped with standard SNMP applications (RC3413)

Download & Install

The PySNMP software is freely available for download from PyPI and GitHub.

Just run:

$ pip install pysnmp

to download and install PySNMP along with its dependencies:

  • PyASN1
  • PySMI (required for MIB services only)
  • Optional pysnmpcrypto package whenever strong SNMPv3 encryption is desired

Besides the library, command-line SNMP utilities written in pure-Python could be installed via:

$ pip install snmpclitools

and used in the very similar manner as conventional Net-SNMP tools:

$ snmpget.py -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 demo.snmplabs.com sysDescr.0
SNMPv2-MIB::sysDescr.0 = STRING: Linux zeus 4.8.6.5-smp #2 SMP Sun Nov 13 14:58:11 CDT 2016 i686

Examples

PySNMP is designed in a layered fashion. Top-level and easiest to use API is known as hlapi. Here's a quick example on how to SNMP GET:

from pysnmp.hlapi import *

iterator = getCmd(SnmpEngine(),
                  CommunityData('public'),
                  UdpTransportTarget(('demo.snmplabs.com', 161)),
                  ContextData(),
                  ObjectType(ObjectIdentity('SNMPv2-MIB', 'sysDescr', 0)))

errorIndication, errorStatus, errorIndex, varBinds = next(iterator)

if errorIndication:  # SNMP engine errors
    print(errorIndication)
else:
    if errorStatus:  # SNMP agent errors
        print('%s at %s' % (errorStatus.prettyPrint(), varBinds[int(errorIndex)-1] if errorIndex else '?'))
    else:
        for varBind in varBinds:  # SNMP response contents
            print(' = '.join([x.prettyPrint() for x in varBind]))

This is how to send SNMP TRAP:

from pysnmp.hlapi import *

errorIndication, errorStatus, errorIndex, varBinds = next(
    sendNotification(
        SnmpEngine(OctetString(hexValue='8000000001020304')),
        UsmUserData('usr-sha-aes128', 'authkey1', 'privkey1',
                    authProtocol=USM_AUTH_HMAC96_SHA,
                    privProtocol=USM_PRIV_CFB128_AES),
        UdpTransportTarget(('demo.snmplabs.com', 162)),
        ContextData(),
        'trap',
        NotificationType(ObjectIdentity('SNMPv2-MIB', 'authenticationFailure'))
    )
)

if errorIndication:
    print(errorIndication)

We maintain publicly available SNMP Agent and TRAP sink at demo.snmplabs.com. You are welcome to use it while experimenting with whatever SNMP software you deal with.

$ python3 examples/hlapi/asyncore/sync/manager/cmdgen/usm-sha-aes128.py
SNMPv2-MIB::sysDescr.0 = SunOS zeus.snmplabs.com 4.1.3_U1 1 sun4m
$
$ python3 examples//hlapi/asyncore/sync/agent/ntforg/v3-inform.py
SNMPv2-MIB::sysUpTime.0 = 0
SNMPv2-MIB::snmpTrapOID.0 = SNMPv2-MIB::warmStart
SNMPv2-MIB::sysName.0 = system name

Other than that, PySNMP is capable to automatically fetch and use required MIBs from HTTP, FTP sites or local directories. You could configure any MIB source available to you (including this one) for that purpose.

For more example scripts please refer to examples section at pysnmp web site.

Documentation

Library documentation and examples can be found at the pysnmp project site.

If something does not work as expected, please open an issue at GitHub or post your question on Stack Overflow or try browsing pysnmp mailing list archives.

Bug reports and PRs are appreciated! ;-)

Copyright (c) 2005-2019, Ilya Etingof. All rights reserved.

Note that the project description data, including the texts, logos, images, and/or trademarks, for each open source project belongs to its rightful owner. If you wish to add or remove any projects, please contact us at [email protected].