首页 > 代码库 > 安装部署zabbix3.0

安装部署zabbix3.0


服务端:

[root@zabbix ~]#rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-


1.el6.noarch.rpm



安装rpm包的lamp环境 

[root@zabbix ~]#yum install -y  httpd mysql mysql-libs php php-mysql mysql-server php-bcmath php-gd 


php-mbstring


安装zabbix服务端

[root@zabbix ~]#yum install zabbix zabbix-server zabbix-web zabbix-server-mysql zabbix-web-mysql net-


snmp-devel -y



客户端:

[root@zabbix ~]#rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-


1.el6.noarch.rpm

[root@zabbix ~]#yum install -y zabbix-agent




#这里有必要说一下zabbix3.0必须要php5.4以上因此需要安装特殊源,才能够安装php5.5

查看当前的php版本

[root@zabbix ~]# php -v

PHP 5.3.3 (cli) (built: Aug 11 2016 20:33:53) 

Copyright (c) 1997-2010 The PHP Group

Zend Engine v2.3.0, Copyright (c) 1998-2010 Zend Technologies


如果确定要完全升级系统的PHP版本,可运行如下命令:

[root@zabbix ~]#yum install yum-plugin-replace

[root@zabbix ~]#yum replace php-common --replace-with=php55w-common



1、

MySQL配置

[root@zabbix ~]#cp /usr/share/mysql/my-medium.cnf /etc/my.cnf

启动MySQL

[root@zabbix ~]#/etc/init.d/mysqld start

创建用户并授权

[root@zabbix ~]#mysql

Welcome to the MySQL monitor.  Commands end with ; or \g.

Your MySQL connection id is 2

Server version: 5.1.73-log Source distribution


Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.


Oracle is a registered trademark of Oracle Corporation and/or its

affiliates. Other names may be trademarks of their respective

owners.


Type ‘help;‘ or ‘\h‘ for help. Type ‘\c‘ to clear the current input statement.


mysql> CREATE DATABASE `zabbix` DEFAULT CHARACTER SET utf8 COLLATE utf8_general_ci;

Query OK, 1 row affected (0.00 sec)


mysql> show create database zabbix;

+----------+-----------------------------------------------------------------+

| Database | Create Database                                                 |

+----------+-----------------------------------------------------------------+

| zabbix   | CREATE DATABASE `zabbix` /*!40100 DEFAULT CHARACTER SET utf8 */ |

+----------+-----------------------------------------------------------------+


mysql> grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘;

mysql> flush privileges;

mysql> exit


这里创建数据库一定要是utf8的编码




2、复制站点

[root@zabbix ~]#cp -R /usr/share/zabbix/ /var/www/html/



3、导入数据文件

[root@zabbix ~]#cd /usr/share/doc/zabbix-server-mysql-3.0.3

[root@zabbix ~]#zcat create.sql.gz |mysql -uzabbix -pzabbix zabbix



4、文件授权

[root@zabbix ~]#chmod -R 755 /etc/zabbix/web

[root@zabbix ~]#chown -R apache.apache /etc/zabbix/web 




5、启动apache && zabbix

[root@zabbix ~]#/etc/init.d/zabbix-server start

[root@zabbix ~]#/etc/init.d/zabbix-agent start

[root@zabbix ~]#/etc/init.d/httpd start




6、检测

[root@zabbix ~]# netstat -lntp

[root@zabbix html]# netstat -lntp

Active Internet connections (only servers)

Proto Recv-Q Send-Q Local Address         

tcp        0      0 0.0.0.0:22            

tcp        0      0 127.0.0.1:25          

tcp        0      0 0.0.0.0:10050         

tcp        0      0 0.0.0.0:10051         

tcp        0      0 0.0.0.0:3306          

tcp        0      0 :::80                 

tcp        0      0 :::22                 

tcp        0      0 ::1:25                

tcp        0      0 :::10050              

tcp        0      0 :::10051              



修复apache的wring

[root@zabbix ~]#vi /etc/httpd/conf/httpd.conf

ServerName 127.0.0.1:80




7、相关数据修改

修改php配置文件

[root@zabbix ~]#vim /etc/php.ini

post_max_size = 16M

max_execution_time = 300

max_input_time = 300

date.timezone = Asia/shanghai


修改zabbix_server配置文件

[root@zabbix ~]#vi /etc/zabbix/zabbix_server.conf

修改数据库地址、数据库名、 用户、密码

分别对应

DBName=zabbix

DBUser=zabbix

DBPassword=zabbix

DBSocket=/var/lib/mysql/mysql.sock



配置web安装

登录web进行安装

http://192.168.1.169/zabbix/


技术分享


技术分享



输入zabbix数据的账号密码

技术分享



技术分享

技术分享

技术分享



登录账号Admin  密码zabbix

技术分享



zabbix安装完毕


技术分享




设置中文

技术分享






技术分享




技术分享








观察日志解决问题

[root@zabbix ~]#tail -f /var/log/httpd/error_log

[root@zabbix ~]#tail -f /var/log/zabbix/zabbix_server.log


故障

(一)

connection to database ‘zabbix‘ failed: [1045] Access denied for user ‘zabbix‘@‘localhost‘ (using 


password: YES)

  2757:20160912:192912.707 cannot set MySQL character set to "utf8"


解决方法:

正确的授权

grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘;





(二)

cannot send list of active checks to "127.0.0.1": host [Zabbix server] not monitored


解决方法:

需要把客户端的配置文件的Hostname改成和主机的hostname一样

服务端的主机名必须与客户端Hostname一样



本文出自 “比尔运维笔记” 博客,请务必保留此出处http://chenshoubiao.blog.51cto.com/6159058/1852420

安装部署zabbix3.0