服务端:
[[email protected] ~]#rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-
1.el6.noarch.rpm
安装rpm包的lamp环境
[[email protected] ~]#yum install -y httpd mysql mysql-libs php php-mysql mysql-server php-bcmath php-gd
php-mbstring
安装zabbix服务端
[[email protected] ~]#yum install zabbix zabbix-server zabbix-web zabbix-server-mysql zabbix-web-mysql net-
snmp-devel -y
客户端:
[[email protected] ~]#rpm -ivh http://repo.zabbix.com/zabbix/3.0/rhel/6/x86_64/zabbix-release-3.0-
1.el6.noarch.rpm
[[email protected] ~]#yum install -y zabbix-agent
#这里有必要说一下zabbix3.0必须要php5.4以上因此需要安装特殊源,才能够安装php5.5
查看当前的php版本
[[email protected] ~]# 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版本,可运行如下命令:
[[email protected] ~]#yum install yum-plugin-replace
[[email protected] ~]#yum replace php-common --replace-with=php55w-common
1、
MySQL配置
[[email protected] ~]#cp /usr/share/mysql/my-medium.cnf /etc/my.cnf
启动MySQL
[[email protected] ~]#/etc/init.d/mysqld start
创建用户并授权
[[email protected] ~]#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 [email protected] identified by ‘zabbix‘;
mysql> flush privileges;
mysql> exit
这里创建数据库一定要是utf8的编码
2、复制站点
[[email protected] ~]#cp -R /usr/share/zabbix/ /var/www/html/
3、导入数据文件
[[email protected] ~]#cd /usr/share/doc/zabbix-server-mysql-3.0.3
[[email protected] ~]#zcat create.sql.gz |mysql -uzabbix -pzabbix zabbix
4、文件授权
[[email protected] ~]#chmod -R 755 /etc/zabbix/web
[[email protected] ~]#chown -R apache.apache /etc/zabbix/web
5、启动apache && zabbix
[[email protected] ~]#/etc/init.d/zabbix-server start
[[email protected] ~]#/etc/init.d/zabbix-agent start
[[email protected] ~]#/etc/init.d/httpd start
6、检测
[[email protected] ~]# netstat -lntp
[[email protected] 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
[[email protected] ~]#vi /etc/httpd/conf/httpd.conf
ServerName 127.0.0.1:80
7、相关数据修改
修改php配置文件
[[email protected] ~]#vim /etc/php.ini
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
date.timezone = Asia/shanghai
修改zabbix_server配置文件
[[email protected] ~]#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安装完毕
设置中文
观察日志解决问题
[[email protected] ~]#tail -f /var/log/httpd/error_log
[[email protected] ~]#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 [email protected] identified by ‘zabbix‘;
(二)
cannot send list of active checks to "127.0.0.1": host [Zabbix server] not monitored
解决方法:
需要把客户端的配置文件的Hostname改成和主机的hostname一样
服务端的主机名必须与客户端Hostname一样