Monitoring infrastructure is becoming more important than ever in today's IT world. Organizations run the danger of system outages, performance problems, and security flaws that could have an immediate effect on company operations if they don't have enough monitoring. One notable open-source monitoring tool that offers extensive infrastructure monitoring features is Zabbix. Although Zabbix has many features and capabilities, we will be configuring its fundamentals in this post so that we may begin monitoring our main office environment.
Zabbix server install
Zabbix Server is available on many Linux distributions: CentOs, Debian, OpenSUSE, Red Hat etc. We will use Ubuntu.
We have an Ubuntu VM with the following specs:
IP Settings:
IP Address: 10.100.100.56
Subnet Netmask: 255.255.255.0
Gateway: 10.100.100.1
then navigate to: Zabbix Install and choose your platform, for our case, it will be Ubuntu:
Then we will be provided with the commands for the installation and configuration:
- Start a new shell session with root privileges.
sudo -s
Install Zabbix repository
wget https://repo.zabbix.com/zabbix/7.2/release/ubuntu/pool/main/z/zabbix-release/zabbix-release_latest_7.2+ubuntu24.04_all.deb
dpkg -i zabbix-release_latest_7.2+ubuntu24.04_all.deb
apt update
Install Zabbix server, frontend, agent
apt install zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-sql-scripts zabbix-agent
Create initial database
Make sure you have the database server up and running.
Run the following on your database host.
mysql -uroot -p
password
mysql> create database zabbix character set utf8mb4 collate utf8mb4_bin;
mysql> create user zabbix@localhost identified by 'password';
mysql> grant all privileges on zabbix.* to zabbix@localhost;
mysql> set global log_bin_trust_function_creators = 1;
mysql> quit;
On Zabbix server host import initial schema and data. You will be prompted to enter your newly created password.
zcat /usr/share/zabbix/sql-scripts/mysql/server.sql.gz | mysql --default-character-set=utf8mb4 -uzabbix -p zabbix
Disable log_bin_trust_function_creators option after importing database schema.
mysql -uroot -p
password
mysql> set global log_bin_trust_function_creators = 0;
mysql> quit;
Configure the database for Zabbix server
Edit file /etc/zabbix/zabbix_server.conf
DBPassword=password
Start Zabbix server and agent processes
Start Zabbix server and agent processes and make it start at system boot.
systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2
Open Zabbix UI web page
The default URL for Zabbix UI when using Apache web server is http://host/zabbix
Once those steps are complete we can open the Zabbix UI:
Default credentials:
Username: Admin
Password: zabbix
Let’s create our user:
Go to Users > Users > Create user:
Set parameters for the user:
Username
Name
Last name
Groups
Password
Let’s go to Permissions now:
- Role: Super admin role
Scroll down and hit Add
We then have our user created: bbm-admin
Configure Hosts
Configure Windows Server Agent/Host
Let’s navigate to: Zabbix Agents Download
Select Windows > Any > amd64 > 7.2 > OpenSSL > MSI
Select Download
After it’s downloaded let’s open and run the installer:
Settings:
Host name (our server/device): BBM-DC01
Zabbix Server IP/DNS: 10.100.100.56
Agent listen port: 10050 (we will need to open this port on Windows Firewall but for the sake of the post we will leave the Windows Firewall completely disabled)
Server or Proxy for active checks: 127.0.0.1
Now there are 2 ways a host (in this case BBM-DC01) will communicate with Zabbix:
Passive checks: it will be initiated by the Zabbix server (communication will be inbound on Windows Server)
Active checks: it will be initiated on the device (communication will be inbound to Windows Server)
let’s configure both, navigate to C:\Program Files\Zabbix Agent and open zabbix_agentd.conf:
Passive checks:
Active checks:
Now let’s configure the host on Zabbix:
Let’s go to Monitoring > Hosts > Create Host
Let’s set the details for the host:
Host name: 10.100.100.10
Templates: Windows by Zabbix agent
Host groups: Virtual machines
Interfaces: Agent: 10.100.100.10 (BBM-DC01 IP) Port: 10050 (default).
Monitored by: Server
Enabled: checked
After it’s created we can find it on the hosts list:
We can select Problems and see any that the device would have:
As we can notice the Memory utilization is > 90% for 5m:
We can also go back and check the graphs:
Let’s go to Latest data:
As we can see there is a ton of information available as well
We can rinse and repeat to have all our Windows devices set up let’s do the same for BBM-FS01 to add it:
Configure Fortigate Agent
For this case, we will use the Simple Network Management Protocol (SNMP):
Community Name: BBM
Enabled
IP Address: 10.100.100.56 255.255.255.255
Host Type: Accept queries and send traps
Queries:
v1 Enabled
Port 161
v2c Enabled
Port 161
Traps:
v1 Enabled
Local Port 162
Remote Port 162
Let’s create now the Host on Zabbix:
Let’s go to Monitoring > Hosts > Create Host
Set the details for the host:
Host name: 10.100.100.1
Templates: Network Generic Device by SNMP
Host groups: Virtual machines
Interfaces: SNMP (and leave the default details)
Monitored by: Server
Enabled: checked
We can check any Problems:
At this point there are not any:
We can check the Graphs:
Dashboard
After the hosts have been set up and enabled, we can go to Dashboards and select Global view
You can also edit the dashboard or even create a new one and share it across teams
Set Email alerts
First, we need to create a Media type, let’s navigate to Alerts > Media types > Create media type
Fill out the requested information with the SMTP, for our case I will use a Gmail account:
We can see Messa templates and edit if needed
Then let’s assign a media type to our user: bbm-admin
Navigate to: Users > Users
Select bbm-admin
Send to: it@beyondbaremetal.com, leave all other settings by default, and hit Add
Now let’s create the Action:
In this case, it will send an alert when the Memory utilization is over 80% for 5 minutes.
Navigate to Alerts > Actions > Trigger actions and Create action
Name: Server High Memory
Conditions:
Label: A
Name: Trigger equals BBM-DC01: Windows: High memory utilization
Go to Operations:
Default operation step duration: 1h
Send message to users: bbm-admin (bbm admin) via all media
Send message to user groups: Zabbix administrators via all media
Recovery operations: send message to user groups: Zabbix administrators via all media (this will send us another notification alert once the problem has been resolved)
Leave all other options by default.
Testing
Let’s test now:
Let’s go to the BBM-DC01 and open many browser tabs so the memory goes above 80%
We can see we get a notification email:
Once the Team took action and solved the problem we got another email informed it is resolved:
Conclusion
In this post, we've implemented Zabbix to monitor our environment. We covered server installation and agent configuration for both Windows servers and Fortigate devices and implemented crucial monitoring features, including dashboard visualization and email alerts. While this setup provides a solid foundation for infrastructure monitoring, Zabbix offers many more advanced features and customization options that will be explored in future posts. Monitoring our environment is a stepping stone in building a robust infrastructure.
Thanks for reading!
Stay tuned for more content.
Link to the series 👉 https://beyondbaremetal.hashnode.dev/series/beyond-bare-metal-setup