Use in Pandora FMS
The first thing we should do is to upload the script to an accessible path in the machine where we have deployed the Pandora FMS server, in my case I will place it in/usr/share/pandora_server/util/pandora-telegram-cli.py. However, you can use any location as long as the pandora server has access to it.
Also, we must make sure that we have the dependencies installed for the plugin execution or that we have the compiled version in its default. To check it we simply execute the plugin without any parameter, which should give us an answer similar to:
python3 pandora-telegram-cli.py
In case you have any error, go to the plugin configuration section of this guide where it is described how to install the dependencies.
Having the plugin in the server and working correctly, now we have to declare it in the Pandora FMS web console.
Once we access as administrator (or with alert management permissions) we will go to the Alerts > Commands section.
Click on create new command.
Here we will define the execution of the script and the parameters that we will use making use of the PandoraFMS macros.
My definition will be:
Here we define a field for each parameter that the plugin will have. If we don't want to use any of the optional parameters we can simply leave them blank, or not define them at all.
Now we can go to configure the action using our command. We go to Alerts > Actions.
Click on Create.
We select the command we want to use, in this case the one we have just created for the Telegram bot.
Here we can define and modify the fields corresponding to the fields that we have defined, I have left it as default configuration in the command, so we can use it with what we have defined, but we can change it at the level of specific actions if we want to change the data that is sent for each action and change the trigger text and the recovery text.
Having the action configured we can simply go to a module or policy and apply this action with the corresponding template.
For more information about alerts configuration go to PandoraFMS official documentation: