{"id":16212152,"url":"https://github.com/hakkaofdev/py-snmp-utils","last_synced_at":"2025-04-02T12:23:01.675Z","repository":{"id":45345870,"uuid":"427104899","full_name":"HakkaOfDev/py-snmp-utils","owner":"HakkaOfDev","description":"An opensource library to use SNMP get/bulk/set/walk/table in Python","archived":false,"fork":false,"pushed_at":"2022-01-04T08:53:45.000Z","size":5,"stargazers_count":4,"open_issues_count":1,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-02-08T03:26:02.930Z","etag":null,"topics":["librairy","opensource","pysnmp","python","snmp"],"latest_commit_sha":null,"homepage":"","language":"Python","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":null,"status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/HakkaOfDev.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":null,"code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2021-11-11T18:34:52.000Z","updated_at":"2024-12-15T13:20:21.000Z","dependencies_parsed_at":"2022-08-04T14:02:49.089Z","dependency_job_id":null,"html_url":"https://github.com/HakkaOfDev/py-snmp-utils","commit_stats":null,"previous_names":[],"tags_count":1,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakkaOfDev%2Fpy-snmp-utils","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakkaOfDev%2Fpy-snmp-utils/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakkaOfDev%2Fpy-snmp-utils/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/HakkaOfDev%2Fpy-snmp-utils/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/HakkaOfDev","download_url":"https://codeload.github.com/HakkaOfDev/py-snmp-utils/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":246811935,"owners_count":20837867,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["librairy","opensource","pysnmp","python","snmp"],"created_at":"2024-10-10T10:50:27.326Z","updated_at":"2025-04-02T12:22:56.662Z","avatar_url":"https://github.com/HakkaOfDev.png","language":"Python","funding_links":[],"categories":[],"sub_categories":[],"readme":"# SNMP-UTILS\n\n[![heart](https://img.shields.io/static/v1?label=Build%20With\u0026message=❤\u0026color=darkred\u0026labelColor=red\u0026style=for-the-badge)]()\n[![foryou](https://img.shields.io/static/v1?label=For\u0026message=You\u0026color=aqua\u0026labelColor=blue\u0026style=for-the-badge)]()\n[![license](https://img.shields.io/static/v1?label=License\u0026message=OPENSOURCE\u0026color=green\u0026labelColor=darkgreen\u0026style=for-the-badge)]()\n\u003cbr\u003e\u003cbr\u003e\nAn opensource library to use SNMP get/set/bulk/walk/table more easily in Python\n\n## Features\n* [GET](#GET) command\n* [SET](#SET) command\n* [WALK](#WALK) command\n* [BULK](#BULK) command\n* [TABLE](#TABLE) command\n* [CHECK IF DEVICE IS ONLINE](#CHECK)\n\n## Link with oids.json\n\n```python\nimport json\noids = None\nwith open('OIDS.json', 'r') as file:\n    oids = json.load(file)\n```\n\n## GET\n\nGET SNMP Command return the value of a specific OID. \\\n`get(oid)`\n\n```python\nswitch = SnmpUtils(\"10.0.0.1\")\nswitch_name = switch.get(oids['system']['name']) # return name of device\n```\n\nYou can also use `get_by_id(oid, id)` which returns the value of the inferior OID.\n\n```python\nswitch = SnmpUtils(\"10.0.0.1\")\nswitch_interface_3_description = switch.get_by_id(oids['interfaces']['description'], 3) # return the description of the third interface\n```\n\n## SET\n\nSET SNMP is use for set value of a specific OID. \\\n`set(oid, value_type, value)` \\\n*value_type can be one of i/u/t/a/o/s/x/d/b*\n```python\nswitch = SnmpUtils(\"10.0.0.1\")\nswitch_name = switch.set(oids['system']['name'], 's', \"Test\")\n```\n\n## WALK\n\nWALK SNMP Command return a dict of all values of inferiors OIDs. \\\n`walk(oid)`\n\n```\nswitch = SnmpUtils(\"10.0.0.1\")\nswitch_interfaces_description = switch.walk(oids['interfaces']['description']) # return a dict with key/value\nfor k,v in switch_interfaces_description.items():\n    print(k,v)\n```\n\n## BULK\n\nBULK SNMP returns all following items up to a limit for an/several item(s). \\\n`bulk(*oids_list)`\n\n```\nswitch = SnmpUtils(\"10.0.0.1\")\nswitch_interfaces_description = switch.bulk(oids['interfaces']['description']) #return a dict with description for all interfaces\n```\n\n## TABLE\n\nTABLE SNMP returns list of dicts \\\n`get_table(oid, sort_key)`\n\n```\nswitch = SnmpUtils(\"10.0.0.1\")\nswitch_interfaces = switch.get_table('1.3.6.1.2.1.2.2') # return list of dicts\n```\n\n\n## CHECK\n\nYou can easily check if a device is online \\\n`is_online()`\n\n```\nswitch = (\"10.0.0.1\")\nif switch.is_online():\n    print(\"Switch online\")\n```\n\n## Dependencies\n\n* [PySNMP](https://pysnmp.readthedocs.io/en/latest/)\n* [SNMP-CMDS](https://snmp-cmds.readthedocs.io/en/latest/)\n\n## Contributors\n\n* [Alexandre GOSSARD](https://www.github.com/HakkaOfDev)\n* [Alexis LEBEL](https://www.github.com/Alestrio)","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakkaofdev%2Fpy-snmp-utils","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhakkaofdev%2Fpy-snmp-utils","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhakkaofdev%2Fpy-snmp-utils/lists"}