Build Zabbix on Ubuntu 20.04

Introduction

After designing and building a network, long-term operation begins. Network equipment is naturally broken because it is a machine. Unexpected Traffic flows, and communication quality deteriorates. It is necessary to keep observing and monitoring in some way. Cisco offers its own surveillance system everywhere, but if you put it in poorly, it can lead to vendor lock. It is desirable that it is independent of the network equipment vendor, the source code is open to the public, and somewhere provides maintenance. So Zabbix.

Zabbix server construction

Basically, you can follow Zabbix official website. However, in order for Zabbix to work, he needs to prepare a Web server and a Database server by himself, and information about that is not written. There is a Document, but the Japanese version is only up to his Zabbix 2.2, and the information for localization is useless. It's hard.

Target environment

PostgreSQL/Apache HTTP Server used the standard Repository of Ubuntu 20.04. Database can be selected from MariaDB/PostgreSQL. There were many examples of construction using MariaDB, but here we adopted PostgreSQL.

I usually use PostgreSQL, so I made this decision. However, when I was investigating for construction, it seems that Database in Zabbix should not coexist with other Databases that have a lot of reference processing because it has a lot of update processing. He might not have dared to stick to PostgreSQL if he made it alone.

Installation of related software required for construction

sudo apt install postgresql postgresql-contrib
sudo apt install apache2 libapache2-mod-php 

Install PostgreSQL/Apache HTTP Server. The following is entered as an entity.

sudo apt install postgresql postgresql-contrib libpq5 postgresql-12 postgresql-client-12 postgresql-client-common postgresql-common sysstat
sudo apt install apache2 apache2-bin apache2-data apache2-utils libapache2-mod-php libapache2-mod-php7.4 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap liblua5.2-0 php7.4-cli php7.4-json php7.4-opcache php7.4-readline

There are other packages that can be added as a bug fix or additional function after running Zabbix, but that will be done later.

Installation of Zabbix main unit

wget https://repo.zabbix.com/zabbix/5.0/ubuntu/pool/main/z/zabbix-release/zabbix-release_5.0-1+$(lsb_release -sc)_all.deb
sudo dpkg -i zabbix-release_5.0-1+$(lsb_release -sc)_all.deb
sudo apt update
sudo apt -y install zabbix-server-pgsql zabbix-frontend-php php7.4-pgsql zabbix-agent zabbix-apache-conf

This is as per the official website.

Create Database for Zabbix in PostgreSQL

sudo -u postgres createuser --pwprompt zabbix

Create Database used by Zabbix. --pwprompt is an option to create a password, and when you execute this command, you will be asked to decide the password when using Database. So set it appropriately.

sudo -u postgres createdb -O zabbix zabbix

Create Database named zabbix with zabbix user privileges.

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

create.sql.gz is a file included in the previously installed zabbix-server-pgsql. When decompressed, a fairly long SQL comes out. Pour this into PostgreSQL's zabbix Database.

Settings required to start Zabbix

/etc/zabbix/zabbix_server.conf

### Option: DBPassword
#       Database password.
#       Comment this line if no password is used.
#
# Mandatory: no
# Default:
# DBPassword=← Uncomment and enter the Zabbix DB Password you set earlier.

/etc/zabbix/apache.conf

<Directory "/usr/share/zabbix">
    Options FollowSymLinks
    AllowOverride None
    Order allow,deny
    Allow from all

    <IfModule mod_php5.c>
     (snip)
        # php_value date.timezone Europe/Riga ← Uncomment and Asia/To something like Tokyo
    </IfModule>
    <IfModule mod_php7.c>
     (snip)
        # php_value date.timezone Europe/Riga ← Uncomment and Asia/To something like Tokyo
    </IfModule>
</Directory>

The /etc/zabbix/apache.conf edited here was included in the package zabbix-apache-conf.

Start Zabbix

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

Now when you access `http: // server address/zabbix /`, Zabbix setup wizard will be launched. The default login account is Admin/zabbix.

You can now access Zabbix from your browser. Zabbix startup screen

Initial customization

Localizing into Japanese

It can be changed from the ** User Setting menu ** at the bottom left.

Japanese localization of graph

