Extension of the Plugin Structure

Hi,

My company need to allow the IT support team to “shut/no shut/clear port security/change VLANs” on the user ports of the infrastructure.
LibreNMS already knows about all the infrastructure, can already filter “Customer” (which is used as “User Ports” in my case) vs “Core” ports, and only the “functions” to actually SNMP/SSH write on the device are missing. As I know these functions are clearly out of scope of a monitoring system, and will be completely specific to our network devices, that looks like a good plugin project.

But for this, I had to extend the plugin scheme to allow a “plugin” tab added to each port.
And in this tab, plugins are loaded like in the device page :

public function port_container($device, $port) {
// my port container code to shut/no shut goes here
}

Exemple

Of course, this is graphically very basic for the moment, we need first to validate a proof of concept. Then, if we can cover all the features, we’ll finish the ergonomy.

In the plugin code, I can filter the type of devices, type of port, status, description, speed etc etc to decide to display or not the buttons, and allow or not the IT Support team to make changes. With AJAX and some SNMP or SSH magic for the job to be done.

One question :

  • Would the community be interested in the (fairly small) changes we make in the port page to allow plugin to push containers ? Of course, having these changes pushed in the main repo would allow us to keep in line with daily updates so I am more than ready to do what is needed for this pull request to happen and be accepted.

Bye for now

4 Likes

Hi,

I submitted a PR with this new hook for plugins in the port page. The PR includes an update in the Test Plugin as well to show where the plugins will end up displaying there code.

This Plugin menu_option is displayed only if new config_parameter “$config[‘enable_ports_plugins’] = 1;” is added to the config.php file. A better and cleaner solution would of course be to display this Plugin menu option if and only if at least 1 plugin is loaded and is implementing the port_container function.

@Developpers: what do you think ?

PluginMenuOptionWithTestPluginEnabled

All merged in. Thanks.