安装zabbix2.2.5+php5.5+mysql5.5.9+nginx1.5.1

先安装php,nginx和mysql
php编译参数:

./configure \
–prefix=/usr/local/php5 \
–with-bz2 \
–with-curl \
–enable-ftp \
–enable-sockets \
–enable-bcmath \
–disable-ipv6 \
–with-gd \
–with-jpeg-dir=/usr/local \
–with-png-dir=/usr/local \
–with-freetype-dir=/usr/local \
–enable-gd-native-ttf \
–with-iconv-dir=/usr/local \
–enable-mbstring \
–enable-calendar \
–with-gettext \
–with-libxml-dir=/usr/local \
–with-zlib \
–with-pdo-mysql=mysqlnd \
–with-mysqli=mysqlnd \
–with-mysql=mysqlnd \
–enable-dom \
–enable-xml \
–enable-fpm \
–with-libdir=lib64

 

php装好之后需要修改php.ini为以下值,以满足zabbix安装需要

max_execution_time = 300
memory_limit = 128M
post_max_size = 16M
upload_max_filesize = 2M
max_input_time = 300
date.timezone PRC

nginx编译参数

./configure –prefix=/usr/local/nginx –add-module=/usr/local/src/nginx_upstream_check_module-master –with-http_stub_status_module –with-http_ssl_module –with-http_realip_module –with-http_sub_module –with-http_gzip_static_module –with-http_flv_module –with-http_dav_module –with-http_spdy_module –with-pcre –with-debug

 
mysql安装略过 安装zabbix
注意:zabbix只使用普通用户运行,如果在root环境下运行zabbix,那么zabbix将会主动使用zabbix用户来运行。

groupadd zabbix&&useradd -g zabbix zabbix
cd /usr/local/src/
wget http://jaist.dl.sourceforge.net/project/zabbix/ZABBIX%20Latest%20Stable/2.2.5/zabbix-2.2.5.tar.gz
tar -zxvf zabbix-2.2.5.tar.gz
cd /usr/local/src/zabbix-2.2.5
./configure –prefix=/usr/local/zabbix/ –enable-server –enable-agent –with-mysql –with-net-snmp –with-libcurl –with-libxml2
make&&make install

 

复制前端文件到主目录

cp -r /usr/local/src/zabbix-2.2.5/frontends/php/* /usr/local/nginx/html/zabbix/

 

修改nginx虚拟主机配置

server {
        listen       80;
        server_name  zabbix.abc.com;
        access_log  /usr/local/nginx/logs/zabbix.abc.com.log  main;

        index         index.html index.htm index.php;
        root         /usr/local/nginx/html/zabbix;

        location / {
                try_files $uri $uri/ /index.php?$args;
        }
        location ~ ^(.+.php)(.*)$ {
                fastcgi_split_path_info ^(.+.php)(.*)$;
                include fastcgi.conf;
                fastcgi_pass  127.0.0.1:9000;
                fastcgi_index index.php;
                fastcgi_param  PATH_INFO          $fastcgi_path_info;
        }
}

 
访问http://zabbix.abc.com开始配置

安装zabbix客户端

groupadd zabbix&&useradd -g zabbix zabbix
cd /usr/loca/src/
wget http://www.zabbix.com/downloads/2.2.5/zabbix_agents_2.2.5.linux2_6.amd64.tar.gz
mkdir /usr/local/zabbix_agent
tar -zxvf zabbix_agents_2.2.5.linux2_6.amd64.tar.gz -C /usr/local/zabbix_agent/
cd /usr/local/zabbix_agent/&&mkdir logs
chown -R zabbix:zabbix/usr/local/zabbix_agent

 

修改客户端配置文件

# vi /usr/local/zabbix_agent/conf/zabbix_agentd.conf

LogFile=/usr/local/zabbix_agent/logs/zabbix_agentd.log
Server=192.168.0.1
ServerActive=192.168.0.1
Hostname=Zabbix server

 

注意:Server和ServerActive都是指定zabbixserver的IP地址,Server是用来允许192.168.0.1来客户端取数据。而serverActive的192.168.0.1的意思是,客户端主动提交数据给服务器端 启动客户端

/usr/local/zabbix_agent/sbin/zabbix_agentd -c /usr/local/zabbix_agent/conf/zabbix_agentd.conf

检查是否正常启动

netstat -nlp|grep 10050

 

写一个客户端启动脚本链接到/etc/init.d/目录下

# more /etc/init.d/zabbix_agentd_srv
 
#!/bin/bash
# chkconfig: 345 20 80
# description: zabbix_agentd auto start-stop script.

case "$1" in

start)
echo "Starting zabbix_agentd ... "
/usr/local/zabbix_agent/sbin/zabbix_agentd -c /usr/local/zabbix_agent/conf/zabbix_agentd.conf
;;

stop)
echo "Stopping zabbix_agentd ... " 
/usr/bin/killall zabbix_agentd 
;;

restart)
$0 stop
sleep 2
$0 start
;;

*)
echo "Usage: $0 {start|stop|restart}" 
exit 1
esac

 

发表评论

电子邮件地址不会被公开。 必填项已用*标注