zabbix5部署
1 2 3 4 5 6 7 8 9
| zabbix版本 7.0:不支持C7 6.4:不支持C7 6.0:不支持C7 5.0:支持C7 4.x:zabbix前后端分离 3.x:zabbix前后端不分离
|
环境准备
主机名 |
内网ip |
ip |
角色 |
应用 |
zabbix5 |
172.16.1.71 |
10.0.0.71 |
zabbix服务端 |
zabbix-server、MySQL |
zabbix3 |
172.16.1.72 |
10.0.0.72 |
zabbix服务端 |
zabbix-server、MySQL |
web01 |
172.16.1.7 |
10.0.0.7 |
zabbix5的客户端 |
zabbix-agent |
web02 |
172.16.1.8 |
10.0.0.8 |
zabbix3的客户端 |
zabbix-agent |
官网:https://www.zabbix.com/ 点击download
安装服务端
部署zabbix5
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104
|
rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum install -y zabbix-server-mysql zabbix-agent
yum install centos-release-scl -y
[root@zabbix5-server ~]# vim /etc/yum.repos.d/zabbix.repo [zabbix-frontend] ... enabled=1 ...
yum -y install zabbix-web-mysql-scl zabbix-nginx-conf-scl
Cannot find a valid baseurl for repo: centos-sclo-rh/x86_64 原因:CentOS7的SCL源在2024年6月30日停止维护了。 当scl源里面默认使用了centos官方的地址,无法连接,需要替换为阿里云。 解决: cd /etc/yum.repos.d/ mv CentOS-SCLo-scl.repo CentOS-SCLo-scl.repo.bak mv CentOS-SCLo-scl-rh.repo CentOS-SCLo-scl-rh.repo.bak
vim CentOS-SCLo-rh.repo [centos-sclo-rh] name=CentOS-7 - SCLo rh baseurl=https://mirrors.aliyun.com/centos/7/sclo/x86_64/rh/ gpgcheck=1 enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-CentOS-SIG-SCLo
yum -y install zabbix-web-mysql-scl zabbix-nginx-conf-scl
yum install -y mariadb-server
systemctl start mariadb systemctl enable mariadb
mysql MariaDB [(none)]> create database zabbix5 character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all on *.* to zabbix@'172.16.1.%' identified by '123'; 退出 \q
[root@zabbix5 ~]#zcat /usr/share/doc/zabbix-server-mysql-5.0.42/create.sql.gz | mysql-uzabbix -p123 -h172.16.1.71 zabbix5 ERROR 1045 (28000):Access denied for user 'zabbix'@'zabbix5'(using password:YES)
解决:关闭反向解析,[mysqld]下添加 skip_name_resolve vim /etc/my.cnf [mysqld] skip_name_resolve
systemctl restart mariadb
zcat /usr/share/doc/zabbix-server-mysql-5.0.42/create.sql.gz |mysql -uzabbix -p123 -h172.16.1.71 zabbix5
vim /etc/zabbix/zabbix_server.conf DBHost=172.16.1.71 DBName=zabbix5 DBUser=zabbix DBPassword=123
[root@zabbix5-server ~]# vim /etc/opt/rh/rh-nginx116/nginx/conf.d/zabbix.conf server { listen 80; server_name zabbix.web.com; ... }
[root@zabbix5-server ~]# vim /etc/opt/rh/rh-php72/php-fpm.d/zabbix.conf listen.acl_users = apache,nginx php_value[date.timezone] = Asia/Shanghai
systemctl restart zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm systemctl enable zabbix-server zabbix-agent rh-nginx116-nginx rh-php72-php-fpm
打开cmd -> 输入drivers -> 打开hosts文件 10.0.0.71 zabbix.web.com
zabbix.web.com
|
- 如果想使用10.0.0.71访问zabbix时候报错如下
-
原因:使用ip访问默认会去找/opt/rh/rh-nginx116/root/usr/share/nginx/html
.
-
/etc/opt/rh/rh-nginx116/nginx/nginx.conf
.里指向了路径
-
解决:删除默认nginx配置文件里server层,http层下的server层,删掉保留如下
-
重启nginx systemctl restart rh-nginx116-nginx
浏览器访问10.0.0.71
输入连接的数据库host,库名,用户及密码
1 2
| Username:Admin Password:zabbix
|
汉化
zabbix图形字体显示异常解决
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
| [root@zabbix5-server ~]# rpm -ql zabbix-web|grep font /usr/share/zabbix/assets/fonts
windows打开CMD 输入 fonts
[root@zabbix5-server ~]# cd /usr/share/zabbix/assets/fonts
[root@zabbix5-server fonts]# rm -f graphfont.ttf
[root@zabbix5-server fonts]# mv YGYXSZITI2.0.TTF graphfont.ttf
|
安装客户端
10.0.0.7
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| rpm -Uvh https://repo.zabbix.com/zabbix/5.0/rhel/7/x86_64/zabbix-release-5.0-1.el7.noarch.rpm
yum install -y zabbix-agent
[root@web01 ~]# vim /etc/zabbix/zabbix_agentd.conf Server=172.16.1.71 Hostname=web01
systemctl start zabbix-agent systemctl enable zabbix-agent
端口: zabbix-server:10051 zabbix-agent:10050
|
添加监控主机
1 2 3 4 5
| 客户端:zabbix-server获取zabbix-agent的数据 SNMP:监控网络设备的接口(交换机) JMX:监控JAVA程序 IPMI:监控硬件设备(硬件负载均衡 F5 硬件防火墙)
|
模板选好就添加
返回主机,等待刷新变绿
zabbix3.4部署
部署服务端
清华源:https://mirrors.tuna.tsinghua.edu.cn/
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33
| rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-1.el7.centos.noarch.rpm
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
mysql MariaDB [(none)]> create database zabbix3 character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all on *.* to zabbix@'172.16.1.%' identified by '123';
zcat /usr/share/doc/zabbix-server-mysql-3.4.15/create.sql.gz |mysql -uzabbix -p123 -h172.16.1.71 zabbix3
[root@zabbix3-server ~]# vim /etc/zabbix/zabbix_server.conf DBHost=172.16.1.71 DBName=zabbix3 DBUser=zabbix DBPassword=123
[root@zabbix3-server ~]# vim /etc/httpd/conf.d/zabbix.conf php_value date.timezone Asia/Shanghai
systemctl start zabbix-server zabbix-agent httpd systemctl enable zabbix-server zabbix-agent httpd
http://10.0.0.72/zabbix/
|
如果启动报错
1 2 3
| 检查日志 cat /var/log/zabbix/zabbix_server.log 如果是如下
|
1 2 3 4 5 6 7 8 9 10
| 原因: kernel.sem参数设置过小,共享内存信号量设置共享内存: 可以通过ipcs -lm命令查看目前系统共享内存的参数限制
解决: echo "kernel.sem = 500 64000 64 256" >> /etc/sysctl.conf
sysctl -p
systemctl start zabbix-server
|
登录浏览器访问
1 2 3 4 5 6 7 8 9 10 11 12 13 14
| 登录用户名及密码同zabbix5 Username:Admin Password:zabbix
汉化及字体异常同zabbix5
[root@zabbix3-server ~]# rpm -ql zabbix-web|grep font /usr/share/zabbix/fonts
[root@zabbix3-server ~]# cd /usr/share/zabbix/fonts
[root@zabbix3-server fonts]# rm -f graphfont.ttf [root@zabbix3-server fonts]# mv YGYXSZITI2.0.TTF graphfont.ttf
|
部署客户端
10.0.0.8
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
| https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/rhel/7/x86_64/
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.4/rhel/7/x86_64/zabbix-agent-3.4.15-1.el7.x86_64.rpm
yum -y install zabbix-agent
[root@web02 ~]# vim /etc/zabbix/zabbix_agentd.conf Server=172.16.1.72 Hostname=web02
systemctl start zabbix-agent systemctl enable zabbix-agent
|
搜索linux,添加Template OS Linux