Considerations on Plugins Development
Introduction
Plugins allow Pandora FMS to get information that requires complex processes or that requires the use of complex systems or APIs. A plugin example could be Oracle® database monitoring, which requires a full process for monitoring and also some auto-discovery tasks. Another example could be a simple HTML parse, but that requires some that Goliat (checking web server) cannot do.
Differences in Implementation and Performance
Pandora FMS offers two possibilities when executing plugins: execution in the Software agent or in the server.
- Server plugins do independent executions to collect each information piece. The server plugin execution is very difficult so it is only possible for “light” plugins, that is, that does need few or very few queries to get a single piece of information. A server plugin could be an specific HTML parse plugin that requires 2 or 3 queries and so it will charge a little job on the server.
- Software agent plugins allow to obtain several modules at the same time and for that reason they are much more flexible than server plugins. They are perfect for plugins that need several queries to get an information piece; they allow more flexibility to programmers so it is possible to return several modules at the same time.
Recon Tasks
To do recon tasks on plugins that need it, there are two possibilities:
The first one consists on using Pandora server Recon Task server. To that end, it will be necessary to create the ad-hoc code for the specific technology or situation. The Recon Tasks loads Pandora server, so, if for doing the recon task a lot of data requests are necessary, this option should not be considered.
It is also possible to create a recon task using an agent plugin. Usually, agent plugins return modules that are attached to the XML that the agent sends to Pandora server. But, consider that when installing the agent in a machine with it, Tentacle is also installed, and this allows to send XML to Pandora server. To do a recon task from an agent plugin, it is possible to use this, and besides adding the modules to the agent as a common plugin does, to give your plugin the capacity to send XML to Pandora with the information of other agents updated as a recon task would do.
The idea is that the plugin, besides creating average modules, collects the information and creates and sends the XML simulating other installed agents if necessary.
The reason to create a plugin that sends data through XML and besides does recon task is to distribute the monitoring load among different machines and not centralize it into the server.
Server Plugin or Agent Plugin?
A server plugin should be used when:
- The execution load is small, for example, simple queries.
- If the Recon Task requires low data process.
- If the Recon Task execution intervals are large, for example, once a week
An agent plugin will be used when:
- The information collection requires lots of processing or lots of queries.
- The associated Recon Task requires a high process load or lots of queries.
- Recon Task execution intervals are close to the common execution intervals for agents, for example, every 5 minutes.
Standardization in Development
In order for all plugins to be as standard as possible, and for them to have similar features, you should consider the following aspects:
Plugin and Extension Versioning
Pandora FMS follows a system of versions for plugins that has the following format:
v1r1
Being:
vX
: Plugin version, switching from one version to another is made when a new important feature is added or an error that makes impossible the proper performance of the plugin is corrected. The first version is alwaysv1
.rY
: Reviewing the plugin, the transition from one revision to another takes place when a bug is fixed or a minor feature is implemented. The first revision is alwaysr1
.
When there is a change to a new version, it should be started by the first revision, that is, if a plugin is in v1r5
version and to get a higher version, then the version becomes v2r1
.
Usage and Plugin version
All plugins should respond to a call without parameters or with a short option type -h
or long type -help
, showing the command for its execution and its different parameters. Besides, it will be necessary to show the plugin version.
./myplugin myplugin version: v1r1 Usage myplugin <param1> <param2> <param3>