pysnmp-lextudio


Namepysnmp-lextudio JSON
Version 6.1.2 PyPI version JSON
download
home_pagehttps://github.com/lextudio/pysnmp
SummaryA Python library for SNMP
upload_time2024-03-25 06:12:53
maintainerNone
docs_urlNone
authorIlya Etingof
requires_python<4.0,>=3.7
licenseBSD-2-Clause
keywords
VCS
bugtrack_url
requirements No requirements were recorded.
Travis-CI No Travis.
coveralls test coverage No coveralls.
            
SNMP Library for Python
-----------------------

[![Become a Sponsor](https://img.shields.io/badge/Become%20a%20Sponsor-lextudio-orange.svg?style=for-readme)](https://github.com/sponsors/lextudio)
[![PyPI](https://img.shields.io/pypi/v/pysnmp-lextudio.svg)](https://pypi.python.org/pypi/pysnmp-lextudio)
[![PyPI Downloads](https://img.shields.io/pypi/dd/pysnmp-lextudio)](https://pypi.python.org/pypi/pysnmp-lextudio/)
[![Python Versions](https://img.shields.io/pypi/pyversions/pysnmp-lextudio.svg)](https://pypi.python.org/pypi/pysnmp-lextudio/)
[![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/lextudio/pysnmp/master/LICENSE.rst)

This is a pure-Python, open source and free implementation of v1/v2c/v3
SNMP engine distributed under 2-clause [BSD license](https://www.pysnmp.com/pysnmp/license.html).

The PySNMP project was initially sponsored by a [PSF](http://www.python.org/psf/) grant.
Thank you!

This repo is a fork of Ilya Etingof's project [etingof/pysnmp](https://github.com/etingof/pysnmp), but [LeXtudio Inc. is taking over the entire PySNMP ecosystem](https://github.com/etingof/pysnmp/issues/429), including the library, documentation, and the website.

Ilya sadly passed away on 10-Aug-2022. Announcement [here](https://lists.openstack.org/pipermail/openstack-discuss/2022-August/030062.html).  His work is still of great use to the Python community and he will be missed.

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
* [Asyncio](https://docs.python.org/3/library/asyncio.html) integration
* [PySMI](https://www.pysnmp.com/pysmi/) integration for dynamic MIB compilation
* Built-in instrumentation exposing protocol engine operations
* Python eggs and py2exe friendly
* 100% Python, works with Python 3.8+
* 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 (RFC3413)

Download & Install
------------------

The PySNMP software is freely available for download from [PyPI](https://pypi.python.org/pypi/pysnmp-lextudio)
and [GitHub](https://github.com/lextudio/pysnmp.git).

Just run:

```bash
$ pip install pysnmp-lextudio
```

To download and install PySNMP along with its dependencies:

<!-- Need to find an alternate location for the links to pysnmp.com -->
* [PyASN1](https://pyasn1.readthedocs.io)
* [PySMI](https://www.pysnmp.com/pysmi/) (required for MIB services only)
* Optional [pysnmpcrypto](https://github.com/etingof/pysnmpcrypto) package
  whenever strong SNMPv3 encryption is desired

Besides the library, command-line [SNMP utilities](https://github.com/lextudio/snmpclitools)
written in pure-Python could be installed via:

```bash
$ pip install snmpclitools-lextudio
```

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

```bash
$ snmpget.py -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 demo.pysnmp.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:

```python
from pysnmp.hlapi import *
from pysnmp.smi.rfc1902 import ObjectIdentity, ObjectType

with Slim(1) as slim:
    errorIndication, errorStatus, errorIndex, varBinds = slim.get(
        'public',
        'demo.pysnmp.com',
        161,
        ObjectType(ObjectIdentity("SNMPv2-MIB", "sysDescr", 0)),
    )

    if errorIndication:
        print(errorIndication)
    elif errorStatus:
        print(
            "{} at {}".format(
                errorStatus.prettyPrint(),
                errorIndex and varBinds[int(errorIndex) - 1][0] or "?",
            )
        )
    else:
        for varBind in varBinds:
            print(" = ".join([x.prettyPrint() for x in varBind]))
```

This is how to send SNMP TRAP:

```python
from pysnmp.hlapi import *


snmpEngine = SnmpEngine()
errorIndication, errorStatus, errorIndex, varBinds = sendNotification(
    snmpEngine,
    CommunityData('public', mpModel=0),
    UdpTransportTarget(('demo.pysnmp.com', 162)),
    ContextData(),
    "trap",
    NotificationType(ObjectIdentity("1.3.6.1.6.3.1.1.5.2")).addVarBinds(
        ("1.3.6.1.6.3.1.1.4.3.0", "1.3.6.1.4.1.20408.4.1.1.2"),
        ("1.3.6.1.2.1.1.1.0", OctetString("my system")),
    ),
)

if errorIndication:
    print(errorIndication)

snmpEngine.transportDispatcher.closeDispatcher()
```

> We maintain publicly available SNMP Agent and TRAP sink at
> [demo.pysnmp.com](https://www.pysnmp.com/snmp-simulation-service). You are
> welcome to use it while experimenting with whatever SNMP software you deal with.

```bash
$ python3 examples/hlapi/asyncio/manager/cmdgen/usm-sha-aes128.py
SNMPv2-MIB::sysDescr.0 = SunOS zeus.pysnmp.com 4.1.3_U1 1 sun4m
$
$ python3 examples/hlapi/asyncio/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 sites
or local directories. You could configure any MIB source available to you (including
[this one](https://mibs.pysnmp.com)) for that purpose.

For more sample scripts please refer to [examples section](https://www.pysnmp.com/pysnmp/examples/index.html#high-level-snmp)
at PySNMP web site.

Documentation
-------------

Library documentation and examples can be found at the [PySNMP docs site](https://www.pysnmp.com/pysnmp/).

If something does not work as expected, please
[open an issue](https://github.com/lextudio/pysnmp/issues) at GitHub or
post your question [on Stack Overflow](http://stackoverflow.com/questions/ask).

Bug reports and PRs are appreciated! ;-)

Copyright (c) 2005-2020, [Ilya Etingof](https://lists.openstack.org/pipermail/openstack-discuss/2022-August/030062.html).
Copyright (c) 2022-2024, [LeXtudio Inc](mailto:support@lextudio.com).
All rights reserved.

            

Raw data

            {
    "_id": null,
    "home_page": "https://github.com/lextudio/pysnmp",
    "name": "pysnmp-lextudio",
    "maintainer": null,
    "docs_url": null,
    "requires_python": "<4.0,>=3.7",
    "maintainer_email": null,
    "keywords": null,
    "author": "Ilya Etingof",
    "author_email": "etingof@gmail.com",
    "download_url": "https://files.pythonhosted.org/packages/62/60/37574e7cd70d686a9b2167dd2baff814f04aa36b2fb94acc1dcc0320357b/pysnmp_lextudio-6.1.2.tar.gz",
    "platform": null,
    "description": "\nSNMP Library for Python\n-----------------------\n\n[![Become a Sponsor](https://img.shields.io/badge/Become%20a%20Sponsor-lextudio-orange.svg?style=for-readme)](https://github.com/sponsors/lextudio)\n[![PyPI](https://img.shields.io/pypi/v/pysnmp-lextudio.svg)](https://pypi.python.org/pypi/pysnmp-lextudio)\n[![PyPI Downloads](https://img.shields.io/pypi/dd/pysnmp-lextudio)](https://pypi.python.org/pypi/pysnmp-lextudio/)\n[![Python Versions](https://img.shields.io/pypi/pyversions/pysnmp-lextudio.svg)](https://pypi.python.org/pypi/pysnmp-lextudio/)\n[![GitHub license](https://img.shields.io/badge/license-BSD-blue.svg)](https://raw.githubusercontent.com/lextudio/pysnmp/master/LICENSE.rst)\n\nThis is a pure-Python, open source and free implementation of v1/v2c/v3\nSNMP engine distributed under 2-clause [BSD license](https://www.pysnmp.com/pysnmp/license.html).\n\nThe PySNMP project was initially sponsored by a [PSF](http://www.python.org/psf/) grant.\nThank you!\n\nThis repo is a fork of Ilya Etingof's project [etingof/pysnmp](https://github.com/etingof/pysnmp), but [LeXtudio Inc. is taking over the entire PySNMP ecosystem](https://github.com/etingof/pysnmp/issues/429), including the library, documentation, and the website.\n\nIlya sadly passed away on 10-Aug-2022. Announcement [here](https://lists.openstack.org/pipermail/openstack-discuss/2022-August/030062.html).  His work is still of great use to the Python community and he will be missed.\n\nFeatures\n--------\n\n* Complete SNMPv1/v2c and SNMPv3 support\n* SMI framework for resolving MIB information and implementing SMI\n  Managed Objects\n* Complete SNMP entity implementation\n* USM Extended Security Options support (3DES, 192/256-bit AES encryption)\n* Extensible network transports framework (UDP/IPv4, UDP/IPv6)\n* Asynchronous socket-based IO API support\n* [Asyncio](https://docs.python.org/3/library/asyncio.html) integration\n* [PySMI](https://www.pysnmp.com/pysmi/) integration for dynamic MIB compilation\n* Built-in instrumentation exposing protocol engine operations\n* Python eggs and py2exe friendly\n* 100% Python, works with Python 3.8+\n* MT-safe (if SnmpEngine is thread-local)\n\nFeatures, specific to SNMPv3 model include:\n\n* USM authentication (MD5/SHA-1/SHA-2) and privacy (DES/AES) protocols (RFC3414, RFC7860)\n* View-based access control to use with any SNMP model (RFC3415)\n* Built-in SNMP proxy PDU converter for building multi-lingual\n  SNMP entities (RFC2576)\n* Remote SNMP engine configuration\n* Optional SNMP engine discovery\n* Shipped with standard SNMP applications (RFC3413)\n\nDownload & Install\n------------------\n\nThe PySNMP software is freely available for download from [PyPI](https://pypi.python.org/pypi/pysnmp-lextudio)\nand [GitHub](https://github.com/lextudio/pysnmp.git).\n\nJust run:\n\n```bash\n$ pip install pysnmp-lextudio\n```\n\nTo download and install PySNMP along with its dependencies:\n\n<!-- Need to find an alternate location for the links to pysnmp.com -->\n* [PyASN1](https://pyasn1.readthedocs.io)\n* [PySMI](https://www.pysnmp.com/pysmi/) (required for MIB services only)\n* Optional [pysnmpcrypto](https://github.com/etingof/pysnmpcrypto) package\n  whenever strong SNMPv3 encryption is desired\n\nBesides the library, command-line [SNMP utilities](https://github.com/lextudio/snmpclitools)\nwritten in pure-Python could be installed via:\n\n```bash\n$ pip install snmpclitools-lextudio\n```\n\nand used in the very similar manner as conventional Net-SNMP tools:\n\n```bash\n$ snmpget.py -v3 -l authPriv -u usr-md5-des -A authkey1 -X privkey1 demo.pysnmp.com sysDescr.0\nSNMPv2-MIB::sysDescr.0 = STRING: Linux zeus 4.8.6.5-smp #2 SMP Sun Nov 13 14:58:11 CDT 2016 i686\n```\n\nExamples\n--------\n\nPySNMP is designed in a layered fashion. Top-level and easiest to use API is known as\n*hlapi*. Here's a quick example on how to SNMP GET:\n\n```python\nfrom pysnmp.hlapi import *\nfrom pysnmp.smi.rfc1902 import ObjectIdentity, ObjectType\n\nwith Slim(1) as slim:\n    errorIndication, errorStatus, errorIndex, varBinds = slim.get(\n        'public',\n        'demo.pysnmp.com',\n        161,\n        ObjectType(ObjectIdentity(\"SNMPv2-MIB\", \"sysDescr\", 0)),\n    )\n\n    if errorIndication:\n        print(errorIndication)\n    elif errorStatus:\n        print(\n            \"{} at {}\".format(\n                errorStatus.prettyPrint(),\n                errorIndex and varBinds[int(errorIndex) - 1][0] or \"?\",\n            )\n        )\n    else:\n        for varBind in varBinds:\n            print(\" = \".join([x.prettyPrint() for x in varBind]))\n```\n\nThis is how to send SNMP TRAP:\n\n```python\nfrom pysnmp.hlapi import *\n\n\nsnmpEngine = SnmpEngine()\nerrorIndication, errorStatus, errorIndex, varBinds = sendNotification(\n    snmpEngine,\n    CommunityData('public', mpModel=0),\n    UdpTransportTarget(('demo.pysnmp.com', 162)),\n    ContextData(),\n    \"trap\",\n    NotificationType(ObjectIdentity(\"1.3.6.1.6.3.1.1.5.2\")).addVarBinds(\n        (\"1.3.6.1.6.3.1.1.4.3.0\", \"1.3.6.1.4.1.20408.4.1.1.2\"),\n        (\"1.3.6.1.2.1.1.1.0\", OctetString(\"my system\")),\n    ),\n)\n\nif errorIndication:\n    print(errorIndication)\n\nsnmpEngine.transportDispatcher.closeDispatcher()\n```\n\n> We maintain publicly available SNMP Agent and TRAP sink at\n> [demo.pysnmp.com](https://www.pysnmp.com/snmp-simulation-service). You are\n> welcome to use it while experimenting with whatever SNMP software you deal with.\n\n```bash\n$ python3 examples/hlapi/asyncio/manager/cmdgen/usm-sha-aes128.py\nSNMPv2-MIB::sysDescr.0 = SunOS zeus.pysnmp.com 4.1.3_U1 1 sun4m\n$\n$ python3 examples/hlapi/asyncio/agent/ntforg/v3-inform.py\nSNMPv2-MIB::sysUpTime.0 = 0\nSNMPv2-MIB::snmpTrapOID.0 = SNMPv2-MIB::warmStart\nSNMPv2-MIB::sysName.0 = system name\n```\n\nOther than that, PySNMP is capable to automatically fetch and use required MIBs from HTTP sites\nor local directories. You could configure any MIB source available to you (including\n[this one](https://mibs.pysnmp.com)) for that purpose.\n\nFor more sample scripts please refer to [examples section](https://www.pysnmp.com/pysnmp/examples/index.html#high-level-snmp)\nat PySNMP web site.\n\nDocumentation\n-------------\n\nLibrary documentation and examples can be found at the [PySNMP docs site](https://www.pysnmp.com/pysnmp/).\n\nIf something does not work as expected, please\n[open an issue](https://github.com/lextudio/pysnmp/issues) at GitHub or\npost your question [on Stack Overflow](http://stackoverflow.com/questions/ask).\n\nBug reports and PRs are appreciated! ;-)\n\nCopyright (c) 2005-2020, [Ilya Etingof](https://lists.openstack.org/pipermail/openstack-discuss/2022-August/030062.html).\nCopyright (c) 2022-2024, [LeXtudio Inc](mailto:support@lextudio.com).\nAll rights reserved.\n",
    "bugtrack_url": null,
    "license": "BSD-2-Clause",
    "summary": "A Python library for SNMP",
    "version": "6.1.2",
    "project_urls": {
        "Homepage": "https://github.com/lextudio/pysnmp",
        "Repository": "https://github.com/lextudio/pysnmp"
    },
    "split_keywords": [],
    "urls": [
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "b2c9aa87ea5e4705c9855de1d9724514e95fbda1212e8727ae2625737c94c561",
                "md5": "a8d0bc64951b1bf7c63c22d9015c88ce",
                "sha256": "5a30d289f73fbdd56ca4a6b83e43cef3a1871eee402651748c8ff47f603e5cb2"
            },
            "downloads": -1,
            "filename": "pysnmp_lextudio-6.1.2-py3-none-any.whl",
            "has_sig": false,
            "md5_digest": "a8d0bc64951b1bf7c63c22d9015c88ce",
            "packagetype": "bdist_wheel",
            "python_version": "py3",
            "requires_python": "<4.0,>=3.7",
            "size": 280899,
            "upload_time": "2024-03-25T06:12:51",
            "upload_time_iso_8601": "2024-03-25T06:12:51.206098Z",
            "url": "https://files.pythonhosted.org/packages/b2/c9/aa87ea5e4705c9855de1d9724514e95fbda1212e8727ae2625737c94c561/pysnmp_lextudio-6.1.2-py3-none-any.whl",
            "yanked": false,
            "yanked_reason": null
        },
        {
            "comment_text": "",
            "digests": {
                "blake2b_256": "626037574e7cd70d686a9b2167dd2baff814f04aa36b2fb94acc1dcc0320357b",
                "md5": "d5a0f5afe48e41bbb11e0f8f36788f91",
                "sha256": "4035677d236f9fb6da5dbcfae2dc9122ee3652f535efeb904a56f54f162f28c9"
            },
            "downloads": -1,
            "filename": "pysnmp_lextudio-6.1.2.tar.gz",
            "has_sig": false,
            "md5_digest": "d5a0f5afe48e41bbb11e0f8f36788f91",
            "packagetype": "sdist",
            "python_version": "source",
            "requires_python": "<4.0,>=3.7",
            "size": 412553,
            "upload_time": "2024-03-25T06:12:53",
            "upload_time_iso_8601": "2024-03-25T06:12:53.384121Z",
            "url": "https://files.pythonhosted.org/packages/62/60/37574e7cd70d686a9b2167dd2baff814f04aa36b2fb94acc1dcc0320357b/pysnmp_lextudio-6.1.2.tar.gz",
            "yanked": false,
            "yanked_reason": null
        }
    ],
    "upload_time": "2024-03-25 06:12:53",
    "github": true,
    "gitlab": false,
    "bitbucket": false,
    "codeberg": false,
    "github_user": "lextudio",
    "github_project": "pysnmp",
    "travis_ci": false,
    "coveralls": false,
    "github_actions": true,
    "lcname": "pysnmp-lextudio"
}
        
Elapsed time: 0.24870s