Discord integration

Discord is a social network quite oriented to games but covering other important areas such as music, education and of course science and technology. Pandora FMS, by means of alerts, will be able to keep an eye on the monitored devices while you play or entertain yourself.

Configuration in Discord: creation of a server

To integrate Pandora FMS with Discord you need a server and a channel, in this case a text channel. Although you can use a server that you already have, here it is explained the creation of one: in the left sidebar locate the Add server button and it will open a small assistant that will inquire the purpose of the new server.

image-1629795907472.png

Set a server name (mandatory) and an identifying image (optional):

image-1629795933218.png

For practical purposes it is better to have an exclusive channel for Pandora FMS alerts, although you can use one you already have. To create a text channel click on the "+" button that accompanies the statement:

image-1629795963197.png

Enter a suitable name for the new text channel:

image-1629795990577.png

Remember to send an invitation to the server and channel to the people who make up your work department.

Configuration in Discord: creation of a connection link

A webhook must be created, which will be in charge of "listening and fishing" the alert messages emitted by Pandora FMS through a connection link. To create a webhook you should edit the text channel that was created in the previous page:

image-1629796078208.png

In the dialog box that appears, select Integrations and then Create Webhook:

image-1629796102331.png

Next type a name for the new webhook, if desired select an image for it. Then click on the Copy Webhook URL button and save it as it will be needed on the next page. Finally in Discord, save the webhook on the Save Changes button.

image-1629796139191.png

 

Pandora FMS configuration: creation of an alert command

In the Pandora FMS Library you can find the integration with Discord as well as a detailed documentation in case you need more instructions. Essentially you must have python3 and pip3 installed to comply with the dependencies. Download and unzip the package and inside that newly created folder install the additional requirements:

pip3 install -r requirements.txt

Once this is done you can invoke the help by means of python3 pandora_discord_cli.py -h . It is recommended to test from the same command line with the connection link (webhook-url) obtained in the previous page:

python3 pandora_discord_cli.py -u <webhook-url> -d "Data=5, Agent=Test, Module=Ping"

Wait a few moments and go to Discord, you should get something like the following screenshot:

image-1629796461013.png

Make sure that the integrator is in the following path: /usr/share/pandora_server/util/pandora-discord (or where the Pandora FMS server has access to it). To create an alert command go to the Pandora FMS Web Console and click on Alerts -> Commands -> Create.

image-1629796854595.png

Configure each of the seven fields that the command needs; in the test-exec file that accompanies the Discord connector CLI you can get each of them. Pay attention to the field number one, which must contain, in a hidden way, the connection link of the webhook of the text channel created in Discord. Add the group that will be able to access the sending of alerts.

image-1629797096884.png

Press the Update button to save and go to the next step, the creation of an alert action.

 

Pandora FMS configuration: creating an alert action

The alert actions allow you to define how to launch the command. Go to menu Alerts -> Actions -> Create.

image-1629797409258.png

Select in Command the alert command created on the previous page, the fields will be filled in automatically. However, you can always customize the icons or messages for the Triggering and Recovery events, e.g. color, etcetera.

image-1629797440980.png

To save click on Update. To apply this action to either a Module or Policy, set up an alert template for this purpose.