Zabbix编译安装

bash

tar zxf zabbix-4.4.1.tar.gz

bash

groupadd --system zabbix
useradd --system -g zabbix -d /usr/lib/zabbix -s /sbin/nologin -c "Zabbix Monitoring System" zabbix

sql

# mysql -uroot -p
password
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'password';
mysql> quit; 

bash

cd zabbix-4.4.1/

mysql -uzabbix -pzabbix zabbix < database/mysql/schema.sql
mysql -uzabbix -pzabbix zabbix < database/mysql/images.sql
mysql -uzabbix -pzabbix zabbix < database/mysql/data.sql

bash

yum -y install net-snmp-devel libevent libevent-devel libssh2-devel OpenIPMI-devel libxml2-devel curl-devel

bash

./configure \
--prefix=/usr/local/zabbix \
--enable-server \
--with-mysql \
--with-net-snmp \
--with-libxml2 \
--with-libcurl \
--with-openipmi \
--enable-proxy \
--enable-agent

选项说明

  • –prefix #指定安装目录
  • –enable-server #安装zabbix server
  • –enable-agent #安装zabbix agent
  • –with-mysql #用mysql来存储
  • –with-net-snmp #支持snmp协议
  • –with-libcurl#支持 CURL 功能

bash

make && make install

bash

cp -rf /root/zabbix-4.4.1/frontends/php/ /data/www/html/zabbix
chown zabbix:zabbix /data/www/html/zabbix/

bash

vi /usr/local/php/etc/php.ini

text

max_execution_time = 300
date.timezone = Asia/Shanghai
max_input_time = 600

修改zabbix_server.conf

bash

vi /usr/local/zabbix/etc/zabbix_server.conf

text

LogFile=/usr/local/zabbix/zabbix_server.log
PidFile=/usr/local/zabbix/zabbix_server.pid
DBHost=localhost #取消注释即可
DBName=zabbix  #数据库名
DBUser=zabbix   #数据库用户
DBPassword=zabbix  #数据库密码
DBSocket=/data/mysql/mysql.sock #修改mysql socket路径,否则无法启动
ListenIP=0.0.0.0

修改zabbix_agentd.conf

bash

vi /usr/local/zabbix/etc/zabbix_agentd.conf

text

PidFile=/usr/local/zabbix/zabbix_agentd.pid
LogFile=/usr/local/zabbix/zabbix_agentd.log

bash

vi /usr/lib/systemd/system/zabbix-server.service

text

[Unit]
Description=Zabbix Server
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_server.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-server
Type=forking
Restart=on-failure
PIDFile=/usr/local/zabbix/zabbix_server.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_server -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s
TimeoutSec=0

[Install]
WantedBy=multi-user.target

bash

vi /usr/lib/systemd/system/zabbix-agent.service

text

[Unit]
Description=Zabbix Agent
After=syslog.target
After=network.target

[Service]
Environment="CONFFILE=/usr/local/zabbix/etc/zabbix_agentd.conf"
EnvironmentFile=-/etc/sysconfig/zabbix-agent
Type=forking
Restart=on-failure
PIDFile=/usr/local/zabbix/zabbix_agentd.pid
KillMode=control-group
ExecStart=/usr/local/zabbix/sbin/zabbix_agentd -c $CONFFILE
ExecStop=/bin/kill -SIGTERM $MAINPID
RestartSec=10s

[Install]
WantedBy=multi-user.target

bash

systemctl daemon-reload

从Window服务器找到相应的字休复制到zabbix Server服务器上

控制面板–>字体–>选择一种中文字库例如“楷体”(simkai.ttf)

将我们选择的字体文件上传到zabbix web服务,/data/www/html/zabbix/assets目录下

修改此/data/www/html/zabbix/include/defines.inc.php文件中字体的配置,将里面关于字体设置从DejaVuSans替换成simkai

bash

sed -i 's/DejaVuSans/simkai/g' /data/www/html/zabbix/include/defines.inc.php

刷新页面即可检查修复效果

相关内容