1.什么是zabbix
zabbix([`zæbiks])是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
zabbix由2部分构成,zabbix server与可选组件zabbix agent。
zabbix server可以通过SNMP,zabbix agent,ping,端口监视等方法提供对远程服务器/网络状态的监视,数据收集等功能,它可以运行在Linux,Solaris,HP-UX,AIX,Free BSD,Open BSD,OS X等平台上。
2.zabbix的主要功能
1.CPU负荷
2.内存使用
3.磁盘使用
4.网络状况
5.端口监视
6.日志监视
3.zabbix的安装
安装环境 cenos 7.4
安装服务端 ip 192.168.24.153
3.1安装zabbix源、aliyun 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.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 2523 100 2523 0 0 13874 0 --:--:-- --:--:-- --:--:-- 13939
[root@localhost ~]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
% Total % Received % Xferd Average Speed Time Time Time Current
Dload Upload Total Spent Left Speed
100 664 100 664 0 0 4821 0 --:--:-- --:--:-- --:--:-- 4846
[root@localhost ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
Retrieving http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
warning: /var/tmp/rpm-tmp.Xr7fbv: Header V4 DSA/SHA1 Signature, key ID 79ea5ed4: NOKEY
Preparing... ################################# [100%]
Updating / installing...
1:zabbix-release-3.0-1.el7 ################################# [100%]
3.2安装zabbix
[root@localhost ~]# yum install -y zabbix-server-mysql zabbix-web-mysql
3.3安装启动 mariadb数据库
[root@localhost ~]# yum install -y mariadb-server
[root@localhost ~]# systemctl start mariadb.service
3.4创建数据库
[root@localhost ~]# mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
[root@localhost ~]# mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'
3.5导入数据
我们来使用这个文件生成我们所需要的表
[root@localhost ~]# zcat /usr/share/doc/zabbix-server-mysql-3.4.15/create.sql.gz | mysql -uzabbix -pzabbix zabbix
3.6.配置zabbixserver连接mysql
[root@localhost ~]# vi /etc/zabbix/zabbix_server.conf
DBPassword=zabbix
3.7.添加时区
[root@localhost ~]# sed -i.ori '18a php_value date.timezone Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
3.8.启动服务
[root@localhost ~]# systemctl start zabbix-server
[root@localhost ~]# systemctl start httpd
[root@localhost ~]# systemctl enable httpd
[root@localhost ~]# systemctl enable zabbix-server
3.9在浏览器端访问
http://192.168.137.153/zabbix/setup.php
现在配置zabixx客户端
客户端ip 192.168.24.154
安装zabbix源、aliyu nYUM源
[root@localhost ~]# curl -o /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
[root@localhost ~]# curl -o /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
[root@localhost ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
安装zabbix客户端
yum install zabbix-agent -y
sed -i.ori 's#Server=127.0.0.1#Server=192.168.137.130#' /etc/zabbix/zabbix_agentd.conf
systemctl start zabbix-agent.service
systemctl enable zabbix-agent.service