1. Home
  2. DEVOPS
  3. Zabbix মনিটরিং
  4. 📊 Zabbix Server Monitoring – সম্পূর্ণ গাইড

📊 Zabbix Server Monitoring – সম্পূর্ণ গাইড


🧠 ZABBIX MASTER GUIDE (বাংলা)

৩টি VPS দিয়ে একদম শূন্য থেকে প্রো-লেভেল মনিটরিং শেখা


📑 Table of Contents

1️⃣ Zabbix কী ও কেন লাগে
2️⃣ Real-world Story (গল্প দিয়ে বোঝা)
3️⃣ Architecture সম্পূর্ণ বোঝা
4️⃣ আমাদের Practical Setup (3 VPS Layout)
5️⃣ Zabbix Server Install (VPS1)
6️⃣ Zabbix Agent Install (VPS2, VPS3)
7️⃣ Web UI Setup & Hosts Add
8️⃣ Templates Attach করা
9️⃣ Telegram Alert Setup
🔟 Dashboard, Graphs & Reports
1️⃣1️⃣ Advanced Monitoring (Website, SSL, DB, Logs)
1️⃣2️⃣ Troubleshooting (Common Errors & Fix)
1️⃣3️⃣ Security Best Practices
1️⃣4️⃣ Mobile Monitoring
1️⃣5️⃣ Advanced Topics (API, Proxies, Automation)
1️⃣6️⃣ Monitoring Checklist & Key Metrics
1️⃣7️⃣ Quick Setup Copy-Paste Scripts
1️⃣8️⃣ Final Verification Checklist


🔍 1️⃣ Zabbix কী ও কেন লাগে?

🧩 Zabbix কী?

Zabbix = একটি Enterprise Monitoring System
এটি আপনার:

  • সার্ভারের CPU, RAM, Disk, Network মনিটর করে
  • Website, Database, Application health চেক করে
  • কোনো সমস্যা হলে সাথে সাথে Alert পাঠায়
  • সুন্দর Dashboard ও Graph দেয়
  • Log, Performance, Availability সব track করে

🎯 কেন Zabbix লাগে? (বাস্তব গল্প)

❌ Zabbix ছাড়া (খারাপ গল্প)

আপনার একটা ecommerce ওয়েবসাইট আছে।
রাতে ২টায় VPS hang হয়ে গেছে।
আপনি জানেন না।
সকালে উঠে দেখলেন:

  • ২ ঘন্টা সাইট ডাউন ছিল
  • ১০০+ অর্ডার মিস
  • ক্লায়েন্ট রেগে গেছে

✅ Zabbix থাকলে (ভালো গল্প)

রাতে ২:০১ AM এ আপনার Telegram এ মেসেজ এল:

🚨 PROBLEM: VPS2 CPU Load High
CPU Load: 3.45
Action Required Immediately!

আপনি সঙ্গে সঙ্গে VPS এ ঢুকে service restart করলেন।
Downtime = ৩ মিনিট।
কাস্টমার বুঝতেই পারল না।
Business safe 😎


🏗️ 2️⃣ Zabbix Architecture (একদম সহজ ভাষায়)

[Your Browser / Mobile]
         
  Zabbix Web UI
         
  Zabbix Server (VPS1)
         
 ┌───────────────┐
    Database    
 └───────────────┘
         
 ┌──────────┬──────────┐
  VPS2      VPS3     
  Zabbix    Zabbix   
  Agent     Agent    
 └──────────┴──────────┘

🎯 কে কী কাজ করে?

Componentকাজ
Zabbix Serverসব data collect, trigger check, alert পাঠায়
Zabbix Agentনিজের VPS এর metrics সংগ্রহ করে
Databaseসব history ও config রাখে
Web UIআপনি যেখানে graphs, alerts দেখেন
Telegram Botআপনাকে real-time alert পাঠায়

🖥️ 3️⃣ আমাদের Practical Setup (3 VPS)

VPSIPRole
VPS172.62.198.140Zabbix Server + DB + Web UI
VPS262.72.0.153Zabbix Agent (Production server)
VPS372.61.78.206Zabbix Agent (Backup/Test server)

⚙️ 4️⃣ Zabbix Server Install (VPS1)

⏱️ সময়: ~20-30 মিনিট
🎯 সব কমান্ড VPS1 এ রান করবেন


🔹 Step 1: SSH করুন

ssh root@72.62.198.140

🔹 Step 2: System Update

apt update && apt upgrade -y

🔹 Step 3: Zabbix Repository Add

wget https://repo.zabbix.com/zabbix/7.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.4-1+ubuntu24.04_all.deb
dpkg -i zabbix-release_7.4-1+ubuntu24.04_all.deb
apt update

🔹 Step 4: Zabbix Server + Frontend + Agent + MySQL Install

apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent mysql-server

🔹 Step 5: MySQL Database Setup

mysql -uroot
CREATE DATABASE zabbix character set utf8mb4 collate utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'StrongPass123!';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EXIT;

🔹 Step 6: Initial Database Schema Import

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pStrongPass123! zabbix

🔹 Step 7: Zabbix Server Configuration

nano /etc/zabbix/zabbix_server.conf

Change:

DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=StrongPass123!
StartPollers=4
CacheSize=32M
HistoryCacheSize=16M

🔹 Step 8: Services Start

systemctl enable --now zabbix-server zabbix-agent apache2

🔹 Step 9: Firewall Open

ufw allow 80/tcp
ufw allow 443/tcp
ufw allow 10051/tcp

🔹 Step 10: Web UI Access

Browser এ যান:

http://72.62.198.140/zabbix

Setup Wizard:

  • DB: zabbix / StrongPass123!
  • Server: localhost / 10051

Login:

Username: Admin
Password: zabbix

🔧 5️⃣ Zabbix Agent Install (VPS2 & VPS3)

⏱️ সময়: ~10 মিনিট প্রতি VPS


🔹 VPS2 এ Agent Install

ssh root@62.72.0.153
apt update && apt upgrade -y
wget https://repo.zabbix.com/zabbix/7.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.4-1+ubuntu24.04_all.deb
dpkg -i zabbix-release_7.4-1+ubuntu24.04_all.deb
apt update
apt install -y zabbix-agent

🔹 Agent Config

nano /etc/zabbix/zabbix_agentd.conf

Change:

Server=72.62.198.140
Hostname=VPS2
ListenIP=0.0.0.0

🔹 Start Agent

systemctl enable --now zabbix-agent
ufw allow 10050/tcp

🔹 Test from VPS1

zabbix_get -s 62.72.0.153 -k "system.uptime"

Output আসলে success।


🔹 VPS3 এ একই কাজ করুন (শুধু Hostname ও IP বদলাবেন)

Server=72.62.198.140
Hostname=VPS3
ListenIP=0.0.0.0

🖥️ 6️⃣ Web UI Setup & Hosts Add

Zabbix Web UI তে যান →
Configuration → Hosts → Create Host


🔹 VPS2 Add

  • Host name: VPS2
  • Visible name: VPS2 – Production
  • Group: Linux servers
  • Interface: Agent → IP: 62.72.0.153 → Port: 10050

🔹 VPS3 Add

  • Host name: VPS3
  • Visible name: VPS3 – Backup
  • Group: Linux servers
  • Interface: Agent → IP: 72.61.78.206 → Port: 10050

🔹 VPS1 Add (Local monitoring)

  • Host name: Zabbix Server
  • Interface: Agent → IP: 127.0.0.1

📋 7️⃣ Templates Attach করা

Each host → Templates tab:

Attach:

  • VPS2 → Linux by Zabbix agent
  • VPS3 → Linux by Zabbix agent
  • VPS1 → Zabbix server by Zabbix agent

👉 এখন থেকেই CPU, RAM, Disk, Network auto-monitor হবে।


📱 8️⃣ Telegram Alert Setup (একদম Practical)


🔹 Step 1: Telegram Bot তৈরি

Telegram এ:

  • Search: @BotFather
  • /newbot
  • Name: MyZabbixBot
  • Username: MyZabbixBot_2024

👉 Token কপি করুন।


🔹 Step 2: Chat ID নিন

Search: @userinfobot → Start → ID কপি করুন।


🔹 Step 3: Alert Script তৈরি (VPS1 এ)

nano /usr/lib/zabbix/alertscripts/telegram.sh
#!/bin/bash

CHAT_ID=$1
MESSAGE=$2
BOT_TOKEN="PASTE_YOUR_TOKEN_HERE"

MESSAGE=$(echo "$MESSAGE" | sed 's/ /%20/g')

curl -s -X POST \
  https://api.telegram.org/bot$BOT_TOKEN/sendMessage \
  -d chat_id=$CHAT_ID \
  -d text="$MESSAGE"

exit 0
chmod +x /usr/lib/zabbix/alertscripts/telegram.sh

🔹 Step 4: Test Script

/usr/lib/zabbix/alertscripts/telegram.sh YOUR_CHAT_ID "Test message from Zabbix"

Telegram এ message এলে success।


🔹 Step 5: Media Type Add (Web UI)

Administration → Media Types → Create:

  • Name: Telegram
  • Type: Script
  • Script name: telegram.sh
  • Parameters:
    • {ALERT.SENDTO}
    • {ALERT.MESSAGE}

🔹 Step 6: User Media Add

Administration → Users → Admin → Media:

  • Type: Telegram
  • Send to: YOUR_CHAT_ID
  • Severity: Average, High, Disaster

🔹 Step 7: Trigger তৈরি (CPU High Example)

VPS2 → Triggers → Create:

  • Name: CPU Load Too High
  • Expression: {VPS2:system.cpu.load[all,avg1]}>2
  • Severity: High

🔹 Step 8: Action তৈরি

Configuration → Actions → Create:

  • Name: Send Telegram Alert
  • Condition: Trigger severity ≥ High
  • Operation: Send message to Admin

🔹 Step 9: Test Alert

VPS2 এ:

apt install -y stress
stress --cpu 4 --timeout 60s

👉 Telegram এ alert আসবে 🎉


📊 9️⃣ Dashboard, Graphs & Reports

Monitoring → Dashboard → Edit

Widgets Add:

  • Host Status
  • CPU Usage Graph (VPS2)
  • Memory Usage Graph
  • Disk Space Graph
  • Problems Widget

👉 এখন আপনি real-time সব দেখতে পারবেন।


📈 🔟 Graphs & Reports

Monitoring → Graphs → Host: VPS2 → CPU load → Last 24h

Weekly trend দেখুন, peak hours বুঝুন, scaling decision নিন।


🧪 1️⃣1️⃣ Advanced Monitoring


🌐 Website Monitoring

Item:

  • Type: Simple check
  • Key: web.page.get[example.com]

Trigger:

  • If no response → Website Down Alert

🔐 SSL Expiry Monitoring

Item:

  • Key: web.cert.expiry[example.com,443]

Trigger:

  • < 7 days → SSL Renew Alert

📊 Database Monitoring

MySQL QPS, Slow queries, Connections, Replication status।


📄 Log Monitoring

Agent config:

UserParameter=app.log.errors,grep -i "error" /var/log/app.log | wc -l

Trigger:

  • If > 0 → Alert

🚨 1️⃣2️⃣ Troubleshooting (Real Fixes)


❌ Problem: Host shows “Not Available”

systemctl status zabbix-agent
tail -f /var/log/zabbix/zabbix_agentd.log
ufw status

Fix:

  • Server IP correct?
  • Port 10050 open?

❌ Problem: No Data

zabbix_get -s VPS_IP -k "system.uptime"
systemctl restart zabbix-agent

❌ Problem: Telegram Not Working

/usr/lib/zabbix/alertscripts/telegram.sh CHATID "Test"
tail -f /var/log/zabbix/zabbix_server.log
apt install -y curl

🔐 1️⃣3️⃣ Security Best Practices

  • Default Admin password change করুন
  • HTTPS enable করুন (Let’s Encrypt)
  • Firewall restrict করুন
  • Weekly DB backup নিন

Backup:

mysqldump -uzabbix -pStrongPass123! zabbix > /backup/zabbix.sql
tar -czf /backup/zabbix_config.tar.gz /etc/zabbix/

📱 1️⃣4️⃣ Mobile Monitoring

Play Store / App Store → Zabbix App

Server: http://72.62.198.140/zabbix
Login: Admin / newpassword

👉 Mobile থেকেই alerts, graphs, problems দেখবেন।


🎓 1️⃣5️⃣ Advanced Topics

  • Zabbix API দিয়ে automation
  • Zabbix Proxy (large infra)
  • Auto-discovery
  • Auto-registration
  • Maintenance windows
  • SLA Reports

📊 1️⃣6️⃣ Monitoring Checklist

Daily:

  • Dashboard check
  • New alerts review

Weekly:

  • Graphs analyze
  • Disk growth check

Monthly:

  • Reports generate
  • Backup verify

Key Metrics:

  • CPU load
  • RAM usage
  • Disk space
  • Network traffic
  • Service uptime
  • Website response time

🚀 1️⃣7️⃣ Quick Setup: Copy-Paste Scripts


🔹 VPS1 Server Setup Script

#!/bin/bash

apt update && apt upgrade -y
wget https://repo.zabbix.com/zabbix/7.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.4-1+ubuntu24.04_all.deb
dpkg -i zabbix-release_7.4-1+ubuntu24.04_all.deb
apt update
apt install -y zabbix-server-mysql zabbix-frontend-php zabbix-apache-conf zabbix-agent mysql-server

mysql -uroot <<EOF
CREATE DATABASE zabbix character set utf8mb4 collate utf8mb4_bin;
CREATE USER 'zabbix'@'localhost' IDENTIFIED BY 'StrongPass123!';
GRANT ALL PRIVILEGES ON zabbix.* TO 'zabbix'@'localhost';
FLUSH PRIVILEGES;
EOF

zcat /usr/share/doc/zabbix-server-mysql*/create.sql.gz | mysql -uzabbix -pStrongPass123! zabbix

sed -i 's/# DBPassword=/DBPassword=StrongPass123!/g' /etc/zabbix/zabbix_server.conf

systemctl enable --now zabbix-server zabbix-agent apache2
ufw allow 80/tcp 443/tcp 10051/tcp

🔹 VPS2/VPS3 Agent Script

#!/bin/bash

SERVER_IP=72.62.198.140
HOSTNAME=VPS2  # or VPS3

apt update && apt upgrade -y
wget https://repo.zabbix.com/zabbix/7.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_7.4-1+ubuntu24.04_all.deb
dpkg -i zabbix-release_7.4-1+ubuntu24.04_all.deb
apt update
apt install -y zabbix-agent

sed -i "s/Server=127.0.0.1/Server=$SERVER_IP/g" /etc/zabbix/zabbix_agentd.conf
sed -i "s/Hostname=Zabbix server/Hostname=$HOSTNAME/g" /etc/zabbix/zabbix_agentd.conf
sed -i 's/ListenIP=127.0.0.1/ListenIP=0.0.0.0/g' /etc/zabbix/zabbix_agentd.conf

systemctl enable --now zabbix-agent
ufw allow 10050/tcp

✅ 1️⃣8️⃣ Final Verification Checklist

✔ Web UI accessible
✔ VPS2, VPS3 status = Available
✔ CPU/RAM/Disk graphs visible
✔ Telegram alert working
✔ Stress test triggers alert
✔ Dashboard showing data
✔ Backup working


🎉 Congratulations!

এখন আপনি:

  • ৩টি VPS মনিটর করতে পারেন
  • Real-time alert পান
  • Advanced metrics ট্র্যাক করেন
  • Zabbix architecture বোঝেন
  • Production-ready monitoring setup করতে পারেন

আপনি চাইলে আমি পরের ধাপে দিতে পারি:

✅ Zabbix Proxy Setup
✅ Auto-Discovery Setup
✅ SLA Reports তৈরি
✅ Kubernetes / Docker monitoring
✅ CI/CD monitoring integration
✅ Custom alert templates
✅ Zabbix API automation scripts

বলুন, পরবর্তী লেভেলে কোনটা শিখতে চান? 🚀

How can we help?