Discord Alerts Old - CPNV-ES-MAS3-X/Pandora-Containerization GitHub Wiki
Discord Notification when Alerts Trigger
This is an older version of the documentation, please check the new one : https://github.com/CPNV-ES-MAS3-X/Pandora-Containerization/wiki/Discord-Alerts
This documentation was followed for this : https://pandorafms.com/guides/public/books/discord-integration
Download requierements from the Pandora FMS Library
[Discord connector CLI](https://pandorafms.com/library/discord-connector-cli/)
Once that's done we have to create a discord server and generate a webhook, on a text channel you click on the settings and then integrations.
With the pandora_discord_cli folder, unzip and move the files to the Pandora FMS Server
Execute the following command
pip3 install -r requirements.txt
Once that's done we can test that its communicating with discord with a basic test alert
python3 pandora_discord_cli.py -u -d "Data=5, Agent=Test, Module=Ping"
Then we can try a more customized alert
#Exetution example
python3 pandora_discord_cli.py -d "Agent=Server22,Module=test_module,Group=Servers,State=Critical,Data=22,Timestamp=2020-11-04 11:14:00" \
-u https://discord.com/api/webhooks/1116823326279606455/TaqkAC6ocSZJQF6NOW01hDxqhoV0LxW7x4v6ijdcuHr7pcvu9EVeL8-VWZVHO4WZkkOq \
--tittle_color ed2512 \
--footer "PandoraFMS Alert" \
-A "Sauron Systems" \
--author_icon_url "https://pandorafms.com/wp-content/uploads/2019/04/software-de-monitorizacion-pandorafms-logo.png" \
-m "We have bad news for you. Something is on CRITICAL status 2" \
--author_url https://pandorafms.com/ \
-D "Module test is going to critical" \
--thumb https://pandorafms.com/images/alerta_roja.png \
--avatar_url https://pandorafms.com/images/alerta_roja.png \
--api_conf "user=admin,pass=pandora,api_pass=pandora,api_url=http://10.10.110.150/pandora_console/include/api.php" \
--module_graph "module_id=6266, interval=3600" \
--tmp_dir /tmp
Then we create a new command in pandora with the following fields
Command :
python3 /usr/share/pandora_server/util/plugin/pandora_discord_cli.py -u "_field1_" -d "_field2_" -D "_field3_" --tittle_color _field4_ --thumb _field5_ --api_conf "_field6_" -A "Pandora FMS Alert system" --footer "PandoraFMS" --author_icon_url "https://pandorafms.com/wp-content/uploads/2019/04/software-de-monitorizacion-pandorafms-logo.png" --author_url https://pandorafms.com/ --tmp_dir /tmp
Field 1 : https://discord.com/api/webhooks/1116823326279606455/TaqkAC6ocSZJQF6NOW01hDxqhoV0LxW7x4v6ijdcuHr7pcvu9EVeL8-VWZVHO4WZkkOq
Field 2 : AgentName=_agentalias_,ModuleName=_module_,AgentGroup=_agentgroup_,Status"_modulestatus_,Dat a=_data_,Timestamp=_timestamp_
Field 3 : Agent_agentalias_is in status _modulestatus_
Field 4 : ed2512
Field 5 : https://pandorafms.com/images/alerta_roja.png
Field 6 : user=user=admin,pass=HKbmNqpEaj3WG7WT4ksj,api_pass=pandora,api_url=http://10.0.3.10/pandora_console/include/api.php
Then we link it to a module and an agent and force the execution of the alert
And this is the result on discord