前言:
zabbix([`zæbiks])是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
zabbix由2部分构成,zabbix server与可选组件zabbix agent。
zabbix server可以单独监视远程服务器的服务状态;同时也可以与zabbix agent配合,可以轮询zabbix agent主动接收监视数据(agent方式),同时还可被动接收zabbix agent发送的数据(trapping方式)。
zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。
一、搭建环境:
1、系统:CentOS7
注:如果使用yum过程中出现“yum Cannot find a valid baseurl for repo: base/7/x86_64”问题,请参考:https://blog.csdn.net/weixin_37973929/article/details/85317619 解决
如果出现:“Another app is currently holding the yum lock; waiting for it to exit...”问题,请参考:https://blog.csdn.net/weixin_37973929/article/details/85246422 解决
二、准备工作:
1、关闭SELinux!开启selinux会引起一连串问题,甚至zabbix的discovery功能也不能正常使用。
1.1、关闭SELinux方法:修改 /etc/selinux/config 文件
SELINUX分为临时关闭,和永久关闭。临时关闭后重启失效,我们这里使用永久关闭
[root@localhost ~]# vim /etc/selinux/config
在文件中可以看到这一行
SELINUX=enforcing
把后面的参数修改为disabled
SELinux=disabled
-------------------------分割线,下面是两种关闭方法-------------------------
临时关闭:
[root@localhost ~]# getenforce
Enforcing
[root@localhost ~]# setenforce 0
[root@localhost ~]# getenforce
Permissive
永久关闭(修改文件):
[root@localhost ~]# vim /etc/sysconfig/selinux
SELINUX=enforcing 改为 SELINUX=disabled
重启服务reboot
2、关闭防火墙
防火墙也为测试方便,我就给关闭了,并不随开机启动。
[root@localhost ~]#systemctl stop firewalld
[root@localhost ~]systemctl disable firewalld.service
防火墙相关命令:
(1)设置开机启用防火墙