zabbix实现自动化运维监控
- zabbix([`zæbiks])是一个基于WEB界面的提供分布式系统监视以及网络监视功能的企业级的开源解决方案。
- zabbix能监视各种网络参数,保证服务器系统的安全运营;并提供灵活的通知机制以让系统管理员快速定位/解决存在的各种问题。
- zabbix由2部分构成,zabbix server与可选组件zabbix agent。
Zabbix主要功能:
- CPU负荷
- 内存使用
- 磁盘使用
- 网络状况
- 端口监视
- 日志监视。
任务目的
• 学习Zabbix 的安装
• 掌握Zabbix 的简单配置
安装Zabbix
一、Zabbix安装部署环境准备
[root@compute ~]# cat /etc/redhat-release // 查看系统版本
CentOS Linux release 7.4.1708 (Core)
[root@compute ~]# uname -r // 查看内核版本
3.10.0-693.el7.x86_64
[root@compute ~]# getenforce // 检测selinux是否关闭
Enforcing
[root@compute ~]# vim /etc/selinux/config // 关闭selinux
SELINUX=disabled
Init 6 // 如果是Enforcing 设置后重启
[root@compute ~]# setenforce 0 //临时关闭
[root@compute ~]# systemctl disable firewalld // 关闭防火墙开机自启动
Removed symlink /etc/systemd/system/multi-user.target.wants/firewalld.service.
Removed symlink /etc/systemd/system/dbus-org.fedoraproject.FirewallD1.service.
[root@compute ~]# systemctl stop firewalld // 关闭防火墙
二、安装MySQL,并初始化
1)安装数据库
[root@compute ~]# yum install -y mariadb-server
[root@compute ~]systemctl start mariadb
2)设root用户密码
[root@compute ~]# mysqladmin -u root password 123456
初始化zabbix库、表用户
1、[root@compute ~]# mysql -u root –p123456
2、MariaDB [(none)]> create database zabbix character set utf8 collate utf8_bin;
3、MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
4、MariaDB [(none)]> grant all privileges on zabbix.* to zabbix@compute identified by 'zabbix';
5、\q;
三、安装zabbix
1)安装zabbix的yum源
[root@compute ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-local.repo CentOS-Sources.repo
[root@compute ~]# rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
[root@compute ~]# ls /etc/yum.repos.d/
CentOS-Base.repo CentOS-local.repo CentOS-Sources.repo zabbix.repo
[root@compute ~]# cat /etc/yum.repos.d/zabbix.repo
显示:
[zabbix]
name=Zabbix Official Repository - b a s e a r c h b a s e u r l = h t t p