一、安装zabbix
配置前提:
- 192.168.253.137 zabiix主机+mysql主
- 192.168.253.120 mysql从主机
1.配置zabbix的yum源
[[email protected] yum.repos.d]# vim zabbix.repo
[zabbix]
name=Zabbix Official Repository - $basearch
baseurl=http://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/
enabled=1
gpgcheck=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591[zabbix-debuginfo]
name=Zabbix Official Repository debuginfo - $basearch
baseurl=http://mirrors.aliyun.com/zabbix/zabbix/4.4/rhel/7/$basearch/debuginfo/
enabled=0
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX-A14FE591
gpgcheck=0[zabbix-non-supported]
name=Zabbix Official Repository non-supported - $basearch
baseurl=http://mirrors.aliyun.com/zabbix/non-supported/rhel/7/$basearch/
enabled=1
gpgkey=file:///etc/pki/rpm-gpg/RPM-GPG-KEY-ZABBIX
gpgcheck=0
2.安装
[[email protected] ~]# systemctl stop firewalld
[[email protected] ~]# setenforce 0
[[email protected] ~]# yum -y install zabbix-web-mysql zabbix-server-mysql zabbix-agent mariadb mariadb-server
3.配置
[[email protected] ~]# systemctl enable mariadb
[[email protected] ~]# systemctl start mariadb
[[email protected] ~]# mysql
MariaDB [(none)]> create database zabbix charset utf8 collate utf8_bin;
Query OK, 1 row affected (0.00 sec)
MariaDB [(none)]> grant all privileges on zabbix.* to [email protected] identified by 'zabbix';
Query OK, 0 rows affected (0.00 sec)
MariaDB [(none)]> flush privileges;
Query OK, 0 rows affected (0.00 sec)
[[email protected] ~]# zcat /usr/share/doc/zabbix-server-mysql-4.4.9/create.sql.gz | mysql -uzabbix -pzabbix zabbix
[[email protected] ~]# vim /etc/zabbix/zabbix_server.conf
DBPassword=zabbix
修改时区[[email protected] ~]# vim /etc/php.ini
date.timezone = Asia/Shanghai
[[email protected] ~]# systemctl start zabbix-server zabbix-agent httpd
[[email protected] ~]# netstat -antp | egrep "80|10050|10051"
4.登录
汉化
二丶搭建主从
主库
从库
四、zabbix监控mysql
测试触发器报警
监控mysql流量
增加监控项
vim /etc/zabbix/zabbix_agentd.d/userparameter_Bytes_sent.conf
|
1 |
|
vim /etc/zabbix/zabbix_agentd.d/userparameter_Bytes_receive.conf
|
1 |
|