系统环境:Centos6.8 mini
软件:zabbix-3.2.6
zabbix 服务端安装
安装yum 扩展源
rpm -ivh http://repo.webtatic.com/yum/el6/latest.rpm
安装PHP所需包
yum -y install httpd php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap wget ntpdate net-snmp* yum install -y gcc mysql-community-devel libxml2-devel unixODBC-devel net-snmp-devel libcurl-devel libssh2-devel OpenIPMI-devel openssl-devel openldap-devel
mysql安装及账号创建
yum -y install mysql-server mysql mysql-devel /etc/init.d/mysqld restart #启动数据库
创建zabbix数据库
mysql -u root
CREATE DATABASE zabbix CHARACTER SET utf8 COLLATE utf8_bin;
GRANT ALL PRIVILEGES ON zabbix.* TO zabbix@localhost IDENTIFIED BY 'zabbix';
创建zabbix用户
groupadd zabbix
useradd -g zabbix zabbix
下载zabbix3.2.0安装包
下载页面
https://www.zabbix.com/download
wget https://nchc.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/3.2.6/zabbix-3.2.6.tar.gz
导入zabbix 数据到数据库中
tar zxvf zabbix-3.2.6.tar.gz
cd zabbix-3.2.6/database/mysql/
mysql -u zabbix -p zabbix < schema.sql
mysql -u zabbix -p zabbix < images.sql
mysql -u zabbix -p zabbix < data.sql
编译安装zabbix
cd /root/zabbix-3.2.6/
./configure --enable-server --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2 --with-unixodbc --with-ssh2 --with-openipmi --with-openssl
make install
修改配置启动文件
vim /usr/local/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
创建zabbix-web页面文件夹
mkdir /var/www/html/zabbix
cd /root/zabbix-3.2.6/frontends/php/
\cp -a . /var/www/html/zabbix/
安全设置
创建一个规则允许web服务器访问前端文件
chcon -Rv --type=httpd_sys_content_t /var/www/html运行Apache和zabbix访问外网
setsebool -P httpd_can_network_connect=1
setsebool -P zabbix_can_network=1设置Apache用户web接口文件的所有者
chown -R apache:apache /var/www/html/zabbix为zabbix web界面添加权限
chmod +x /var/www/html/zabbix/conf/
cp /data/zabbix-3.2.0/misc/init.d/fedora/core/zabbix_server /etc/init.d/zabbix_server
chkconfig --add /etc/init.d/zabbix_server
启用Zabbix服务器,Apache和MySQL服务启动
chkconfig httpd on
chkconfig mysqld on
chkconfig zabbix_server on
启动
/etc/init.d/httpd start
service zabbix_server start
优化php
vim /etc/php.ini
post_max_size=16M
max_execution_time=300
max_input_time=300
date.timezone=Asia/Shanghai
always_populate_raw_post_data=-1/etc/init.d/httpd restart
配置防火墙
iptables -I INPUT -p tcp --dport 10050 -j ACCEPT
iptables -I INPUT -p tcp --dport 10051 -j ACCEPT
访问zabbix
http://zabbix_server_IP/zabbix/
zabbix 客户端安装
安装zabbix_agent
yum -y install http://repo.zabbix.com/zabbix/3.2/rhel/6/x86_64/zabbix-release-3.2-1.el6.noarch.rpm
yum install zabbix-agent -y
修改配置文件
sed -i 's/Server=127.0.0.1/Server=172.16.8.100/' /etc/zabbix/zabbix_agentd.conf
grep -n '^Server=' /etc/zabbix/zabbix_agentd.conf
/etc/init.d/zabbix-agent start
chkconfig zabbix-agent on
配置防火墙
iptables -I INPUT -p tcp --dport 10050 -j ACCEPT
iptables -I INPUT -p tcp --dport 10051 -j ACCEPT
中文乱码处理
zabbix3.2中文显示乱码的问题,
可以参考http://blog.csdn.net/xiegh2014/article/details/52038536[root@qas-zabbix include]# pwd
/var/www/html/zabbix/include
[root@qas-zabbix include]# vi defines.inc.php修改第93行
define('ZBX_FONT_NAME','msyh');
修改第45行改为
define('ZBX_GRAPH_FONT_NAME','msyh')
然后下载微软雅黑字体,改名为msyh传入 /var/www/html/zabbix/fonts目录下即可