安装存储库配置包
[root@m03 /]# rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
1. 更换成清华的源(当然 可以忽略这一步)
[root@m03 /]# vim /etc/yum.repos.d/zabbix.repo (更换红色那两行就行)
[zabbix] name=Zabbix Official Repository - $basearch baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.0/rhel/7/x86_64/ enabled=1 gpgcheck=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX [zabbix-non-supported] name=Zabbix Official Repository non-supported - $basearch baseurl=https://mirrors.tuna.tsinghua.edu.cn/zabbix/non-supported/rhel/7/x86_64/ enabled=1 gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX gpgcheck=1 |
2. Zabbix服务器和带有MySQL数据库的Web前端安装
[root@m03 /]# yum install zabbix-server-mysql zabbix-web-mysql
创建初始数据库
1.安装数据库
[root@m03 /]# yum install mariadb-server -y
2.启动数据库
[root@m03 /]# systemctl start mariadb.service
[root@m03 /]# systemctl enable mariadb.service
3.创建zabbix数据库
MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
4.导入数据
[root@m03 /]# zcat /usr/share/doc/zabbix-server-mysql-3.0.*/create.sql.gz | mysql -uzabbix -p zabbix
配置相关文件
1. Zabbix服务器的数据库配置
[root@m03 /]# vim /etc/zabbix/zabbix_server.conf
DBHost=localhost DBName=zabbix DBUser=zabbix DBPassword=123456 |
2.zabbix前端PHP配置
[root@m03 /]# vim /etc/httpd/conf.d/zabbix.conf
<IfModule mod_php5.c> php_value max_execution_time 300 php_value memory_limit 128M php_value post_max_size 16M php_value upload_max_filesize 2M php_value max_input_time 300 php_value always_populate_raw_post_data -1 php_value date.timezone Asia/Shanghai </IfModule> |
启动zabbix服务
[root@m03 /]# systemctl enable zabbix-server.service
[root@m03 /]# systemctl start zabbix-server.service
重启启动Apache服务
[root@m03 /]# systemctl start httpd.service[root@m03 /]# systemctl enable httpd.service
接下来就是web界面配置
在浏览器中输入 : http://10.0.0.61/zabbix
第2步
在客户端服务器
rpm -ivh https://mirrors.tuna.tsinghua.edu.cn/zabbix/zabbix/3.0/rhel/6/x86_64/zabbix-agent-3.0.18-1.el6.x86_64.rpm
vim /etc/zabbix/zabbix_agentd.conf
Hostname=web02
Server=192.168.101.63
web界面操作
自定义监控香
agent客户端
vim /etc/zabbix/zabbix_agentd.conf
UnsafeUserParameters=1
UserParameter=iostat.sda,/usr/bin/iostat |awk '/sda/{print $2}'
监控网络十一种状态
[root@m03 zabbix_agentd.d]# cat tcp.conf
UserParameter=tcp_state[*],netstat -ant|grep -c "$1"
[root@m03 zabbix_agentd.d]# zabbix_get -s 127.0.0.1 -p 10050 -k "tcp_state[TIME_WAIT]"
然后克隆11个
图形创建
自定义触发器