shaerzzr 发表于 2019-4-17 17:04:10

Centos7 Zabbix监控mysql

  配置yum源
wget -O /etc/yum.repos.d/CentOS-Base.repo http://mirrors.aliyun.com/repo/Centos-7.repo
wget -O /etc/yum.repos.d/epel.repo http://mirrors.aliyun.com/repo/epel-7.repo
rpm -ivh https://mirrors.aliyun.com/zabbix/zabbix/4.0/rhel/7/x86_64/zabbix-release-4.0-1.el7.noarch.rpm
清理缓存
yum clean all
yum makecache
安装zabbix、初始化mysql、zabbix数据库
  Yum -y install zabbix-server-mysql zabbix-web-mysql mariadb-server zabbix-agent
启动数据库并设置为开机自启
systemctl start mariadb
systemctl enable mariadb
修改mysql密码
mysql_secure_installation
进入mysql
Mysql -p123456
创建数据库和授权刷新
create database zabbix character set utf8 collate utf8_bin;
grant all privileges on zabbix.* to zabbix@localhost identified by '123456';
解压包
zcat /usr/share/doc/zabbix-server-mysql-4.0.5/create.sql.gz|mysql -uzabbix -p123456 zabbix
配置zabbix修改时间
vim /etc/httpd/conf.d/zabbix.conf
https://s1.运维网.com/images/blog/201903/17/970bcea662647f24d0ba0001ef15da8b.png
启动httpd并设置为开机自启
systemctl start httpd
systemctl enable httpd
改zabbix-server配置文件添加密码
vim /etc/zabbix/zabbix_server.conf
https://s1.运维网.com/images/blog/201903/17/a85f6bfe4bbfa4415b4f484497924c15.png
启动zabbix-server并设置为开机自启
systemctl start zabbix-server
systemctl enable zabbix-server
改zabbix-agent配置文件ip
vim /etc/zabbix/zabbix_agentd.conf
  访问http://192.168.10.157/zabbix进入zabbix页面
  在另外一台虚拟机安装zabbix-agent 和mysql
yum -y install zabbix-agent mariadb-server
改zabbix-agent配置文件中的ip(要写zabbix-server的ip)
vim /etc/zabbix/zabbix_agentd.conf
https://s1.运维网.com/images/blog/201903/17/590c7cba1d40c323bccb4d6b6ff5abc0.png
https://s1.运维网.com/images/blog/201903/17/288d5e124c253d28f5e69a77c9da5f46.png
启动zabbix-agent并设置为开机自启
systemctl start zabbix-agent
systemctl enable zabbix-agent
启动数据库并设置为开机自启
systemctl start mariadb
systemctl enable mariadb
访问zabbix页面创建主机群组
https://s1.运维网.com/images/blog/201903/17/72eddaf734cf627b9d271307c81aaa88.png
创建主机
https://s1.运维网.com/images/blog/201903/17/dded6fd02a74fe2bd99d1119fb46a8cf.png
创建监控项
https://s1.运维网.com/images/blog/201903/17/9993bf05b6362bb37d892fc73fd5f8aa.png
创建触发器
https://s1.运维网.com/images/blog/201903/17/d67386ec4a8cc5bd4e05914a77ea4bb8.png
创建图形
https://s1.运维网.com/images/blog/201903/17/fb7c2d567f13cdcad7408c44691515a4.png
https://s1.运维网.com/images/blog/201903/17/01e119a3724d3596c8d1b375a4f8df52.png



页: [1]
查看完整版本: Centos7 Zabbix监控mysql