zabbix (可以实现网络 架构等服务的监控 基于C语言开发 通过web界面进行管理 php制作 lamp的环境)
高可用性 HA high available
最长业务中断时间
(1-90%)x365
(1-99%)x365
(1-99.9%)x365
....
6个9的情况 也就是(1-99.9999%)x365 说明软件系统是具备优秀的高可用性
是一款开源的监控工具 可以大规模监控Linux系统状况
监控
1.机房中的硬件监控 路由器交换机等
2.软件监控 系统cpu 内存 硬盘等的监控 服务监控 性能监控 日志监控 网络监控(带宽 流量是否出现异常这种)
实验环境
server1 Linux 作为主机
server2 Linux 作为被监控的机器
server1端的配置
setenforce 0
systemctl stop firewalld
1.更换阿里源
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
yum install -y http://mirrors.aliyun.com/zabbix/zabbix/3.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
2.安装zabbix
yum install -y zabbix-server-mysql zabbix-web-mysql
3.安装mysql数据库
yum install -y mariadb-server
systemctl start mariadb.service
4.创建数据库
mysql -e 'create database zabbix character set utf8 collate utf8_bin;'
mysql -e 'grant all privileges on zabbix.* to zabbix@localhost identified by "zabbix";'
5.导入数据
cd /usr/share/doc/zabbix-server-mysql-3.0.32/
ls
zcat create.sql.gz | mysql -uzabbix -pzabbix zabbix
6.配置zabbix连接mysql
sed -i.ori '115a DBPassword=zabbix' /etc/zabbix/zabbix_server.conf
7.添加时区
sed -i.ori '18a php_value date.timezone Asia/Shanghai' /etc/httpd/conf.d/zabbix.conf
8.解决中文乱码问题
yum -y install wqy-microhei-fonts
\cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
9.启动服务
systemctl start zabbix-server
systemctl start httpd
10.设置开机自启动(非必须)
chmod +x /etc/rc.d/rc.local
cat >>/etc/rc.d/rc.local<<EOF
systemctl start mariadb.service
systemctl start httpd
systemctl start zabbix-server
EOF
11.输出信息
echo "浏览器访问 http://`hostname -I|awk '{print $1}'`/zabbix"
server2客户端的部署
1.关闭防火墙等信息
setenforce 0
systemctl stop firewalld
2.修改为阿里源
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.0/rhel/7/x86_64/zabbix-release-3.0-1.el7.noarch.rpm
3.安装zabbix的客户端
yum install zabbix-agent -y
4.设置主服务器的IP,修改配置文件
/etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1
ServerActive=127.0.0.1
改为
Server=192.168.31.249
ServerActive=192.168.31.249
或者直接一条命令
sed -i.ori 's#Server=127.0.0.1#Server=192.168.109.130#' /etc/zabbix/zabbix_agentd.conf
5.启动服务
systemctl start zabbix-agent.service
6.写入为开机启动(非必须)
chmod +x /etc/rc.d/rc.local
cat >>/etc/rc.d/rc.local<<EOF
systemctl start zabbix-agent.service
EOF
服务端安装检测工具 可以用来检测小弟是否存在
yum install zabbix-get
zabbix_get -s 192.168.109.138 -p 10050 -k "system.cpu.load[all,avg1]"
netstat -ano | grep 10050
通过web安装控制平台
http://192.168.109.134/zabbix
用户名默认Admin 密码默认zabbix ps:用户名的A是大写
zabbix安装部署完成