zabbix4安装和简单实用

zabbix 中文产品手册 : https://www.zabbix.com/documentation/4.0/zh/manual

1、配置centos7的yum源

curl http://mirrors.aliyun.com/repo/Centos-7.repo >>Centos-7.repo   或   wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

2、配置zabbix的yum源

rpm -ivh http://repo.zabbix.com/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm

3、安装mariadb数据库、zabbix组件

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

4、初始化配置

#解析设置
[root@node1 ~]# cat /etc/hosts
127.0.0.1  node1  localhost localhost.localdomain localhost4 localhost4.localdomain4
::1         localhost localhost.localdomain localhost6 localhost6.localdomain6

#数据库配置登录用户
mysql -uroot -p
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on *.* to 'zabbix'@'%' identified by '123456';
grant all privileges on *.* to 'zabbix'@'localhost' identified by '123456';
flush privileges;

#跳过dns解析
vim /etc/my.cnf
[mysqld]
skip-name-resolve   
systemctl restart mariadb

#导入数据
cd /usr/share/doc/zabbix-server-mysql-4.0.49/
zcat create.sql.gz | mysql -uzabbix -p zabbix

#zabbix_server.conf配置
[root@node1 ~]# cat /etc/zabbix/zabbix_server.conf |grep -v "#" |grep -v "^$"
ListenPort=10051
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
SocketDir=/var/run/zabbix
DBHost=192.168.159.133
DBName=zabbix
DBUser=zabbix
DBPassword=123456
DBName=zabbix
DBUser=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000

#zabbix_agentd.conf配置
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=192.168.159.133
ListenPort=10050
Hostname=node1
Include=/etc/zabbix/zabbix_agentd.d/*.conf

5、启动zabbix

systemctl start zabbix-server.service
systemctl enable zabbix-server.service
systemctl start httpd
systemctl enable httpd
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service

6、关闭防火墙、设置selinux

sed -i "s/SELINUX=enforcing/SELINUX=disabled/" /etc/selinux/config
systemctl stop firewalld
systemctl stop firewalld
点赞

发表回复

电子邮件地址不会被公开。必填项已用 * 标注