# 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:
```python
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"))`` or ``socket.inet_ntoa(b"\x01\x01\x01\x01")``
Another python SNMP libraries:
* [PySNMP](http://pysnmp.sourceforge.net/) - very good SNMP library
* [libsnmp](https://pypi.python.org/pypi/libsnmp) - SNMP coder/decoder (abandoned project)
* [Bindings to Net-SNMP](http://net-snmp.sourceforge.net/wiki/index.php/Python_Bindings)
Raw data
{
"_id": null,
"home_page": "https://github.com/gescheit/fastsnmp",
"name": "fastsnmp",
"maintainer": null,
"docs_url": null,
"requires_python": null,
"maintainer_email": null,
"keywords": "SNMP poller parser library coder decoder",
"author": "Aleksandr Balezin",
"author_email": "gescheit12@gmail.com",
"download_url": "https://files.pythonhosted.org/packages/95/cd/8301c0d38921f27bda67a15f1a207493125fb3e50f6d6ae34e2b15a22899/fastsnmp-0.14.tar.gz",
"platform": "Linux",
"description": "# fastsnmp\nSNMP poller oriented to poll bunch of hosts in short time. Package include poller and SNMP coder/encoder library.\n\n[Reference manual] (http://fastsnmp.readthedocs.org/)\n\nExample:\n```python\nfrom fastsnmp import snmp_poller\n\nhosts = (\"127.0.0.1\",)\n# oids in group must be with same indexes\noid_group = {\"1.3.6.1.2.1.2.2.1.2\": \"ifDescr\",\n \"1.3.6.1.2.1.2.2.1.10\": \"ifInOctets\",\n }\n\ncommunity = \"public\"\nsnmp_data = snmp_poller.poller(hosts, [list(oid_group)], community)\nfor d in snmp_data:\n print (\"host=%s oid=%s.%s value=%s\" % (d[0], oid_group[d[1]], d[2], d[3]))\n```\nOutput:\n```\nhost=127.0.0.1 oid=ifInOctets.1 value=243203744\nhost=127.0.0.1 oid=ifDescr.1 value=b'lo'\nhost=127.0.0.1 oid=ifInOctets.2 value=1397428486\nhost=127.0.0.1 oid=ifDescr.2 value=b'eth0'\n```\nType conversion:\n\n| SNMP | Python |\n| --- | --- |\n| octetstring, ipaddress | bytes |\n| null | None |\n| objectid | str |\n| counter32, unsigned32, gauge32, counter64, integer | int |\n| noSuchInstance | None |\n| noSuchObject | None |\n| endOfMibView | None |\n\nNotices:\n\n- ipaddress can be converted to string using ``str(ipaddress.IPv4Address(b\"\\x01\\x01\\x01\\x01\"))`` or ``socket.inet_ntoa(b\"\\x01\\x01\\x01\\x01\")``\n\nAnother python SNMP libraries:\n\n* [PySNMP](http://pysnmp.sourceforge.net/) - very good SNMP library\n* [libsnmp](https://pypi.python.org/pypi/libsnmp) - SNMP coder/decoder (abandoned project)\n* [Bindings to Net-SNMP](http://net-snmp.sourceforge.net/wiki/index.php/Python_Bindings)\n",
"bugtrack_url": null,
"license": "MIT",
"summary": "SNMP poller oriented to poll bunch of hosts in short time. Package include poller and SNMP library",
"version": "0.14",
"project_urls": {
"Homepage": "https://github.com/gescheit/fastsnmp"
},
"split_keywords": [
"snmp",
"poller",
"parser",
"library",
"coder",
"decoder"
],
"urls": [
{
"comment_text": "",
"digests": {
"blake2b_256": "95cd8301c0d38921f27bda67a15f1a207493125fb3e50f6d6ae34e2b15a22899",
"md5": "7a24c74ec327f94cd36b0f126c9ebdaa",
"sha256": "2ae88fd94f8e6cc2cfce7f9bc391973ca7beb33170c93b455c38c6baec112362"
},
"downloads": -1,
"filename": "fastsnmp-0.14.tar.gz",
"has_sig": false,
"md5_digest": "7a24c74ec327f94cd36b0f126c9ebdaa",
"packagetype": "sdist",
"python_version": "source",
"requires_python": null,
"size": 150097,
"upload_time": "2025-01-20T19:08:22",
"upload_time_iso_8601": "2025-01-20T19:08:22.029234Z",
"url": "https://files.pythonhosted.org/packages/95/cd/8301c0d38921f27bda67a15f1a207493125fb3e50f6d6ae34e2b15a22899/fastsnmp-0.14.tar.gz",
"yanked": false,
"yanked_reason": null
}
],
"upload_time": "2025-01-20 19:08:22",
"github": true,
"gitlab": false,
"bitbucket": false,
"codeberg": false,
"github_user": "gescheit",
"github_project": "fastsnmp",
"travis_ci": false,
"coveralls": false,
"github_actions": true,
"tox": true,
"lcname": "fastsnmp"
}