实验还环境 centos7.3 mysql 5.6 zabbix 3.2
server端配置
rpm -ivh http://repo.zabbix.com/zabbix/3.2/rhel/7/x86_64/zabbix-release-3.2-1.el7.noarch.rpm #安装官网的zabbix的源
yum install -y mysql-community-bench.x86_64 mysql-community-client.x86_64 mysql-community-common.x86_64 mysql-community-devel.x86_64 mysql-connector-odbc.x86_64 mysql-community-server.x86_64 #安装mysql 。在zabbix需要依赖
systemctl restart mysqld #启动
yum -y install zabbix-server-mysql zabbix-web-mysql zabbix-agent
#安装zabbix组建。。如果失败做以下
vi /etc/yum.repos.d/zabbix.repo
gpgcheck=0
mysql
create database zabbix;
quit
cd /usr/share/doc/zabbix-server-mysql-3.2.4/
zcat create.sql.gz | mysql -uroot zabbix
mysql
grant all on zabbix.*to'zabbix'@'localhost' identified by 'zabbix'with grant option;
flush privileges;
设置时区,如果时区不正确zabbix无法安装成功
vi /etc/php.ini
date.timezone = Asia/Shanghai
vi /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix/zabbix_server.log
LogFileSize=0
PidFile=/var/run/zabbix/zabbix_server.pid
DBName=zabbix
DBUser=zabbix
SNMPTrapperFile=/var/log/snmptrap/snmptrap.log
Timeout=4
AlertScriptsPath=/usr/lib/zabbix/alertscripts
ExternalScripts=/usr/lib/zabbix/externalscripts
LogSlowQueries=3000
DBHost=localhost
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
systemctl start zabbix-server.service
setsebool -P httpd_can_connect_zabbix on
setsebool -P zabbix_can_network on
systemctl stop firewalld.service
systemctl start zabbix-server.service
systemctl enable zabbix-server.service
systemctl start httpd
解决zabbix中文乱码的问题
cp simkai.ttf /usr/share/zabbix/fonts/
vi /usr/share/zabbix/include/defines.inc.php
修改第45行修改字体为simkai
define('ZBX_GRAPH_FONT_NAME', 'simkai'); // font file name
如下截图所示
Zabbix监控磁盘io
在被监控的主机上创建key监控key
cd /etc/zabbix/zabbix_agentd.d
[root@master zabbix_agentd.d]# cat sda_io.conf
UserParameter=io_sda_idle,iostat -x /dev/sda | sed -n '4p' | awk '{print
$NF}'
UserParameter=io_sda_iowait,iostat -x /dev/sda | sed -n '4p' | awk
'{print $4}'
UserParameter=io_sda_tps,iostat -d /dev/sda | sed -n '4p' | awk '{print
$2}'
Zabbix服务器就会自动发信磁盘io监控数据。
客户端
yum install zabbix-agent.x86_64 -y
vi /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix/zabbix_agentd.pid
LogFile=/var/log/zabbix/zabbix_agentd.log
LogFileSize=0
Server=127.0.0.1
ServerActive=127.0.0.1
Hostname=Zabbix server
Include=/etc/zabbix/zabbix_agentd.d/*.conf
Server=192.168.1.144
ServerActive=192.168.1.144
Hostname=apach server
systemctl stop firewalld.service
systemctl start zabbix-agent.service
访问http://192.168.1.144/zabbix/ 测试配置
猛击下一步 密码zabbix 登录admin 密码zabbix
配置监控服务端
bingo!!!!!!!!!