{ "info": { "author": "Nicolas Agius", "author_email": "nicolas.agius@lps-it.fr", "bugtrack_url": null, "classifiers": [ "Development Status :: 5 - Production/Stable", "Intended Audience :: Developers", "License :: OSI Approved :: GNU General Public License (GPL)", "Operating System :: POSIX :: Linux", "Topic :: System :: Monitoring" ], "description": "# SNMP-PassPersist\n\nThis module is a SNMP passpersist backend for Net-SNMP.\n\nThe `snmp_passpersist.PassPersist` class present a convenient way to creare a MIB subtree and expose it to snmp via it's passpersist protocol.\nTwo threads are used, one for talking with snmpd and a second that trigger the update process at a fixed interval.\n\nThe keyword 'DUMP' has been added to the protocol for testing purpose.\n\n\n## Installation\n\nThe easiest way is using pip :\u00a0\n```\npip install snmp_passpersist\n```\n\nIf you're running Python 2.x and see this error : \n```\nTraceback (most recent call last):\n File \"test.py\", line 3, in \n import snmp_passpersist as snmp\n File \"/root/snmp_passpersist/snmp_passpersist.py\", line 32, in \n from builtins import str\nImportError: No module named builtins\n```\n\nInstall the `future` package to fix the issue: `pip install future`\n\n## Example\n\nUsage example: in a file /path/to/your/script.py :\n\n```python\n#!/usr/bin/python -u\n\nimport snmp_passpersist as snmp\n\ndef update():\n pp.add_int('0.1', 123, \"This is a label for this integer\")\n pp.add_str('0.2', \"A string\")\n pp.add_oct('0.3', '01 00 1f 0b 00 0b') # MAC address as an octet string\n\npp=snmp.PassPersist(\".1.3.6.1.3.53.8\")\npp.start(update,30) # Every 30s\n```\n\nWith the following line in Net-SNMP's snmpd.conf :\n\n```\npass_persist .1.3.6.1.3.53.8.0 /path/to/your/script.py\n```\n\nA Real-world example is available here: https://github.com/nagius/cxm/blob/master/misc/snmp_xen.py\n\n## List of supported types and their helpers\n\n| Type | Helper |\n|------|--------|\n|Counter32\t|add_cnt_32bit()\n|Counter64\t|add_cnt_64bit()\n|GAUGE\t\t|add_gau()\n|INTEGER\t|add_int()\n|IPADDRESS\t|add_ip()\n|OBJECTID\t|add_oid()\n|OCTET\t\t|add_oct()\n|STRING\t\t|add_str()\n|TIMETICKS\t|add_tt()\n\n\n## Special helpers\n\n### Labels\n\nYou can add a label with each entries, as an optional parameter to all add_*() helpers. \nThis label is not used by Net-SNMP and is only useful for debugging with the DUMP keyword.\n\n\n### add_oid()\n\nThis helper allow you to add a simple OID string and give it the proper type. For example, calling this method with\n\n```python\npp.add_oid('.1.3.6.1.2.1.47','1.1.1.1.3.1','0.0')\n```\n\nwhere \"0.0\" represents `SNMPv2-SMI::zeroDotZero`.\n\nThis results in the following response when we walk this OID:\n\n`ENTITY-MIB::entPhysicalVendorType.1 = OID: SNMPv2-SMI::zeroDotZero`\n\n### Set an attribute\n\nYou can register a helper to allow the recording of value from Net-SNMP.\n\n```python\ndef my_setter(oid, type, value):\n print(\"Received %s with value %s for oid %s.\" % (type, value, oid))\n return True\n\npp.register_setter('.1.3.6.1.3.53.8.0.4', my_setter)\n```\n\nExample for debugging : \n\n```\n$ /path/to/your/script.py\nset\n.1.3.6.1.3.53.8.0.4\nINTEGER 987\nReceived INTEGER with value 987 for oid .1.3.6.1.3.53.8.0.4.\nDONE\nset\n.1.3.6.1.3.53.8.0.1\nSTRING some-random-useless-string\nnot-writable\n```\n\nAnother example that show the usage of the 'set' feature is available in the 'example/' directory.\n\n## Debugging example\n\nRun the previous script in a shell and type the commands : \n\n```\n$ /path/to/your/script.py\nPING\nPONG\nDUMP\n{'0.1': {'type': 'INTEGER', 'value': '123'}}\nget\n.1.3.6.1.3.53.8\nNONE\nget\n.1.3.6.1.3.53.8.0.1\n.1.3.6.1.3.53.8.0.1\nINTEGER\n123\ngetnext\n.1.3.6.1.3.53.8\n.1.3.6.1.3.53.8.0.1\nINTEGER\n123\n```\n\nAll commands are typed on two lines : get.1.3.6.1.3.53.8.0.1, except PING and DUMP.\n\n## Credits\n\nMany thanks to all contributors.\n\n\n\n\n", "description_content_type": "text/markdown", "docs_url": null, "download_url": "", "downloads": { "last_day": -1, "last_month": -1, "last_week": -1 }, "home_page": "http://github.com/nagius/snmp_passpersist", "keywords": "snmp net-snmp", "license": "GPLv3", "maintainer": "", "maintainer_email": "", "name": "snmp-passpersist", "package_url": "https://pypi.org/project/snmp-passpersist/", "platform": "", "project_url": "https://pypi.org/project/snmp-passpersist/", "project_urls": { "Homepage": "http://github.com/nagius/snmp_passpersist" }, "release_url": "https://pypi.org/project/snmp-passpersist/2.0.0/", "requires_dist": null, "requires_python": "", "summary": "SNMP passpersist backend for Net-SNMP", "version": "2.0.0" }, "last_serial": 5655928, "releases": { "1.0": [ { "comment_text": "", "digests": { "md5": "44beaacb45fbdfd175962a4f99977ca4", "sha256": "a78f00e1f9e5131d8554a7b60c5a65b4e6764ccd05d2520a973644d25ffb11fb" }, "downloads": -1, "filename": "snmp_passpersist-1.0.tar.gz", "has_sig": false, "md5_digest": "44beaacb45fbdfd175962a4f99977ca4", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 3183, "upload_time": "2010-09-28T16:47:51", "url": "https://files.pythonhosted.org/packages/6e/1d/804da0177486002c3e806f262269f732ea9aefdc7972b79909550ba8d9b4/snmp_passpersist-1.0.tar.gz" } ], "1.2.1": [ { "comment_text": "", "digests": { "md5": "128c36e11672162f7bf7af64da7c3282", "sha256": "0f33b9a99412d667d1ea181899d555841c7fa4551f4171a5a90f7e9f3484a37e" }, "downloads": -1, "filename": "snmp_passpersist-1.2.1-py2.4.egg", "has_sig": false, "md5_digest": "128c36e11672162f7bf7af64da7c3282", "packagetype": "bdist_egg", "python_version": "2.4", "requires_python": null, "size": 8308, "upload_time": "2012-01-30T15:29:19", "url": "https://files.pythonhosted.org/packages/2a/fb/9cbfc532290a53ab56a9b5aa2275c9b8ba182345482cd9f7a338a4a429a9/snmp_passpersist-1.2.1-py2.4.egg" } ], "1.2.2": [ { "comment_text": "", "digests": { "md5": "19b96a8eba51e1b661af1ca1d5d7b5c8", "sha256": "cc48133bdfe0d8bed1f2df5fcce488acc3ba1ff84f20f0178ba27beb9127a620" }, "downloads": -1, "filename": "snmp_passpersist-1.2.2.tar.gz", "has_sig": false, "md5_digest": "19b96a8eba51e1b661af1ca1d5d7b5c8", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4445, "upload_time": "2013-03-06T14:22:34", "url": "https://files.pythonhosted.org/packages/4d/67/df7acab7a393593133586aba5a8c1b95c4e66fd37545ffdd58b45fc8edbd/snmp_passpersist-1.2.2.tar.gz" } ], "1.2.3": [ { "comment_text": "", "digests": { "md5": "2aae44c9162ff402a940e05bae6a3ef4", "sha256": "e381e11f4adb753f975da5635e92b4ffca33623c63e966a17c3f615eb9868510" }, "downloads": -1, "filename": "snmp_passpersist-1.2.3.tar.gz", "has_sig": false, "md5_digest": "2aae44c9162ff402a940e05bae6a3ef4", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 4532, "upload_time": "2013-09-06T17:08:39", "url": "https://files.pythonhosted.org/packages/b7/10/ecaf858a502b8449cb3ba6f5c282c1deca4015fa278d282b456191121d0a/snmp_passpersist-1.2.3.tar.gz" } ], "1.3.0": [ { "comment_text": "", "digests": { "md5": "8680ea404d2fbe906b06256a2acf0ccb", "sha256": "2aa010a4d38025c71282b03b3e47f37110eee348aeea39a71d7561b7d1cfc3d9" }, "downloads": -1, "filename": "snmp_passpersist-1.3.0.tar.gz", "has_sig": false, "md5_digest": "8680ea404d2fbe906b06256a2acf0ccb", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 5237, "upload_time": "2013-10-24T11:13:05", "url": "https://files.pythonhosted.org/packages/a3/bd/aff67e2da7f65bfc2243030d414f927c14c7f7bc4b19db2f3dead51797be/snmp_passpersist-1.3.0.tar.gz" } ], "2.0.0": [ { "comment_text": "", "digests": { "md5": "0d82407e854e6d78561d7ff3bd43b8f0", "sha256": "bc2c87331de52bf0fcaeaab253fba0e85cea02cb21b450a0cf72b02b7de9cf9c" }, "downloads": -1, "filename": "snmp_passpersist-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0d82407e854e6d78561d7ff3bd43b8f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19658, "upload_time": "2019-08-09T13:59:02", "url": "https://files.pythonhosted.org/packages/0a/4e/578452d37cb7c6dd828c31373ed7e8699455fe025524aeb362fb743c1af1/snmp_passpersist-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a620107f7bac001a00305d521f05177c", "sha256": "1e63917d2ab479459db704682fd5c7e9d6dcb70a395a4b5c656f576c622d17f7" }, "downloads": -1, "filename": "snmp_passpersist-2.0.0.tar.gz", "has_sig": false, "md5_digest": "a620107f7bac001a00305d521f05177c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6964, "upload_time": "2019-08-09T13:59:03", "url": "https://files.pythonhosted.org/packages/80/08/d1ffcfc7bc4368ef6ba434862101abf4c2905c99995dbe63bb20665e994e/snmp_passpersist-2.0.0.tar.gz" } ] }, "urls": [ { "comment_text": "", "digests": { "md5": "0d82407e854e6d78561d7ff3bd43b8f0", "sha256": "bc2c87331de52bf0fcaeaab253fba0e85cea02cb21b450a0cf72b02b7de9cf9c" }, "downloads": -1, "filename": "snmp_passpersist-2.0.0-py3-none-any.whl", "has_sig": false, "md5_digest": "0d82407e854e6d78561d7ff3bd43b8f0", "packagetype": "bdist_wheel", "python_version": "py3", "requires_python": null, "size": 19658, "upload_time": "2019-08-09T13:59:02", "url": "https://files.pythonhosted.org/packages/0a/4e/578452d37cb7c6dd828c31373ed7e8699455fe025524aeb362fb743c1af1/snmp_passpersist-2.0.0-py3-none-any.whl" }, { "comment_text": "", "digests": { "md5": "a620107f7bac001a00305d521f05177c", "sha256": "1e63917d2ab479459db704682fd5c7e9d6dcb70a395a4b5c656f576c622d17f7" }, "downloads": -1, "filename": "snmp_passpersist-2.0.0.tar.gz", "has_sig": false, "md5_digest": "a620107f7bac001a00305d521f05177c", "packagetype": "sdist", "python_version": "source", "requires_python": null, "size": 6964, "upload_time": "2019-08-09T13:59:03", "url": "https://files.pythonhosted.org/packages/80/08/d1ffcfc7bc4368ef6ba434862101abf4c2905c99995dbe63bb20665e994e/snmp_passpersist-2.0.0.tar.gz" } ] }