zabbix3.4 yum快速安装

centos6.8
添加zabbix源
 
添加php源
 
安装监控平台服务端,带有web管理界面:
# yum install -y zabbix-server-mysql zabbix-web-mysql httpd libxml2-devel net-snmp-devel libcurl-devel php56w php56w-gd php56w-mysql php56w-bcmath php56w-mbstring php56w-xml php56w-ldap mysql mysql-server 
启动mysql
# service mysqld start
# chkconfig mysqld on
设置mysql安全选项
# mysql_secure_installation
启动mysql,添加用户和库
mysql> create database zabbix default charset utf8;
mysql> grant all on zabbix.* to zabbix@'localhost' identified by '123';
mysql> grant all on zabbix.* to zabbix@'127.0.0.1' identified by '123';
导入初始数据
# zcat /usr/share/doc/zabbix-server-mysql-3.*/create.sql.gz | mysql -uzabbix -p123 zabbix
 
配置zabbix-server
# mv /etc/zabbix/zabbix_server.conf /etc/zabbix/zabbix_server.conf.bak
# vi /etc/zabbix/zabbix_server.conf
DBHost=localhost
DBSocket=/var/lib/mysql/mysql.sock
DBName=zabbix
DBUser=zabbix
DBPassword=123
LogFile=/var/log/zabbix/zabbix_server.log
 
修改php配置
# vi /etc/php.ini
max_execution_time 300
memory_limit 128M
post_max_size 16M
upload_max_filesize 2M
max_input_time 300
always_populate_raw_post_data -1
date.timezone=Asia/Shanghai      #修改时区
 
将zabbix相关网页文件复制到相关目录
# mkdir /var/www/html/zabbix
# cp -r /usr/share/zabbix/* /var/www/html/zabbix/
# chown -R apache:apache /etc/zabbix/web
配置zabbix虚拟主机
# vim /etc/httpd/conf.d/zabbix.conf
Listen 8080  #增加一个端口的监听
 
<VirtualHost *:8080>
    DocumentRoot /var/www/html/zabbix/
    ServerName zabbix
    ErrorLog logs/zabbix-error_log
    CustomLog logs/zabbix-access_log combined
 
    <Directory "/var/www/html/zabbix">
        Options  FollowSymLinks
        AllowOverride None
        Order allow,deny
        Allow from all
    </Directory>
 
</VirtualHost>
 
启动zabbix-server
# chkconfig zabbix-server on
# service zabbix-server start
 
 
安装Zabbix Agent
# yum -y install zabbix-agent
修改Zabbix Agent配置
# vi /etc/zabbix/zabbix_agentd.conf
Server=127.0.0.1 <--- 填写zabbix-server,允许 该IP 链接本机的agent获取数据
ListenPort=10050
ServerActive=127.0.0.1 <--- 填写zabbix-server , 本agent主动向该IP提交监控数据
Hostname=Zabbix server <---给agent设定一个名字,监控平台服务端必须使用该名字才能监控本机
   因为默认zabbix-server监控第一台机器就是填写该名字
设置Zabbix Agent自动启动并启动Zabbix Agent
# chkconfig zabbix-agent on
# service zabbix-agent start
启动apache
# service httpd start
# chkconfig httpd on
打开端口
# vi /etc/sysconfig/iptables
*filter
:INPUT ACCEPT [0:0]
:FORWARD ACCEPT [0:0]
:OUTPUT ACCEPT [0:0]
-A INPUT -m state --state NEW -m tcp -p tcp --dport 80 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10050 -j ACCEPT
-A INPUT -m state --state NEW -m tcp -p tcp --dport 10051 -j ACCEPT
COMMIT
 
#解决中文乱码
# yum -y install wqy-microhei-fonts
# cp /usr/share/fonts/wqy-microhei/wqy-microhei.ttc /usr/share/fonts/dejavu/DejaVuSans.ttf
 
第二次测试时发现安装完zabbix后,打开是空白页,检查apache-error.log有以下报错
PHP Fatal error:  require_once(): Failed opening required '/etc/zabbix/web/maintenance.inc.php' (include_path='.:/usr/share/pear:/usr/share/php') in /var/www/html/zabbix/include/classes/core/ZBase.php on line 269
权限问题
# chown -R apache:apache /etc/zabbix/web  或者
# chmod -R 755 /etc/zabbix/web

posted on 2017-06-22 14:40  森度  阅读(328)  评论(0编辑  收藏  举报

导航