How to Monitor Connext Router with Zabbix and send alert to Discord

Nunoy Nungning
6 min readJun 1, 2022

--

Step 1: Install Mysql-server, Zabbix, Zabbix-agent

Download script from :

wget -q -O zabbixsetup.sh https://raw.githubusercontent.com/NunoyHaxxana/Router-Connext-Quests-3/main/zabbixsetup.sh && chmod +x zabbixsetup.sh && sudo /bin/bash zabbixsetup.sh

When finished install, Please note output for use in next step.

Your Hostname for zabbix: xxxxxxx
Your IP Address for zabbix: xx.xx.xx.xx
Your Zabbix DB Password: xxxxxxxxxxxxxx
finished, script show data

Step 2: Zabbix Web Config.

Go to browser insert ip address which must from step 1.

http://IP-Address-for-zabbix/zabbix
Click Next step

Input Zabbix DB Password which must from step 1. to Password field.

Input Zabbix DB Password from step 1. to Password field.

Your can input Zabbix server name you like

Click Next step
Click Finish

Step 3: Zabbix Web.

To monitor a remote host, you need to add it to the Zabbix server’s dashboard via a browser. Zabbix provides myriad templates for various services and applications. We will link the appropriate template to the Docker host to specifically monitor containers. But first, access the Zabbix server’s login page.

User: Admin 
Pass: zabbix
User: Admin Pass: zabbix

Once you have logged in, navigate to the right sidebar and click on ‘Configuration’ then ‘Hosts’. and At the far top-right corner,
click on ‘Create host’.

Fill in the details of the Docker server such as the hostname name. For Groups, Type in ‘Connext’ (every host must be associated with a group).

Fill in the details of the Templates specify ‘Docker by Zabbix agent 2’ and ‘Linux by Zabbix agent

Below the ‘Interfaces’ label click on ‘Add’ and in the menu that appears select ‘Agent’. Next, fill out the server’s private IP address from step 1. and ensure that the port is set to 10055.

Add Docker Server to Zabbix

Now head back to the Zabbix server dashboard. Click on ‘Monitoring’ then ‘Hosts’. Click on the name of your Docker server and in the menu option that appears, select ‘Dashboards’.

After a few minutes, the Zabbix server will detect the container and start populating some statistics.

You can also view the graphs of the various server metrics by clicking on the ‘Dashboard’ options of the ‘System performance’ page. Below you can see the CPU & Memory usage metrics.

Now head back to the Zabbix server dashboard. Click on ‘Monitoring’ then ‘Hosts’. Click on the name of your Docker server and in the menu option that appears, select ‘Latest data’.

Click on ‘container

You can also view the graphs of the various container metrics by clicking on the ‘graphs’ options of the Docker server on the ‘Hosts’ page. Below you can see the CPU & Memory usage metrics.

Step 4: Set Alert to Discord

Setting up Discord Webhook
1. Go to https://discordapp.com/app or open Discord Desktop application. Select your server and channel where you want to get Zabbix notifications.

2. Press Edit channel, select Integrations tab and press Create Webhook button

3. Setup your Discord webhook and press Save.
You can copy Discord webhook URL now or view it later by clicking on Edit button.

4. Setting up Zabbix Webhook
Now head back to the Zabbix server dashboard. Click on ‘Administration’ then ‘General’. Click on the name of menu ‘Macros’.

You need to setup the global macro “{$ZABBIX.URL}”, which must contain the URL to the Zabbix frontend.
The URL should be either an IP address, a fully qualified domain name or localhost. Specifying a protocol is mandatory, whereas port is optional.
http://xx.xx.xx.xx/zabbix/

5. Setting up Discord Function
Now head back to the Zabbix server dashboard. Click on ‘Administration’ then ‘Media types’. Click on the name of menu ‘Discord’.

You need to setup the Parameters “discord_endpoint”, which must contain the URL from Your discord Webhook. and update

6. Setting up User Alert
Now head back to the Zabbix server dashboard. Click on ‘Administration’ then ‘User’. Click on the Username ‘Admin’.

You need to choose the Type “Discord”, and setup the “Send to” which must contain the URL from Your discord Webhook. and Add

Click Update

7. Setting up Tigger Alert
Now head back to the Zabbix server dashboard. Click on ‘Configuration’ then ‘Action’. Click on the menu ‘Trigger actions’. and Click on the menu

You need to setup the Name “Discord Alarm

Click on ‘Operations
You need to setup the Operations Click on ‘Add

You need to setup the Parameters which must contain
Send to user groups which must contain : Zabbix administrators
Send to users which must contain : Admin
Send only to which must contain : Discord

Make sure your setup all both
- Operations
- Recover operations
- Update operations

Click Add

Step 5: Test Alarm and Alert to Discord

Test with down docker.

On zabbix alarm show docker stopped
Alert Problem send to discord

Test with Start docker.

On zabbix show alarm Resolved
Alert Recovery send to discord

--

--