Summary

  Subject:

Zabbix Monitoring on Rocky: Install

  Updated:

2023-12-18

  Author:

Tim Hammond ([email protected])

Derek Pasnick ([email protected])

Leland Petitjean ([email protected])

  Operating Systems:

Rocky 8

  Background:

This guide was written to setup a Zabbix server to monitor network devices and servers for interuptions of service. Zabbix will be configured to also send alerts through the local mail relay. It is assumed a local mail relay is already setup and configured.

Due to the length of the content, I opted to break the article into the following sections:

  1. Rocky Zabbix: Install
  2. Rocky Zabbix: Configure
  3. Rocky Zabbix: Setting up Discoveries
  4. Rocky Zabbix: Client Agent Setup
  5. Rocky Zabbix: SNMPv3: Setup and Configure
  6. Rocky Zabbix: SNMPv3: Adding Devices
  7. Rocky Zabbix: References
 

Table of Contents

VM Config

VM Specifications:

  • CPU: 1vCPU (4 cores)
  • RAM: 8 GB
  • HD: 100 GB

Change the hostname:

sudo hostnamectl set-hostname zab01.domain.local

Update the IP:

sudo sed -i 's/192.168.30.199/192.168.30.108/g' /etc/sysconfig/network-scripts/ifcfg-ens192 sudo cat /etc/sysconfig/network-scripts/ifcfg-ens192

Install

Database (PostgreSQL)

I have used Maria DB before. I wanted to mix it up and try my hand at PostgreSQL.

Install the repo

wget https://download.postgresql.org/pub/repos/yum/reporpms/EL-8-x86_64/pgdg-redhat-repo-latest.noarch.rpm sudo dnf -y install pgdg-redhat-repo-latest.noarch.rpm

Disable the built-in PostgreSQL module:

sudo dnf -qy module disable postgresql

Install PostgreSQL:

sudo dnf install -y postgresql14-server

Optionally initialize the database and enable automatic start:

sudo /usr/pgsql-14/bin/postgresql-14-setup initdb sudo systemctl enable postgresql-14 sudo systemctl start postgresql-14

During the PostgreSQL install, a OS user was created.
The usernmae is: postgres. Change the password!

sudo passwd postgres

Login into the postgres OS user account.

sudo -i -u postgres

Create a PostgreSQL database user.

createuser --pwprompt zabbix

Change the PostgreSQL database user password.
Replace 'keePass' with the password from your passward manager software.

psql ALTER USER postgres WITH PASSWORD 'keePass'; \q

Create a PostgreSQL database.

createdb -O zabbix zabbix

Log out of the postgres OS user account.

exit

Zabbix

Downlaod and add Zabbix repo

wget https://repo.zabbix.com/zabbix/5.0/rhel/8/x86_64/zabbix-release-5.0-1.el8.noarch.rpm sudo rpm -Uvh zabbix-release-*.noarch.rpm

Install Zabbix

sudo dnf -y install zabbix-server-pgsql zabbix-web-pgsql zabbix-apache-conf zabbix-agent zabbix-get mod_ssl

Import initial Zabbix schema and data. You will be prompted to enter your newly created pwd.

sudo zcat /usr/share/doc/zabbix-server-pgsql*/create.sql.gz | sudo -u zabbix psql zabbix

Firewall/Startup Config

Add firewall rules

sudo firewall-cmd --permanent --add-service=http sudo firewall-cmd --permanent --add-service=https sudo firewall-cmd --permanent --add-port=10050/tcp sudo firewall-cmd --permanent --add-port=10051/tcp sudo firewall-cmd --reload sudo firewall-cmd --list-all

Add apps to startup

sudo systemctl enable zabbix-server sudo systemctl enable zabbix-agent sudo systemctl enable httpd sudo systemctl enable php-fpm

Start Services

sudo systemctl restart zabbix-server sudo systemctl restart zabbix-agent sudo systemctl restart httpd sudo systemctl restart php-fpm