{"id":19241399,"url":"https://github.com/opensolutions/oss_snmp","last_synced_at":"2025-04-05T09:10:10.130Z","repository":{"id":3537450,"uuid":"4597290","full_name":"opensolutions/OSS_SNMP","owner":"opensolutions","description":"A PHP SNMP library for people who hate SNMP, MIBs and OIDs!","archived":false,"fork":false,"pushed_at":"2023-02-22T21:03:27.000Z","size":1542,"stargazers_count":106,"open_issues_count":0,"forks_count":57,"subscribers_count":21,"default_branch":"master","last_synced_at":"2024-03-26T16:22:26.759Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":"https://github.com/opensolutions/OSS_SNMP/wiki","language":"PHP","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/opensolutions.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null}},"created_at":"2012-06-08T12:56:25.000Z","updated_at":"2024-02-13T10:51:50.000Z","dependencies_parsed_at":"2022-08-02T10:35:19.841Z","dependency_job_id":null,"html_url":"https://github.com/opensolutions/OSS_SNMP","commit_stats":{"total_commits":225,"total_committers":24,"mean_commits":9.375,"dds":"0.19999999999999996","last_synced_commit":"1445daf3b3a99c71246afa97c8e5e96d1f8586bc"},"previous_names":[],"tags_count":4,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensolutions%2FOSS_SNMP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensolutions%2FOSS_SNMP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensolutions%2FOSS_SNMP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/opensolutions%2FOSS_SNMP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/opensolutions","download_url":"https://codeload.github.com/opensolutions/OSS_SNMP/tar.gz/refs/heads/master","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":247312085,"owners_count":20918344,"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":[],"created_at":"2024-11-09T17:11:18.978Z","updated_at":"2025-04-05T09:10:10.048Z","avatar_url":"https://github.com/opensolutions.png","language":"PHP","funding_links":[],"categories":[],"sub_categories":[],"readme":"OSS_SNMP\n========\n\nA PHP SNMP Library for People Who HATE SNMP, MIBs and OIDs!\n------------------------------------------------------------\n\nI ([Barry O'Donovan](http://www.barryodonovan.com/)) hate SNMP! But I have\nto use it on a daily basis with my company, [Open\nSolutions](http://www.opensolutions.ie/) and our customers.\n\nDon't get me wrong, it's an essential tool in the trade of network engineering\nbut it's also a serious PITA. Finding MIBs, OIBs, making them work, translating\nthem, cross-vendor translations, etc, blah, blah. And then, when you do find what\nyou need, you'll have forgotten it months later when you need it again.\n\nAnyway, while trying to create some automatic L2 topology graphing tools\n(via Cisco/Foundry Discovery Protocol for example) and also some per VLAN\nRSTP tools to show port states, I started writing this library which has turned\nout to be very useful. It is presented here in the hope that the wider network \nengineering community will find it useful and also contribute back *MIBs*.\n\n\nDocumentation\n-------------\n\nPlease see [the wiki](https://github.com/opensolutions/OSS_SNMP/wiki).\n\nExample Usage\n-------------\n\nFirst, we need to instantiate an SNMP object with a hostname / IP address and\na community string:\n\n    $ciscosw = new \\OSS_SNMP\\SNMP( $ip, $community );\n\nAssuming the above is a standard Cisco switch, let's say I want to get an\nassociate array of VLAN names indexed by the VLAN ids:\n\n    print_r( $ciscosw-\u003euseCisco_VTP()-\u003evlanNames() );\n\nThis yields something like the following:\n\n    Array\n    (\n        [1] =\u003e default\n        [2] =\u003e mgmt\n        [100] =\u003e cust-widgets\n        [1002] =\u003e fddi-default\n        ...\n    )\n\nIt really is that easy. As another example, if you wanted to get the system contact:\n\n    echo $ciscosw-\u003euseSystem()-\u003econtact();\n\n\nLicense\n-------\n\nThis software library is released under the *New BSD License* (also known as the\n*Modified BSD License*). See the `LICENSE` file or the header of all other files\nfor the full text.\n\n\nMIBS - The Bad News... with some Good News\n------------------------------------------\n\nThe, what I'm calling, *MIBs* are defined in `OSS_SNMP/MIBS` and these define the \nfunctionality as per the examples above.\n\nThere's only a handful of MIBs currently defined - essentially what I've needed so\nfar for other projects.\n\nBut it's **really easy** to add your own. And **please** send me a pull request for those.\n\nFor the MIBs I've written, `Iface` (`MIBS/Iface.php`) is fully complete as an example \nto help future contributors. But there's some *really* useful\nfunctionality in the others. For example the Cisco/CDP MIB can discover your entire L2 network\ntopology recursively. Another project we've released, [NOCtools](https://github.com/opensolutions/NOCtools/wiki), \ngive concreate examples of this with GraphViz.\n\nSupports SNMP v1, v2c and v3. It's read only as, at time of writing, I have no current requirement to set SNMP values via PHP.\n\n\nRequirements\n------------\n\nPHP 5.4 is a requirement. The reason for 5.4 (besides the fact it's long been regarded as stable), \nis that we can now dereference an array directly from a function call:\n\n    $name = $ciscosw-\u003euseCisco_VTP()-\u003evlanNames()[ $vlanid ];\n\nrather than the old way:\n\n    $vlanNames = $ciscosw-\u003euseCisco_VTP()-\u003evlanNames();\n    $name = $vlanNames[ $vlanid ];\n\nAnd as most of the defined MIBs *walk* a given tree, almost all defined functions return an array.\n\nThe only other requirement is the php5-snmp library.\n\n\nCode / phpDoc Documentation\n---------------------------\n\nDocumentation can be generated from the root directory by executing:\n\n    ./bin/phpdoc.sh --force\n\nand it will be found under the `doc/` directory. There is\n[an online version available here](http://opensolutions.github.com/OSS_SNMP/doc/).\n\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensolutions%2Foss_snmp","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fopensolutions%2Foss_snmp","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fopensolutions%2Foss_snmp/lists"}