参考文档https://www.zabbix.com/documentation/3.0/start
zabbix是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
zabbix由2部分构成,zabbix server与可选组件zabbix agent。
zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络设备的监视,数据收集等功能,它可以运行在Windows, Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。
-
安装zabbix
# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm # yum install zabbix-server-mysql zabbix-web-mysql
如缺少安装包请配置epel源
https://mirrors.tuna.tsinghua.edu.cn/help/epel/ 清华大学epel源
-
安装配置mysql
# yum install mariadb mariadb-server
红帽在7版本后用mariadb替换了mysql
启动数据库服务,并将其配置为开机自启:
# systemctl enable mariadb.service # systemctl start mariadb.service
为了保证数据库服务的安全性,运行``mysql_secure_installation``脚本。特别需要说明的是,为数据库的root用户设置一个适当的密码。
# mysql_secure_installation
配置mysql
# mysql -uroot -proot MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin; MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix'; MariaDB [(none)]> quit; # zcat /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql.gz | mysql -uzabbix -p zabbix \ 同步数据结构
-
配置zabbix
在zabbix server 配置文件中配置数据库信息
# vim /etc/zabbix/zabbix_server.conf DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=zabbix # systemctl start zabbix-server # systemctl enable zabbix-server
配置时区
# vim /etc/httpd/conf.d/zabbix.conf php_value date.timezone Asia/Shanghai # systemctl start httpd # systemctl enable httpd
打开web界面 http://<IP>/zabbix
默认账号Admin zabbix
让zabbix支持中文
-
安装代理
# yum install zabbix-agent # systemctl start zabbix-agent # systemctl enable zabbix-agent 非zabbix server 服务器安装 需要设置agent配置文件 # vim /etc/zabbix/zabbix_agentd.conf Server=127.0.0.1 \zabbix server IP Server=127.0.0.1 \zabbix server IP Hostname=Zabbix server \可以是域名和IP地址 不可以随意修改 如果是域名需要zabbix server 能成功解析
生产上线流程(客户端安装好agent的情况下)
配置自动发现规则 IP范围换成你的网段
配置一个自动发现动作
配置模板
其中主要配置有三个
监控项:要监控的项目比如CPU利用率、内存使用情况等
触发器:触发一些预先设置的事件一般用于邮件报警等
图形:监控统计图