Zabbix & Grafana Installation

If you wish to manually download the sql files:

1. Install Zabbix Repository

If you have a proxy you have to set it up in /etc/wget.rc.

# ubuntu
wget https://repo.zabbix.com/zabbix/6.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_6.0-4+ubuntu22.04_all.deb
dpkg -i zabbix-release_6.0-4+ubuntu22.04_all.deb
apt update
# debian
wget https://repo.zabbix.com/zabbix/6.0/debian/pool/main/z/zabbix-release/zabbix-release_6.0-5+debian12_all.deb
dpkg -i zabbix-release_6.0-5+debian12_all.deb
apt update

2. Install Latest Postgres Repo

sudo sh -c 'echo "deb http://apt.postgresql.org/pub/repos/apt $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
wget --quiet -O - https://www.postgresql.org/media/keys/ACCC4CF8.asc | gpg --dearmor > /etc/apt/trusted.gpg.d/postgresql.gpg
sudo apt-get -y install postgresql

3. Install Zabbix SV-Frontend-Agent

apt install zabbix-server-pgsql zabbix-frontend-php php8.2-pgsql zabbix-apache-conf zabbix-sql-scripts zabbix-agent

4. Set default DB template to UTF8 in Postgres

wget "https://docs.brconsulting.info/downloads/zabbix/00-zbx-grf-install/01-zbx-set-psql-utf8-default.sql"
chmod 755 01-zbx-set-psql-utf8-default.sql
su  postgres
psql < 01-zbx-set-psql-utf8-default.sql

5. Create initial Zabbix DB

sudo -u postgres createuser --pwprompt zabbix
sudo -u postgres createdb -O zabbix zabbix 

6. Import Initial Zabbix DB Schema and data

zcat /usr/share/zabbix-sql-scripts/postgresql/server.sql.gz | sudo -u zabbix psql zabbix 

7. Configure DB for Zabbix Server

Edit file /etc/zabbix/zabbix_server.conf
    DBPassword=password

8. Start Zabbix Services

systemctl restart zabbix-server zabbix-agent apache2
systemctl enable zabbix-server zabbix-agent apache2

9. Accessing the Web GUI

Go to http://your_server_ip/zabbix

10. Locale Installation

dpkg-reconfigure locales
systemctl restart apache2

11. Log in with Admin (User) / zabbix (Pwd)

Create an Admin API user for Grafana (If installed) with SUPER ADMIN PERMISSIONS and NO FRONT END ACCESS

12. Add Grafana repositories

sudo apt-get install -y apt-transport-https
sudo apt-get install -y software-properties-common wget
wget -q -O - https://packages.grafana.com/gpg.key | gpg --dearmor > /etc/apt/trusted.gpg.d/grafana.gpg
echo "deb https://packages.grafana.com/enterprise/deb stable main" | sudo tee -a /etc/apt/sources.list.d/grafana.list
sudo apt-get update
sudo apt-get install grafana-enterprise

13. Start the Grafana Server

systemctl daemon-reload
systemctl start grafana-server
systemctl enable grafana-server

14. First Login

15. Installing the Zabbix Datasource Plugin (Grafana)

Go back to the terminal and install the Zabbix Datasource Plugin

grafana-cli plugins install alexanderzobnin-zabbix-app
systemctl restart grafana-server

16. Enable Zabbix Plugin

Head over to the Plugins section and enable it.

17. Adding the Zabbix DB as a Datasource (Optional)

  • Create DB User and Grant read access to it
  • Then do the following:
wget https://{{.Site.BaseURL}}/_static/downloads/zabbix/00-zbx-grf-install/02-zbx-allow-grafana-select.sql
chmod 755 02-zbx-allow-grafana-select.sql
su  postgres
psql < 02-zbx-allow-grafana-select.sql
  • Add Datasource on Grafana

18. Add Zabbix Datasource (API - Requires Admin user)