zabbix4.0安装部署

Zabbix 产品手册

Zabbix完全开源免费 Zabbix是企业级开源监控解决方案,支持实时监控数万台服务器、虚拟机和网络设备,采集百万级监控指标。

关闭防火墙以及selinux

systemctl stop firewalld
systemctl disable firewalld
setenforce 0
vi /etc/selinux/config
SELINUX=disabled

添加安装zabbix的yum源:

cat < /etc/yum.repos.d/zabbix.repo
[zabbix]
name=Zabbix Official Repository - \$basearch
baseurl=https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/\$basearch/
enabled=1
gpgcheck=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591

[zabbix-non-supported]
name=Zabbix Official Repository non-supported - \$basearch
baseurl=https://mirrors.aliyun.com/zabbix/non-supported/rhel/7/\$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=1
EOF

添加密钥:

curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX-A14FE591 \ -o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
curl https://mirrors.aliyun.com/zabbix/RPM-GPG-KEY-ZABBIX \ -o /etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX

以上操作是防止安装zabbix时候报错出现各种依赖包的问题

安装zabbix:

yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent 

安装且配置mysql5.7版本数据库

yum install mysql5.7
创建数据库:create database zabbix character set utf8 collate utf8_bin;
赋权:grant all on zabbix.* to zabbix@localhost identified by '密码';
导入zabbix初始化数据
cd /usr/share/doc/zabbix-server-mysql-4.0.45
zcat create.sql.gz | mysql -uzabbix -p密码 zabbix
修改zabbix配置文件
vim /etc/zabbix/zabbix_server.conf
添加:
DBPassword=密码

保存退出
systemctl start zabbix-server
systemctl enable zabbix-server

修改httpd的时区

vim /etc/httpd/conf.d/zabbix.conf
定位20行:
php_value date.timezone Asia/Shanghai
保存退出
systemctl restart httpd
systemctl enable httpd                                         

访问zabbix

通过web界面初始化配置zabbix:
http://IP/zabbix
根据提示,填写数据库密码,然后,一律下一步。
配置完成登录:
用户名:Admin
密 码:zabbix
登录成功后提示 server is not running:the information displayed may not be current
去zabbix-server日志查看原因:
vi /var/log/zabbix/zabbix_server.log
查看到是/etc/zabbix/zabbix_server.conf配置文件中DB密码不正确 修改正确 重启服务即可

修改中文显示

Administration -- Users -- Admin -- Language -- Chinese -- Update

开启centos客户端,测试zabbix监控

安装zabbix-agent
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-agent-4.0.0-2.el7.x86_64.rpm
rpm -ivh时候可能有以下报错
报错如下:
curl: (60) The certificate issuer's certificate has expired.
Check your system date and time. More details here: http://curl.haxx.se/docs/sslcerts.html
curl performs SSL certificate verification by default, using a "bundle" of Certificate Authority (CA
原因是CA证书失效解决如下:
yum -y install ca-certificates
update-ca-trust extract
修改agent配置文件,指向zabbix-server的ip地址
vim /etc/zabbix/zabbix_agentd.conf
修改:
Server=IP地址
保存退出
systemctl start zabbix-agent
systemctl enable zabbix-agent

添加主机
配置–主机–创建主机–添加模板

在zabbix-server上修改图形中文乱码情况

yum -y install wqy-microhei-fonts
cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/zabbix/assets/fonts/graphfont.ttf