目录
zabbix安装部署
环境:
centos7
192.168.179.130
zabbix-server
192.168.179.131
zabbix-agent
192.168.179.130
1. 时间同步
yum -y install ntp -----安装时间工具
ntpdate pool.ntp.org -----时间同步
2. 关闭防火墙
systemctl stop firewalld -----关闭防火墙
setenforce 0 ------关闭selinux
3. 上传zabbix yum源
vim /etc/yum.repos/zabbix.repo -----zabbix的yum源
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=0
[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0
yum clean all -----清除缓存
3.1 服务端安装
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent mariadb mariadb-server -----安装服务
4. 开启mariadb
systemctl start mariadb
4.1. 创建zabbix库
create database zabbix character set utf8 collate utf8_bin;
4.2. 授权
grant all on zabbix.* to zabbix@'localhost' identified by 'zabbix';
flush privileges;
4.3. 导入zabbix的表结构
zcat /usr/share/doc/zabbix-server-mysql-4.4.10/create.sql.gz |mysql -uzabbix -pzabbix zabbix
5. 编辑zabbix server 主配置文件:
[root@localhost yum.repos.d]# cat /etc/zabbix/zabbix_server.conf |grep -v "^#"|sed '/^$/d'|grep DB
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
验证端口号:
[root@localhost yum.repos.d]# netstat -lptnu|egrep "80|10050|10051"
tcp 0 0 0.0.0.0:10050 0.0.0.0:* LISTEN 14423/zabbix_agentd
tcp 0 0 0.0.0.0:10051 0.0.0.0:* LISTEN 14424/zabbix_server
tcp6 0 0 :::10050 :::* LISTEN 14423/zabbix_agentd
tcp6 0 0 :::10051 :::* LISTEN 14424/zabbix_server
tcp6 0 0 :::80 :::* LISTEN 14418/httpd
6. 浏览器访问
192.168.179.130/zabbix
7. 报错处理、修改为中文界面
vim /etc/php.ini
date.timezone = Asia/Shanghai
修改完务必要重启httpd服务!!!
systemctl restart httpd
刷新浏览器:
8. 解决中文乱码的问题
cd /usr/share/zabbix/assets/fonts
上传我们自己的字体:
mv simkai.ttf graphfont.ttf
192.168.179.131
9. 客户端安装(131)
yum -y install zabbix-agent -----安装zabbix客户端
9.1. 修改agent 配置文件
[root@localhost ~]# cat /etc/zabbix/zabbix_agentd.conf |grep -v "^#"|sed '/^$/d'
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.179.130
ServerActive=192.168.179.130
Hostname=web server
Include=/etc/zabbix/zabbix_agentd.d/*.conf
10. 访问浏览器(192.168.179.130/zabbix)
修改为中文界面