Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.Sign up
Feature: Plugins in the Port page #8665
Added new plugin menu_option in the "port" page, which contain hook calling public function port_container($device, $port) in plugins.
DO NOT DELETE THIS TEXT
If you would like to test this pull request then please run:
@PipoCanaja Thanks for your PR.
Also, because LibreNMS is an open source project, we are open to merging things directly into LibreNMS instead of requiring additional set up.
Basically, I have a plugin that adds a few "SNMP Write" and "CLI Write" commandes to LibreNMS, which allow our NOC to shut/no shut ports, clear PortSecurity sticky Mac Addresses, View dot1X status, change Description and VLAN.
As adding RW capability was clearly out of LibreNMS scope, I thought of this simple extension of the PluginStructure so everybody can actually extend LibreNMS in this (or other) directions, without breaking the AutoUpdate capability. More hooks would probably help people create plugins for more features that are not meant to be embedded into LibreNMS.
What kind of implementation (in the test Plugin) would you like to see ? For the moment, as shown in the capture, I did exactly the same as the Test Plugin already did with the "Device" page : putting a simple text so that any future user would see where it's code would access to the GUI.
Edit: A simple "Shut/NoShut" plugin using IF-MIB is provided in the next comment.
You'll find a test plugin that allows to Shut/No shut ports using the IF:MIB.
If you would like to include it directly into LibreNMS, I can add it to the current Pull Request.
I really wanted to get rid of the plugin system as it wasn't actively used but a few people keep popping up who do.
If we were to merge this then I would say that it would be good if you could add the plugin to https://github.com/librenms-plugins However you should also just use the existing device snmp creds rather than having another
You should also remove the
I don't know about the others, but I think that the plugin system is interesting to cover things that cannot/should not be included into librenms for any reason. It also allow some personnalisation without breaking the auto-update mechanism ...
Concerning the plugin, I'll push it as asked. For the community, the point is that the current SNMP Community configured in LibreNMS is RO in my deployment. That's why I used a different one (in a quick and dirty way, I must say). The "nice" way would probably be to have a new property, per device, with RW community.
For the $config check, I need to find a way to "ask" the plugins about which functions are provided, and if no plugin provide a "port_container" function, then I don't need to display the "plugin" menu_option at all. For the moment, the $config option does that manually.
I'll review the code following those recommandation and come back to you.
Hi @laf ,
I added a method in Plugins.php to count the number of Plugins implementing a specific hook. This allow to display the "Plugins" menu_option automatically as soon as at least a plugin implements it.
I also corrected the Plugin itself to use LibreNMS community instead of a specific $config new param.
And the push to https://github.com/librenms-plugins is on it's way.
Cannot make it creating a PR to https://github.com/librenms-plugins . In fact, I cannot even clone it. Do I miss something or the rights do not allow me to clone it ?
If you like, you can directly pick https://github.com/PipoCanaja/InterfaceAdminPlugin and add it to the https://github.com/librenms-plugins .