配置zabbix YUM源
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
安装zabbix
yum install -y zabbix-server-mysql zabbix-web-mysql zabbix-get httpd php mariadb-server zabbix-agent
数据库配置
systemctl start mariadb.service
systemctl enable mariadb.service
1 设置数据库密码
mysqladmin -uroot password "111111"
2 创建zabbix数据库
create database zabbix character set utf8 collate utf8_bin;
3 创建数据库管理用户
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
4 在zabbix数据库中导入相应的表信息
zcat /usr/share/doc/zabbix-server-mysql-4.0.21/create.sql.gz |mysql -uzabbix -pzabbix zabbix
Apache配置
vim /etc/httpd/conf.d/zabbix.conf
21 php_value date.timezone Asia/Shanghai
chown -R apache /usr/share/zabbix/
zabbix配置
vim /etc/zabbix/zabbix_server.conf
124 DBPassword=zabbix
启动服务
systemctl start httpd.service zabbix-server.service
systemctl enable httpd.service zabbix-server.service
web访问
zabbix-agent端安装配置
1配置yum源
rpm -Uvh https://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-2.el7.noarch.rpm
2安装agent
yum -y install zabbix-agent
3 修改agent文件,制定zabbix-server地址
vim /etc/zabbix/zabbix_agentd.conf
98 Server=192.168.2.50 #zabbix server的地址
139 ServerActive=192.168.2.50 #zabbix主动模式和自动注册的server地址
150 Hostname=nfs01
注:如果这个名称和web端添加主机时的Host name不一致的情况,虽然不影响监控,但是会有大量的报错日志.
4 启动zabbix_agentd
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service