There was a problem that a part of the Graph display showing the used bandwidth could not be displayed correctly. The problem is that his Graph display font in Zabbix does not support Japanese.

sudo apt install fonts-takao-pgothic
sudo update-alternatives --install /usr/share/zabbix/assets/fonts/graphfont.ttf zabbix-frontend-font /usr/share/fonts/truetype/takao-gothic/TakaoPGothic.ttf 20

In the RHEL example, I saw a method of rewriting directly with ln, but in Ubuntu it is a good practice to use * update-alternatives *.

SNMP Trap reception

Zabbix can also receive SNMP Traps. However, it cannot be received by Zabbix itself, it is received by snmptrapd/molded by snmptt is displayed. Zabbix itself acts as a wrapper for snmptrapd. The same is true for 4.0/5.0, and it seems that it is designed with such a policy.

sudo apt install snmptt libconfig-inifiles-perl libsnmp-perl

Recommended Posts

Build Zabbix on Ubuntu 20.04
Build VNC Server on Ubuntu 20.04
Install zabbix agent (5.0) on Ubuntu 18.04
Ubuntu on Windows build speed
Build the latest Samba 4 on Ubuntu 20.04
How to build vim on Ubuntu 20.04
Build ffmpeg 4.3.1 on Ubuntu for Windows
tmux on Ubuntu
Build OpenCV with Java Wrapper on Ubuntu 18.04
Screen recording on Ubuntu 20.04
Try DisplayLink on Ubuntu 20.04
Reinstall Kubernetes on Ubuntu 19.10
Use Flutter on Ubuntu
Install pyqt5 on ubuntu
[Java] Build Java development environment on Ubuntu & check execution
Build a DHCP and NAT router on Ubuntu 16.04
Zabbix 5 installation on CentOS 8
Install Ruby on Ubuntu 20.04
Setting JAVA_HOME on Ubuntu
Install Autoware on Ubuntu 18.04.5
Use mkdir on ubuntu
Apache2 on Ubuntu20.04 LTS
Use cpplapack on ubuntu
ubuntu on wsl part 10
Install Homebrew on Ubuntu 20.04
How to build a Pytorch environment on Ubuntu
Run tiscamera on Ubuntu 18.04
Build Ubuntu 20.04 LTS desktop environment on Raspberry Pi 4 (+ Japanese)
Using Flutter on Ubuntu (Part 2)
Create SSL certificate on Ubuntu 18.04
Building WebGIS on Ubuntu20.04 LTS
Install OpenJDK7 (JAVA) on ubuntu 14.04
Put Ubuntu 20.04.1 on Raspberry Pi 4
Install Cybozu Office 10 on Ubuntu 20.4
Extend swap area on Ubuntu 18.04
Install Docker on Ubuntu Server 20.04
Ubuntu on Windows Community Preview
Install MAV Proxy on Ubuntu 18.04
Manually build OpenJDK on Windows
Install Arudino IDE on Ubuntu 20
Introduced knowledge (wiki) on Ubuntu
Installing OpenMX on Ubuntu 18.04.5 LTS
Install Java on WSL Ubuntu 18.04
Install Ubuntu Desktop 20.10 on RaspberryPi4
Run chromium-mir-kiosk on Ubuntu Core
Install Arduino IDE on Ubuntu 20.04
Run java applet on ubuntu
Install raspi-config on Ubuntu 20.04 (LTS)
Install WordPress 5.5 on Ubuntu 20.04 LTS
Build Ubuntu 18.04.5 with dual boot
Run Eclipse CDT on Ubuntu
Set up ansible-playbook on Ubuntu 20.04
Install PlantUML on Intellij on Ubuntu
Install Ubuntu Server 20.04 on Btrfs
Note: Install PostgreSQL 9.5 on Ubuntu 18.04
Build mate desktop environment on ec2 with terraform (Ubuntu 20.04LTS)
[Virtualization] Install VMware and build Ubuntu (20.04)
Using Azure IOT Hub on Ubuntu 20.10.
Installing Ruby + Rails on Ubuntu 18.04 (rbenv)
Install JDK and JRE on Ubuntu 16.10
Install ngrok on ubuntu16.04 using Vagrant