[collectd] Collectd extension - dynamic loading / unloading of the plugin
radekx.malcic at intel.com
Mon Feb 27 13:12:49 CET 2017
I would like to know your opinion to this proposal:
Requirement is, that it should be possible to load / unload a plugin dynamically. The ability to monitor the Network Function Virtualization Infrastructure (NFVI) where VNFs are in operation will be a key part of Service Assurance within an NFV environment, in order to enforce SLAs or to detect violations, faults or degradation in the performance of NFVI resources so that events and relevant metrics are reported to higher level fault management systems. A key part of this will be the ability to modify the configuration of the monitoring agent (in this case collectd) on the fly, as well as the configuration of the resources that are being monitored without restarting the monitoring agent (as you would lose other metrics/events during the restart period).
With this new functionality, it will be possible to load all plugins dynamically. But when the dynamic loading of the plugin fails, we must avoid using this plugin. We have two possibilities: shut down the collectd or keep the plugin loaded but skip all its callbacks. For the second option there is a possibility to load the plugin again with the new configuration, but there can be problem with memory leaks during configuration of the plugin. The decisions is up the user and the behavior can be handled by an upper layer application.
When the plugin needs to be unloaded dynamically, the plugin must clean the memory used by the plugin. In case that plugin does not have a proper shutdown callback, then new dynamic unload functionality cannot be used, because it could cause a memory leaks. Such behavior is unacceptable. This is the reason why we propose the new plugin registration function. This function will register plugin to the list of plugins, which supports dynamic unload. And only this registered plugin can use the new unload functionality. All those, who want to use this new unload functionality, would have to update requested plugin.
When collectd is started it loads the whole configuration. During parsing of the configuration it loads all configured plugins. When the plugin is loaded, collectd calls plugin function "module_register" and the plugin can register its callback to the read/write threads. If the plugin needs configuration data, the daemon sends the configuration to the plugin afterwards. Then collectd drops all configuration data, performing the initialization of all plugins and starts read/write threads.
As we need to load plugin dynamically, there is the problem, that the plugin can be registered to the read/write threads (or other callbacks) before it gets proper configuration information. But read/write threads are already running (and other callback can be called too). And the plugin callbacks can be called while the plugin is not properly configured. The solution is to skip all plugin callbacks until the plugin will be properly configured and ready to work.
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the collectd