标签:
搭建环境centos6.6,php+nginx+mysql+zabbix
1、安装依赖包
yum install -y gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel curl-devel unixODBC-devel OpenIPMI-devel java-devel libssh2 libssh2-devel
2、配置php
vim /etc/php.ini
date.timezone =Asia/Shanghai
max_execution_time = 300
post_max_size = 32M
max_input_time = 300
memory_limit = 128M
;mbstring.func_overload = 2 //需要注销使用;号
3、配置mysql
参考http://www.cnblogs.com/shhnwangjian/p/5522505.html
4、新增用户
groupadd zabbix
useradd zabbix -g zabbix -s /sbin/nologin
5、安装zabbix
tar -xvf zabbix-3.0.4.tar.gz
cd zabbix-3.0.4
./configure --prefix=/usr/local/zabbix --sysconfdir=/etc/zabbix --enable-server --enable-proxy --enable-agent --enable-ipv6 --with-mysql=/usr/bin/mysql_config --with-net-snmp --with-libcurl --with-openipmi --with-unixodbc --with-ssh2 --enable-java
make
make install
6、导入数据
mysql -u root -p
输入密码
CREATE DATABASE IF NOT EXISTS zabbix DEFAULT CHARSET utf8 COLLATE utf8_general_ci; //创建zabbix数据库,并设置字符集为utf8
grant all privileges on zabbix.* to zabbix@localhost identified by ‘zabbix‘; //创建zabbix帐号并赋权,密码为zabbix
flush privileges;
exit退出
通过zabbix账号登陆mysql -u zabbix -p
输入密码
source /home/software/zabbix-3.0.4/database/mysql/schema.sql; //proxy服务器的话只需要导入这个即可
source /home/software/zabbix-3.0.4/database/mysql/images.sql;
source /home/software/zabbix-3.0.4/database/mysql/data.sql;
show tables; //查看导入的表
7、zabbix启动脚本
cp /home/software/zabbix-3.0.4/misc/init.d/fedora/core/zabbix_* /etc/init.d/ //添加服务
chmod 755 /etc/init.d/zabbix_*
vim /etc/init.d/zabbix_server //将BASEDIR修改为安装路径
vim /etc/init.d/zabbix_agentd将BASEDIR修改为安装路径
8、修改/etc/zabbix/zabbix_server.conf
vim /etc/zabbix/zabbix_server.conf
LogFile=/tmp/zabbix_server.log
DBHost=localhost
DBPort=3306
DBName=zabbix //zabbix所属数据库名称
DBUser=zabbix //zabbix所属数据库用户
DBPassword=zabbix //zabbix数据库密码
DBSocket=/var/lib/mysql/mysql.sock
StartPollers=500 //轮询的初始值(0-1000)
StartIPMIPollers=10 //IPMI轮询的初始值(0-1000)
StartPollersUnreachable=150 //轮询不可达的主机数(包括IPMI 0-1000)
StartTrappers=20 //捕获的初始值(0-1000)
StartPingers=10 //ping的初始值(0-1000)
StartDiscoverers=5 //自动发现的初始值(0-250)
CacheSize=256M //缓存大小
CacheUpdateFrequency=300 //缓存更新的频率
StartDBSyncers=8 //数据库同步时间
TrendCacheSize=128M //总趋势缓存大小
AlertScriptsPath=/home/zabbix/alertscripts //脚本的存放位置
LogSlowQueries=3000 //日志慢查询设定
9、nginx配置
nginx安装参考
cp -rf /home/software/zabbix-3.0.4/frontends/php/* /usr/local/nginx/html/zabbix/
vim /etc/php.ini
date.timezone =Asia/Shanghai
max_execution_time = 300
post_max_size = 32M
max_input_time = 300
memory_limit = 128M
;mbstring.func_overload = 2 //需要注销使用 ;号
标签:
原文地址:http://www.cnblogs.com/shhnwangjian/p/5740441.html