Zabbix-(3)-Zabbi-编译方式安装和汉化
推荐阅读:
部署规划
部署环境:
服务器系统:Ubuntu 18.04.1
Ubuntu 1804/Centos 7 编译安装 Zabbix
https://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/
解决依赖包
centos7
yum install gcc libxml2-devel net-snmp net-snmp-devel curl curl-devel php php-bcmath php-mbstring mariadb mariadb-devel
Ubuntu 1804
root@Zabbix-server:~# apt update
root@Zabbix-server:~# apt-get install apache2 apache2-bin apache2-data apache2-utils fontconfig-config fonts-dejavu-core fping libapache2-mod-php libapache2-mod-php7.2 libapr1 libaprutil1 libaprutil1-dbd-sqlite3 libaprutil1-ldap libfontconfig1 libgd3 libiksemel3 libjbig0 libjpeg-turbo8 libjpeg8 liblua5.2-0 libodbc1 libopenipmi0 libsensors4 libsnmp-base libsnmp30 libsodium23 libssh2-1 libtiff5 libwebp6 libxpm4 php-bcmath php-common php-gd php-ldap php-mbstring php-mysql php-xml php7.2-bcmath php7.2-cli php7.2-common php7.2-gd php7.2-json php7.2-ldap php7.2-mbstring php7.2-mysql php7.2-opcache php7.2-readline php7.2-xml snmpd ssl-cert ttf-dejavu-core libmysqlclient-dev libxml2-dev libxml2 snmp libsnmp-dev libevent-dev openjdk-8-jdk curl libcurl4-openssl-dev -y
创建用户和组
root@Zabbix-server:~# groupadd -g 2020 zabbix
root@Zabbix-server:~# useradd -u 2020 -g 2020 zabbix
root@Zabbix-server:~#
root@Zabbix-server:~# id zabbix
uid=2020(zabbix) gid=2020(zabbix) groups=2020(zabbix)
编译
root@Zabbix-server:~# cd /usr/local/src/
root@Zabbix-server:/usr/local/src# rz -E
rz waiting to receive.
root@Zabbix-server:/usr/local/src# ll
total 16820
drwxr-xr-x 2 root root 4096 Apr 29 17:48 ./
drwxr-xr-x 10 root root 4096 Oct 26 2019 ../
-rw-r--r-- 1 root root 17215217 Apr 29 13:41 zabbix-4.0.20.tar.gz
root@Zabbix-server:/usr/local/src# tar xf zabbix-4.0.20.tar.gz
root@Zabbix-server:/usr/local/src# cd zabbix-4.0.20/
root@Zabbix-server:/usr/local/src/zabbix-4.0.20# pwd
/usr/local/src/zabbix-4.0.20
root@Zabbix-server:/usr/local/src/zabbix-4.0.20# ./configure --prefix=/apps/zabbix_server --enable-server --enable-agent --with-mysql --with-net-snmp --with-libcurl --with-libxml2 --enable-java
。。。。。。
Enable Java gateway: yes
Java gateway details:
Java compiler: javac
Java archiver: jar
LDAP support: no
IPv6 support: no
***********************************************************
* Now run 'make install' *
* *
* Thank you for using Zabbix! *
* <http://www.zabbix.com> *
***********************************************************
root@Zabbix-server:/usr/local/src/zabbix-4.0.20# make install
root@Zabbix-server:/usr/local/src/zabbix-4.0.20# ll /apps/zabbix_server/
total 28
drwxr-xr-x 7 root root 4096 Apr 29 17:51 ./
drwxr-xr-x 3 root root 4096 Apr 29 17:51 ../
drwxr-xr-x 2 root root 4096 Apr 29 17:51 bin/
drwxr-xr-x 4 root root 4096 Apr 29 17:51 etc/
drwxr-xr-x 3 root root 4096 Apr 29 17:51 lib/
drwxr-xr-x 3 root root 4096 Apr 29 17:51 sbin/
drwxr-xr-x 4 root root 4096 Apr 29 17:51 share/
准备数据库
在机器172.20.32.104
root@Mysql-master:~# mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 205
Server version: 5.7.29-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> CREATE DATABASE zabbix_server1 CHARACTER SET UTF8 COLLATE UTF8_BIN;
Query OK, 1 row affected (0.12 sec)
mysql> GRANT ALL PRIVILEGES ON zabbix_server1.* TO zabbix1@'172.20.32.%' IDENTIFIED BY '123456';
Query OK, 0 rows affected, 1 warning (0.27 sec)
mysql> FLUSH PRIVILEGES;
Query OK, 0 rows affected (0.23 sec)
mysql>
导入基础数据到数据库
测试连通性
在 zabbix-server 上使用zabbix_server1账户测试数据库的连通性
在机器172.20.32.101
需要安装mysql客户端
root@Zabbix-server:~# apt install mysql-client -y
root@Zabbix-server:~# mysql -uzabbix -p123456 -h172.20.32.104
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 214
Server version: 5.7.29-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
导入数据库
root@Zabbix-server:/usr/local/src/zabbix-4.0.20# cd database/mysql/
root@Zabbix-server:/usr/local/src/zabbix-4.0.20/database/mysql# pwd
/usr/local/src/zabbix-4.0.20/database/mysql
root@Zabbix-server:/usr/local/src/zabbix-4.0.20/database/mysql# ll
total 6104
drwxr-xr-x 2 1001 1001 4096 Apr 29 17:49 ./
drwxr-xr-x 8 1001 1001 4096 Apr 29 17:49 ../
-rw-r--r-- 1 1001 1001 4079668 Apr 27 20:59 data.sql
-rw-r--r-- 1 1001 1001 1978341 Apr 27 20:59 images.sql
-rw-r--r-- 1 root root 15625 Apr 29 17:49 Makefile
-rw-r--r-- 1 1001 1001 392 Apr 27 20:59 Makefile.am
-rw-r--r-- 1 1001 1001 15806 Apr 27 20:59 Makefile.in
-rw-r--r-- 1 1001 1001 140265 Apr 27 20:59 schema.sql
root@Zabbix-server:/usr/local/src/zabbix-4.0.20/database/mysql#
可以看到,zabbix 源码文件夹下提供了schema.sql、images.sql和data.sql三个 sql 文件,使用这三个文件将 zabbix server 所需的数据导入到数据库。
root@Zabbix-server:/usr/local/src/zabbix-4.0.20/database/mysql# mysql -uzabbix -p123456 -h172.20.32.104 zabbix_server1 <schema.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
root@Zabbix-server:/usr/local/src/zabbix-4.0.20/database/mysql# mysql -uzabbix -p123456 -h172.20.32.104 zabbix_server1 <images.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
root@Zabbix-server:/usr/local/src/zabbix-4.0.20/database/mysql# mysql -uzabbix -p123456 -h172.20.32.104 zabbix_server1 <data.sql
mysql: [Warning] Using a password on the command line interface can be insecure.
root@Zabbix-server:/usr/local/src/zabbix-4.0.20/database/mysql#
复制一个终端,进入tty2的终端,查看数据库中的zabbix_server1 库中的表是否生成
root@Zabbix-server:/usr/local/src/zabbix-4.0.20/database/mysql# mysql -uzabbix -p123456 -h172.20.32.104
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 215
Server version: 5.7.29-0ubuntu0.18.04.1 (Ubuntu)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql> show databases;
+--------------------+
| Database
+--------------------+
| information_schema |
| zabbix_server1
+--------------------+
2 rows in set (0.03 sec)
mysql> use zabbix_server1;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A
Database changed
mysql> show tables;
+----------------------------+
| Tables_in_zabbix_server1
+----------------------------+
| acknowledges
| actions
| alerts
| application_discovery
| application_prototype
| application_template
| applications
。。。。。。
| users
| users_groups
| usrgrp
| valuemaps
| widget
| widget_field
+----------------------------+
144 rows in set (0.17 sec)
mysql> exit
Bye
编辑 zabbix-server 配置文件
root@Zabbix-server:~# cd /apps/zabbix_server/
root@Zabbix-server:/apps/zabbix_server# mkdir logs
root@Zabbix-server:/apps/zabbix_server# mkdir run
root@Zabbix-server:/apps/zabbix_server# cd
root@Zabbix-server:~# vim /apps/zabbix_server/etc/zabbix_server.conf
root@Zabbix-server:~# grep "^[a-Z]" /apps/zabbix_server/etc/zabbix_server.conf
LogFile=/apps/zabbix_server/logs/zabbix_server.log
DebugLevel=3
PidFile=/apps/zabbix_server/run/zabbix_server.pid
DBHost=172.20.32.104
DBName=zabbix_server1
DBUser=zabbix
DBPassword=123456
DBPort=3306
Timeout=4
LogSlowQueries=3000
启动 zabbix-server
root@Zabbix-server:~# chown zabbix.zabbix /apps/zabbix_server/ -R
#否则可能会出现权限拒绝
root@Zabbix-server:~# /apps/zabbix_server/sbin/zabbix_server -c /apps/zabbix_server/etc/zabbix_server.conf
root@Zabbix-server:~# tail /apps/zabbix_server/logs/zabbix_server.log
40880:20200429:185505.796 server #25 started [icmp pinger #1]
40882:20200429:185505.797 server #27 started [alerter #1]
40883:20200429:185505.797 server #28 started [alerter #2]
40881:20200429:185505.797 server #26 started [alert manager #1]
40884:20200429:185505.798 server #29 started [alerter #3]
40885:20200429:185505.798 server #30 started [preprocessing manager #1]
40886:20200429:185505.798 server #31 started [preprocessing worker #1]
40888:20200429:185505.800 server #33 started [preprocessing worker #3]
40887:20200429:185505.800 server #32 started [preprocessing worker #2]
root@Zabbix-server:~# ps -ef|grep zabbix
zabbix 40855 1 0 18:55 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_server -c /apps/zabbix_server/etc/zabbi_server.conf
zabbix 40856 40855 0 18:55 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_server: configuration syncer [synced configuration in 0.015322 sec, idle 60 sec]
。。。。。。
zabbix 40887 40855 0 18:55 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_server: preprocessing worker #2 started
zabbix 40888 40855 0 18:55 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_server: preprocessing worker #3 started
root 40906 1862 0 18:56 pts/1 00:00:00 grep --color=auto zabbix
配置 web 界面
拷贝 PHP WEB 前端代码拷贝到 apache 服务目录
root@Zabbix-server:~# mkdir /var/www/html/zabbix
root@Zabbix-server:~# cp -av /usr/local/src/zabbix-4.0.20/frontends/php/* /var/www/html/zabbix/
root@Zabbix-server:~# cd /var/www/html/zabbix/
root@Zabbix-server:/var/www/html/zabbix# du -sh
41M .
访问 web 界面进行配置
1.欢迎界面
2.正常报错界面
3.解决报错
root@Zabbix-server:~# apt install php-gd php-xml php-mysql -y
380 max_execution_time = 300
391 max_input_time = 300
669 post_max_size = 16M
937 date.timezone = Asia/Shanghai
root@Zabbix-server:~# systemctl restart apache2 #重新启动apache2
刷新之后界面:
4.数据库配置
5.zabbix-server安装主机信息细节
6.最后确认信息
7.手动下载生成的配置文件
点击上面的红框,下载后放在下面的红框指定的位置
/var/www/html/zabbix/conf/zabbix.conf.php
root@Zabbix-server:~# cd /var/www/html/zabbix/conf/
root@Zabbix-server:/var/www/html/zabbix/conf# pwd
/var/www/html/zabbix/conf
root@Zabbix-server:/var/www/html/zabbix/conf# rz -E
rz waiting to receive.
root@Zabbix-server:/var/www/html/zabbix/conf# ll
total 24
drwxr-xr-x 2 1001 1001 4096 Apr 29 20:05 ./
drwxr-xr-x 10 root root 4096 Apr 29 19:05 ../
-rw-r--r-- 1 1001 1001 163 Apr 27 20:59 .htaccess
-rw-r--r-- 1 1001 1001 1036 Apr 27 20:59 maintenance.inc.php
-rw-r--r-- 1 root root 449 Apr 29 20:04 zabbix.conf.php
-rw-r--r-- 1 1001 1001 741 Apr 27 20:59 zabbix.conf.php.example
root@Zabbix-server:/var/www/html/zabbix/conf# cat zabbix.conf.php
<?php
// Zabbix GUI configuration file.
global $DB;
$DB['TYPE'] = 'MYSQL';
$DB['SERVER'] = '172.20.32.104';
$DB['PORT'] = '3306';
$DB['DATABASE'] = 'zabbix_server1';
$DB['USER'] = 'zabbix';
$DB['PASSWORD'] = '123456';
// Schema name. Used for IBM DB2 and PostgreSQL.
$DB['SCHEMA'] = '';
$ZBX_SERVER = '172.20.32.101';
$ZBX_SERVER_PORT = '10051';
$ZBX_SERVER_NAME = 'Zabbix Server K';
$IMAGE_FORMAT_DEFAULT = IMAGE_FORMAT_PNG;
root@Zabbix-server:/var/www/html/zabbix/conf#
完成之后刷新访问界面
8.登入
启动zabbix_server命令
root@Zabbix-server:~# /apps/zabbix_server/sbin/zabbix_server -c /apps/zabbix_server/etc/zabbix_server.conf
root@Zabbix-server:~# ss -ntl|grep 10051
LISTEN 0 128 0.0.0.0:10051 0.0.0.0:*
主页面
启动 agent 查看监控数据
root@Zabbix-server:~# /apps/zabbix_server/sbin/zabbix_agentd
root@Zabbix-server:~# ss -ntl |grep 10050
LISTEN 0 128 0.0.0.0:10050 0.0.0.0:*
root@Zabbix-server:~# ps -ef |grep zabbix_agentd
zabbix 2393 1 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd
zabbix 2394 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 2395 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 2396 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 2397 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 2398 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 2402 1655 0 20:13 pts/0 00:00:00 grep --color=auto zabbix_agentd
查看是否有数据
编写 zabbix server 与 agent 的启动文件
编译安装的 zabbix 服务端和 agent 端的启动文件可以从 yum 或 apt 安装的 zabbix 启动文件中更改参数得来。
root@zabbix-server:~# scp /lib/systemd/system/zabbix-server.service 172.20.32.101:/lib/systemd/system/zabbix-server.service
[email protected]'s password:
zabbix-server.service 100% 496 1.1MB/s 00:00
root@zabbix-server:~# scp /lib/systemd/system/zabbix-agent.service 172.20.32.101:/lib/systemd/system/zabbix-agent.service
[email protected]'s password:
zabbix-agent.service 100% 436 698.3KB/s 00:00
root@zabbix-server:~#
zabbix server 启动文件
在主机172.20.32.101
root@Zabbix-server:~# vim /lib/systemd/system/zabbix-server.service
root@Zabbix-server:~# cat /lib/systemd/system/zabbix-server.service
[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target
#After=mysql.service
#After=mysqld.service
#After=mariadb.service
[Service]
Environment="CONFFILE=/apps/zabbix_server/etc/zabbix_server.conf"
EnvironmentFile=-/etc/default/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/apps/zabbix_server/run/zabbix_server.pid
KillMode=control-group
ExecStart=/apps/zabbix_server/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=infinity
[Install]
WantedBy=multi-user.target
重启 zabbix server
root@Zabbix-server:~# pkill zabbix_server
root@Zabbix-server:~# ps -ef | grep zabbix_server
zabbix 2393 1 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd
zabbix 2394 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 2395 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 2396 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 2397 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 2398 2393 0 20:12 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 5500 2111 0 20:55 pts/1 00:00:00 vim /apps/zabbix_server/etc/zabbix_server.conf
root 5603 1655 0 20:58 pts/0 00:00:00 grep --color=auto zabbix_server
root@Zabbix-server:~# systemctl daemon-reload
root@Zabbix-server:~# systemctl restart zabbix-server
root@Zabbix-server:~# systemctl enable zabbix-server #开机自启动
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-server.service → /lib/systemd/system/zabbix-server.service.
root@Zabbix-server:~# systemctl status zabbix-server
● zabbix-server.service - Zabbix Server
Loaded: loaded (/lib/systemd/system/zabbix-server.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2020-04-29 20:58:20 CST; 4s ago
Process: 5672 ExecStop=/bin/kill -SIGTERM $MAINPID (code=exited, status=0/SUCCESS)
Process: 5673 ExecStart=/apps/zabbix_server/sbin/zabbix_server -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 5692 (zabbix_server)
Tasks: 34 (limit: 2215)
CGroup: /system.slice/zabbix-server.service
├─5692 /apps/zabbix_server/sbin/zabbix_server -c /apps/zabbix_server/etc/zabbix_server.conf
├─5694 /apps/zabbix_server/sbin/zabbix_server: configuration syncer [synced configuration in 0.036113 sec, idle 60 sec
├─5695 /apps/zabbix_server/sbin/zabbix_server: housekeeper [startup idle for 30 minutes]
├─5696 /apps/zabbix_server/sbin/zabbix_server: timer #1 [updated 0 hosts, suppressed 0 events in 0.019982 sec, idle 39
├─5697 /apps/zabbix_server/sbin/zabbix_server: http poller #1 [got 0 values in 0.001647 sec, idle 5 sec]
├─5698 /apps/zabbix_server/sbin/zabbix_server: discoverer #1 [processed 0 rules in 0.001771 sec, idle 60 sec]
。。。。。。
zabbix agent 启动文件
注意启动文件的时候pid要和对应配置文件的pid保持一致
root@Zabbix-server:~# vim /lib/systemd/system/zabbix-agent.service
[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target
[Service]
Environment="CONFFILE=/apps/zabbix_server/etc/zabbix_agentd.conf"
EnvironmentFile=-/etc/default/zabbix-agent
Type=forking
Restart=on-failure
PIDFile=/tmp/zabbix_agentd.pid
KillMode=control-group
ExecStart=/apps/zabbix_server/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
User=zabbix
Group=zabbix
[Install]
WantedBy=multi-user.target
重启 zabbix agent
root@Zabbix-server:~# pkill zabbix_agentd
root@Zabbix-server:~#
root@Zabbix-server:~# systemctl daemon-reload
root@Zabbix-server:~# systemctl restart zabbix-agent.service
root@Zabbix-server:~# systemctl status zabbix-agent.service
● zabbix-agent.service - Zabbix Agent
Loaded: loaded (/lib/systemd/system/zabbix-agent.service; disabled; vendor preset: enabled)
Active: active (running) since Wed 2020-04-29 21:31:49 CST; 5s ago
Process: 7841 ExecStart=/apps/zabbix_server/sbin/zabbix_agentd -c $CONFFILE (code=exited, status=0/SUCCESS)
Main PID: 7853 (zabbix_agentd)
Tasks: 6 (limit: 2215)
CGroup: /system.slice/zabbix-agent.service
├─7853 /apps/zabbix_server/sbin/zabbix_agentd -c /apps/zabbix_server/etc/zabbix_agentd.conf
├─7854 /apps/zabbix_server/sbin/zabbix_agentd: collector [idle 1 sec]
├─7855 /apps/zabbix_server/sbin/zabbix_agentd: listener #1 [waiting for connection]
├─7856 /apps/zabbix_server/sbin/zabbix_agentd: listener #2 [waiting for connection]
├─7857 /apps/zabbix_server/sbin/zabbix_agentd: listener #3 [waiting for connection]
└─7858 /apps/zabbix_server/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
Apr 29 21:31:49 Zabbix-server systemd[1]: Stopped Zabbix Agent.
Apr 29 21:31:49 Zabbix-server systemd[1]: Starting Zabbix Agent...
Apr 29 21:31:49 Zabbix-server systemd[1]: zabbix-agent.service: Can't open PID file /tmp/zabbix_agentd.pid (yet?) after start: No
Apr 29 21:31:49 Zabbix-server systemd[1]: Started Zabbix Agent.
root@Zabbix-server:~# ps -ef | grep zabbix_agentd
zabbix 7853 1 0 21:31 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd -c /apps/zabbix_server/etc/zabbix_agent.conf
zabbix 7854 7853 0 21:31 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: collector [idle 1 sec]
zabbix 7855 7853 0 21:31 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: listener #1 [waiting for connection]
zabbix 7856 7853 0 21:31 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: listener #2 [waiting for connection]
zabbix 7857 7853 0 21:31 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: listener #3 [waiting for connection]
zabbix 7858 7853 0 21:31 ? 00:00:00 /apps/zabbix_server/sbin/zabbix_agentd: active checks #1 [idle 1 sec]
root 7911 1655 0 21:34 pts/0 00:00:00 grep --color=auto zabbix_agentd
root@Zabbix-server:~# systemctl enable zabbix-agent.service
Created symlink /etc/systemd/system/multi-user.target.wants/zabbix-agent.service → /lib/systemd/system/zabbix-agent.service.
root@Zabbix-server:~#
Ubuntu 下使用 zabbix web 时汉化方法
root@Zabbix-server:~# apt install language-pack-zh*
root@Zabbix-server:~# vim /etc/environment
PATH="/usr/local/sbin:/usr/local/bin:/usr/sbin:/usr/bin:/sbin:/bin:/usr/games:/usr/local/games"
LANG="zh_CN.UTF-8" # 新增该项
root@Zabbix-server:~# dpkg-reconfigure locales
会出现如下界面
root@Zabbix-server:~# dpkg-reconfigure locales
Generating locales (this might take a while)...
en_AG.UTF-8... done
en_AU.UTF-8... done
en_BW.UTF-8... done
en_CA.UTF-8... done
en_DK.UTF-8... done
en_GB.UTF-8... done
en_HK.UTF-8... done
en_IE.UTF-8... done
en_IL.UTF-8... done
en_IN.UTF-8... done
en_NG.UTF-8... done
en_NZ.UTF-8... done
en_PH.UTF-8... done
en_SG.UTF-8... done
en_US.UTF-8... done
en_ZA.UTF-8... done
en_ZM.UTF-8... done
en_ZW.UTF-8... done
zh_CN.UTF-8... done
zh_HK.UTF-8... done
zh_SG.UTF-8... done
zh_TW.UTF-8... done
Generation complete.
重启apache2
root@Zabbix-server:~# systemctl restart apache2
web 界面选择语言
汉化成功界面
解决部分界面乱码问题
上传字体文件
在 windows 拷贝字体
在 Windows 上找到控制面板,然后将字体拷贝到 windows 系统其他目录,等待上传到 zabbix 前端目录。
比如window10:C:\Windows\Fonts
上传字体到 apache 服务的 zabbix 目录
编译安装时上传到/var/www/html/zabbix/assets/fonts/
apt 安装时上传到/usr/share/zabbix/assets/fonts/
root@Zabbix-server:~# cd /var/www/html/zabbix/assets/fonts/
root@Zabbix-server:/var/www/html/zabbix/assets/fonts# pwd
/var/www/html/zabbix/assets/fonts
root@Zabbix-server:/var/www/html/zabbix/assets/fonts# ll
total 748
drwxr-xr-x 2 1001 1001 4096 Apr 27 20:59 ./
drwxr-xr-x 5 1001 1001 4096 Apr 27 20:59 ../
-rw-r--r-- 1 1001 1001 756072 Apr 27 20:59 DejaVuSans.ttf #默认的字体
root@Zabbix-server:/var/www/html/zabbix/assets/fonts# rz -E
rz waiting to receive.
root@Zabbix-server:/var/www/html/zabbix/assets/fonts# ll
total 12260
drwxr-xr-x 2 1001 1001 4096 Apr 29 22:24 ./
drwxr-xr-x 5 1001 1001 4096 Apr 27 20:59 ../
-rw-r--r-- 1 1001 1001 756072 Apr 27 20:59 DejaVuSans.ttf
-rw-r--r-- 1 root root 11787328 Mar 2 2019 SIMKAI.TTF #上传的字体
修改调用字体的文件
root@Zabbix-server:/var/www/html/zabbix/include# pwd
/var/www/html/zabbix/include
root@Zabbix-server:/var/www/html/zabbix/include# vim defines.inc.php
72 #define('ZBX_GRAPH_FONT_NAME', 'DejaVuSans'); // font file name
define('ZBX_GRAPH_FONT_NAME', 'SMAKAI'); // font file name
114 #define('ZBX_FONT_NAME', 'DejaVuSans');
define('ZBX_FONT_NAME', 'SIMKAI');
刷新验证: