zabbix安装

zabbix安装

--wang

需求

实现对系统7台主机(CentOS7)进行的监控

版本信息

系统:CentOS7.6

zabbix3.0

一、确定yum

curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo

curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo

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

二、服务器部署

安装zabbix-server服务,网页服务

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

☻安装检测服务

yum install -y zabbix-get

安装mariadb数据库

yum install -y  mariadb-server

☻配置服务器连接数据库信息:

sed -i.bak '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf

添加时区

sed -i.bak '18a php_value date.timezone  Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf

☻开启数据库

systemctl start mariadb.service

创建数据库

mysql -e 'create database zabbix character set utf8 collate utf8_bin;'

mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'

导入数据

zcat /usr/share/doc/zabbix-server-mysql-3.0.13/create.sql.gz|mysql -uzabbix -pzabbix zabbix

启动服务

systemctl start zabbix-server

systemctl start httpd

☻设置相关服务开机自启动

systemctl enable mariadb

systemctl enable zabbix-server

systemctl enable httpd

网页登陆http://localhost/zabbix进行相关配置

初始用户名Admin,密码zabbix

注:如果数据库安装在其它主机,参考另外的一篇文章zabbix拍错。

三、客户端部署

安装zabbix-agent服务

yum install -y zabbix-agent

☻配置连接的主服务器

sed -i.bak 's#Server=127.0.0.1#Server=172.16.1.61#' /etc/zabbix/zabbix_agentd.conf

启动服务

systemctl start zabbix-agent

☻设置相关服务开机自启动

systemctl enable zabbix-agent

四、测试

☻在主机端测试客服端连接情况

zabbix_get -s 172.16.1.61 -p 10050 -k "system.cpu.load[all,avg1]"

收到0.000000为正常

五、配置文件汇总

☻服务器配置文件:

/etc/zabbix/web/zabbix.conf.php

/etc/zabbix/zabbix_server.conf

/etc/httpd/conf.d/zabbix.conf

☻服务器日志:

/var/log/zabbix/zabbix_server.log

☻客户端配置文件:

/etc/zabbix/zabbix_agentd.conf

☻服务器日志:

/var/log/zabbix/zabbix_agentd.log

六、安全

☻防火墙

客户端firewall-cmd --permanent --zone=public --add-port=10050/tcp

      firewall-cmd --reload

服务器firewall-cmd --permanent --zone=public --add-port=80/tcp

      firewall-cmd --reload

☻SELINUX

所有主机关闭SELINUX(由于水平有限暂时没有能力配置SELINUX

暂时关闭:setenforce  0

永久关闭SELINUX/etc/selinux/config文件中配置

原文地址:https://www.cnblogs.com/szy2018/p/10530074.html