zabbix安裝-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