zabbix 安装
一,服务端
1.配置zabbix源
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
2.安装zabbix部署包
yum install zabbix-server-mysql zabbix-web-mysql httpd php mariadb-server -y
3.启动并配置数据库
# 启动数据库
systemctl start mariadb && systemctl enable mariadb
# 设置数据库密码
mysqladmin -uroot password '123456'
mysql -uroot -p123456
# 创建库
create database zabbix character set utf8 collate utf8_bin;
#授权
grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
4.安装初始化数据库
cd /usr/share/doc/zabbix-server-mysql-3.4.15/ && zcat create.sql.gz | mysql -uzabbix -pzabbix zabbix
# 验证
mysql -uzabbix -pzabbix -e 'use zabbix;show tables;'
5.启动zabbix server进程
vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
6.配置PHP时区
# 配置Apache与Php配置
sed -i 's#\# php_value date.timezone Europe/Riga#php_value date.timezone Asia/Shanghai#g' /etc/httpd/conf.d/zabbix.conf
7.解决中文乱码
yum -y install wqy-microhei-fonts \cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
8.启动zabbix相关服务
systemctl start zabbix-server && systemctl enable zabbix-server
systemctl start httpd && systemctl enable httpd
9.默认端口为10051
netstat -tunpl|grep 10051
10.访问
http://192.168.12.91/zabbix
#默认登录用户:Admin
#默认登录密码:zabbix
二,客户端
-
安装对应版本的agent
rpm -ivh http://repo.zabbix.com/zabbix/3.4/rhel/7/x86_64/zabbix-release-3.4-2.el7.noarch.rpm
2.安装zabbix客户端
yum install zabbix-agent -y
sed -i.ori 's#Server=127.0.0.1#Server=192.168.13.91#' /etc/zabbix/zabbix_agentd.conf
# 启动并加入开机自启
systemctl start zabbix-agent.service && systemctl enable zabbix-agent.service
三.服务端试连通性
# 服务端安装zabbix-get检测工具
yum install zabbix-get -y
# 只能在服务端进行测试 这里的ip是客户端的ip
zabbix_get -s 192.168.13.92 -p 10050 -k "system.cpu.load[all,avg1]"
0.000000
zabbix_get -s 192.168.13.93 -p 10050 -k "system.cpu.load[all,avg1]" 0.000000
被监控端
1.安装agent包
yum install zabbix-agent -y