虚拟化容器,大数据,DBA,中间件,监控。

nginx+php环境Zabbix2.4安装说明

27 02月
作者:admin|分类:监控安全

nginx+php环境Zabbix2.4安装说明



1、安装依赖包

yum -y install gcc gcc-c++ autoconf httpdphp mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysqlphp-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmathmysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp net-snmp-develcurl-devel
2、修改php.ini,以达到zabbixserver的要求
# 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和httpd

4、创建zabbix运行的用户和组
# groupadd  -g  201  zabbix
# useradd  -g  zabbix -u  201 zabbix

5、编译安装zabbix
# tar -zxf zabbix-2.4.2.tar.gz
# ./configure --prefix=/usr/local/zabbix--enable-server --enable-proxy --enable-agent --with-mysql=/usr/bin/mysql_config--with-net-snmp --with-libcurl
# make && make install

在文件/etc/services尾部追加以下记录:
zabbix-agent    10050/tcp               # Zabbix Agent
zabbix-agent    10050/udp               # Zabbix Agent
zabbix-server   10051/tcp               # zabbix Trapper
zabbix-server   10051/udp               # zabbix Trapper

6、导入数据库信息并授权
# mysql –uroot –p
mysql> create database zabbix characterset utf8;
mysql> grant all on zabbix.* tozabbix@localhost identified by ‘zabbix’;

# mysql -uzabbix -pzabbixzabbix<./database/mysql/schema.sql
# mysql -uzabbix -pzabbix zabbix<./database/mysql/images.sql
# mysql -uzabbix -pzabbix zabbix<./database/mysql/data.sql


7、创建相关的目录和链接
# mkdir /var/log/zabbix
# chown zabbix.zabbix /var/log/zabbix
# ln -s /usr/local/zabbix/etc/ /etc/zabbix
# ln -s /usr/local/zabbix/bin/* /usr/bin/
# ln -s /usr/local/zabbix/sbin/* /usr/sbin/

8、把zabbix server加入到系统服务
# cp zabbix-2.4.2/misc/init.d/fedora/core/zabbix_*/etc/init.d
# vim /etc/init.d/zabbix_server
BASEDIR=/usr/local/zabbix
# vim /etc/init.d/zabbix_agentd
BASEDIR=/usr/local/zabbix

9、修改配置文件
# vim /etc/zabbix/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
LogFile=/var/log/zabbix/zabbix_server.log

10、设置zabbix监控自己
# vim /etc/zabbix/zabbix_agentd.conf
LogFile=/var/log/zabbix/zabbix_agentd.log
Server=127.0.0.1,x.x.x.x
ServerActive=x.x.x.x:10051
Hostname=主机名
UnsafeUserParameters=1

11、拷贝网页文件到nginx网站目录
# cp -r zabbix-2.4.2/frontends/php//usr/share/nginx/html/zabbix
# chown -R nginx.nginx/usr/share/nginx/html/zabbix/

12、启动zabbix_server和zabbix_agentd并设置开机自启动
# service zabbix_server start
# chkconfig zabbix_server on
# service zabbix_agentd start
# chkconfig zabbix_agentd on

13、在web页面中安装zabbix
浏览1815 评论0
返回
目录
返回
首页
主机配置双线双IP Nginx的负载均衡方案详解