A server plugin is a program or script located in the server ( by default in
/usr/share/pandora_server/util/plugin ) and executed by it, to which we can pass a series of parameters. It returns a single simple value, either numeric, boolean or text type.
To use the plugins, we must activate the specific server
pluginserver in the server configuration :
Pandora FMS has by default a few plugins, like
udp_nmap_plugin.sh, but they can also be developed manually. The easiest way to check their operation is to execute them directly from the terminal, as Pandora FMS will do later. In general, the plugins usually include a help when executing them with
-h or without parameters, which facilitates its use.
To use a plugin in Pandora FMS, it is necessary to register it, and this can be done in two ways
It is done in Servers/Plugins. In the menu to create a plugin we must indicate the name (along with other parameters such as the type of plugin, timeout and a description) as well as the command it executes and the parameters to be used with it. These are specified in the Plug-in command (where the full path to the plugin must be indicated) and in the Plug-in parameters (which accept the use of macros), respectively.
For example, if we wanted to create a plugin that executed a UDP remote check using NMAP at the IP address and port we wanted, we would have to complete the registration in this way:
- We would choose as plugin name “UDP Port Check”, for example.
- In Plug-in command, we would write the path
/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh, which leads to a plugin installed by default with Pandora FMS.
- In Plug-in parameters, we would write
-t _field1_ -p _field2_so that the plugin can be reused for all the ports and IP address that we want. Below we can add a description to these macros to know what information they require.
- In the Command preview space we will see how Pandora FMS will execute the command:
/usr/share/pandora_server/util/plugin/udp_nmap_plugin.sh -t _field1_ -p _field2_
We have already registered the plugin. To use it, create a plugin type module in the agent you want to monitor. When you choose it, you will be given the option to choose the information that will replace the
_field2_ macros, in this case, the IP address and the port, respectively.
Take into account that some plugins can take a long time to finish their execution, so the server execution timeout (
pandora_server.conf) should always be higher than any of the values defined in a plugin. Otherwise, the server will stop the execution of the plugin.
Registration through a .pspz file
The PSPZ format was created to abstract the installation of plugins by users without much knowledge. It consists of a
.zip file with a
.pspz extension that contains the script and other files that the plugin needs to work, along with a file called
plugin_definition.ini. This file contains the specification of the plugin and the modules that can be used with it, to incorporate them into the library. It contains the complete interface definition, and when installing it through the console, it copies the plugin to a directory on disk.
The registration with
.pspz files is done from the console, in Servers/Register plug-in, where you will have to upload the file for Pandora FMS to use it. By default, the plugin will be copied on the server where the console is. If the plugin server is in another machine, you will have to copy or synchronize the
/attachment/plugin directory of the console.
- See also: