This guide walks you through self-hosting Grafana and connecting it to Zabbix so you can build custom dashboards for your server metrics. You’ll set up both services, configure the Zabbix data source, and create your first graph. Before starting, you’ll need a Linux server (Ubuntu 22.04 or similar) with root access, a domain or IP address, and basic familiarity with the command line.
What You’ll Need
- A Linux server (Ubuntu 22.04 LTS recommended) with at least 2 GB RAM and 20 GB disk space.
- Root or sudo access to the server.
- A domain name pointing to your server (optional but recommended for HTTPS).
- Ports 80 and 443 open in your firewall if you plan to access the web UI externally.
- Basic knowledge of the command line and text editors (nano or vim).
Step-by-Step
- Update your system – Run
sudo apt update && sudo apt upgrade -yto ensure all packages are current. - Install Zabbix server and agent – Add the official Zabbix repository for your OS version. For Ubuntu 22.04, run:
wget https://repo.zabbix.com/zabbix/6.4/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.4-1+ubuntu22.04_all.deb dpkg -i zabbix-release_6.4-1+ubuntu22.04_all.deb apt update
Then install the server, frontend, and agent:
apt install zabbix-server-mysql zabbix-frontend-php zabbix-nginx-conf zabbix-sql-scripts zabbix-agent. - Set up the Zabbix database – Install MySQL/MariaDB if not present:
apt install mysql-server. Create a database and user:mysql -uroot -p create database zabbix character set utf8mb4 collate utf8mb4_bin; create user 'zabbix'@'localhost' identified by 'your_strong_password'; grant all privileges on zabbix.* to 'zabbix'@'localhost'; quit;
Import the schema:
zcat /usr/share/zabbix-sql-scripts/mysql/server.sql.gz | mysql -uzabbix -p zabbix. Enter your password when prompted. - Configure Zabbix server – Edit
/etc/zabbix/zabbix_server.confand setDBPassword=your_strong_password. Then edit the Nginx config at/etc/zabbix/nginx.confto setlisten 8080;(to avoid conflict with Grafana later) andserver_name your_domain_or_ip;. - Start Zabbix – Run
systemctl restart zabbix-server zabbix-agent nginx php8.1-fpmand enable them on boot:systemctl enable zabbix-server zabbix-agent nginx php8.1-fpm. Access the Zabbix frontend athttp://your_server_ip:8080. Complete the setup wizard (default admin credentials: Admin / zabbix). - Install Grafana – Add the Grafana repository and install:
wget -q -O - https://packages.grafana.com/gpg.key | sudo apt-key add - echo "deb https://packages.grafana.com/oss/deb stable main" | sudo tee /etc/apt/sources.list.d/grafana.list sudo apt update sudo apt install grafana
Start and enable Grafana:
sudo systemctl daemon-reload && sudo systemctl start grafana-server && sudo systemctl enable grafana-server. - Install the Zabbix plugin for Grafana – Run
sudo grafana-cli plugins install alexanderzobnin-zabbix-app. Restart Grafana:sudo systemctl restart grafana-server. - Configure Grafana – Open
http://your_server_ip:3000and log in (default admin / admin). Go to Configuration → Plugins, find the Zabbix plugin, and enable it. - Add Zabbix as a data source – Go to Configuration → Data Sources → Add data source, choose Zabbix. Set the URL to
http://localhost:8080/api_jsonrpc.php(the Zabbix API endpoint). Enter your Zabbix API user and password (use a dedicated API user if possible). Set the trends option to true for better performance. Click Save & Test – you should see a success message. - Create a dashboard with server graphs – Go to Dashboards → New Dashboard. Add a new panel, select the Zabbix data source, and choose a query type (e.g., Items or Trends). Pick a host (e.g., your Zabbix server) and a metric (like CPU utilization or network traffic). Configure the visualization as a time series graph. Save the dashboard.
- Set up HTTPS (optional but recommended) – Install Certbot:
sudo apt install certbot python3-certbot-nginx. Obtain a certificate for your domain:sudo certbot --nginx -d your_domain. Follow the prompts. Certbot will automatically renew the certificate.
Common Mistakes
- Using the wrong Zabbix API URL – The URL must end with
/api_jsonrpc.php, not just the base frontend URL. - Not enabling the Zabbix plugin – After installing, you must enable it in Grafana’s plugin settings before it appears as a data source type.
- Port conflicts – Zabbix’s Nginx and Grafana both default to port 80/3000. Changing Zabbix to 8080 avoids the conflict.
- Database import errors – Ensure you run the SQL import as the
zabbixuser and that the database exists before importing. - Firewall blocking ports – If you can’t access the web UIs, check that ports 8080 and 3000 are open in your firewall (e.g.,
sudo ufw allow 8080/tcp).
Tips
- Use a dedicated Zabbix API user with read-only permissions for Grafana to improve security.
- Enable Zabbix trends (default) for smoother long-term graphs and faster dashboard loading.
- Organize your dashboards by grouping related panels (CPU, memory, disk) using dashboard folders.
- Set up alerting in Grafana for important thresholds, or use Zabbix’s built-in alerting and display them in Grafana.
- Regularly update both Zabbix and Grafana to get the latest features and security fixes.
Troubleshooting
- “Data source connected but no data� – Check that the Zabbix host you’re querying has items with data. In Zabbix, go to Monitoring → Latest data and verify the host is being monitored. Also ensure the Grafana query uses the correct host group and application.
- Login issues after installing Zabbix – If you can’t log in to the Zabbix frontend, reset the admin password using the
zabbix_servercommand-line tool or by editing the database directly. - Grafana plugin not showing – After installing the plugin, restart Grafana and clear your browser cache. If it still doesn’t appear, check the Grafana logs at
/var/log/grafana/grafana.logfor errors. - Nginx returns 502 Bad Gateway – This usually means PHP-FPM is not running. Restart it with
systemctl restart php8.1-fpmand check its status. - Zabbix server fails to start – Check
/var/log/zabbix/zabbix_server.log. Common causes are incorrect database credentials or missing PHP modules. Install required PHP modules:apt install php8.1-mysql php8.1-bcmath php8.1-mbstring php8.1-xml.
Frequently Asked Questions
Can I run Grafana and Zabbix on the same server?
Yes, that’s what this guide does. Just ensure they use different ports (Zabbix on 8080, Grafana on 3000) and that the server has enough resources.
Do I need to install a Zabbix agent on every server I want to monitor?
Yes, to collect metrics from a server, you need to install the Zabbix agent on that server and configure it to report to your Zabbix server. This is separate from the Zabbix server installation.
How do I add a new host to Zabbix after setup?
In the Zabbix frontend, go to Data collection → Hosts, click Create host, fill in the hostname and IP, and link a template (e.g., “Linux by Zabbix agent�). Then configure the agent on that host to point to your Zabbix server.
Can I use Grafana to monitor other systems besides Zabbix?
Yes, Grafana supports many data sources like Prometheus, InfluxDB, and MySQL. You can add multiple data sources and create dashboards that combine them.
Is it possible to create alerts in Grafana based on Zabbix data?
Yes, Grafana has alerting built in. You can create alert rules on any panel that uses a Zabbix data source, and configure notifications via email, Slack, etc.
How often does Grafana pull data from Zabbix?
Grafana queries Zabbix’s API whenever you load a dashboard or when a panel refreshes (default 5 seconds). For long-term graphs, it uses Zabbix trends data to avoid heavy loads.
Related
Method: the standard formula for this calculation, rounded as each result states. See how the calculators work or report an error.
More cards in this drawer
- Blockchain vs Database: When Does Distributed Trust Win?
- GTA 6 and Call of Duty on Same Console?
- MCP in Production: Security Failures Behind the Backdoor Label
- Nothing Phone 2 Waterproof? IP54 Rating Explained
- Satellite Internet Equipment & Installation Guide
- Infinix GT 20 Pro vs AI Nova 2 Ultra 5G: Which Fits?