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.
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.
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.
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.
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.
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.
/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
.
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.
It can be changed from the ** User Setting menu ** at the bottom left.
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 *.
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