linux安裝zabbix服務器端文檔

       

Zabbix 是一個提供 Web  管理界面的開源系統/網絡監控服務器。
官方的文檔寫得很是好,許多內容這裏就不介紹了,能夠直接看官方文檔:
http://www.zabbix.com/documentation/php

本文只記錄個人 Zabbix 1.8 的安裝過程。
如下我要在同一臺服務器上安裝 Zabbix Server、Zabbix Proxy 和  Zabbix Agent。html

安裝前先配置好PHP,要求支持  php-gd、php-bcmath、php-xml、php-mysql、php-net-socket、php-mbstring,即 configure  參數中加上 --with-gd --enable-bcmath --enable-xml --with-mysql --enable-sockets  --enable-mbstring。mysql

個人配置參數以下:nginx

./configure --prefix=/usr/local/php  --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql  --with-mysqli=/usr/local/mysql/bin/mysql_config --enable-fpm --enable-sockets  --enable-pdo --with-pdo-mysql=/usr/local/mysql --with-gd --enable-bcmath  --enable-xml --enable-mbstringweb

下面開始安裝 Zabbix:sql

* 下載並解壓:數據庫

wget  http://prdownloads.sourceforge.net/zabbix/zabbix-1.8.tar.gz?download
tar zxf  zabbix-1.8.tar.gz
cd zabbix-1.8服務器

* 建立 zabbix 用戶組和用戶:網絡

groupadd zabbix
useradd zabbix -g zabbixapp

* 建立 mysql 數據庫:

create database zabbix character set utf8;

* 建立 mysql 用戶:

grant all on zabbix.* to zabbix@localhost identified by  'zabbix';

* 導入表和數據:

mysql -uroot -p zabbix < create/schema/mysql.sql
mysql -uroot -p zabbix  < create/data/data.sql
mysql -uroot -p zabbix <  create/data/p_w_picpaths_mysql.sql

* 配置編譯:

./configure --prefix=/usr/local/zabbix  --with-jabber  --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp -with-libcurl  --enable-server --enable-agent --with-jabber=/usr/local/
make && make  install

(

編譯zabbix時候,出現:
configure: error: Jabber library not found

解決:
# wget http://iksemel.googlecode.com/files/iksemel-1.4.tar.gz
#  tar zxvf iksemel-1.4.tar.gz
# cd iksemel-1.4
# ./configure    //此處可不帶編譯參數
# make && make install

)

配置參數說明:

--enable-server 安裝 Zabbix Server
--enable-proxy 安裝 Zabbix  Proxy
--enable-agent 安裝 Zabbix Agent
--with-mysql 使用 mysql  作數據庫服務器
--with-net-snmp 支持 SNMP
--with-libcurl 支持 curl,用於 web  監控

* 服務端口定義:
編輯 /etc/services,在後面追加:

zabbix-agent 10050/tcp Zabbix Agent
zabbix-agent 10050/udp Zabbix  Agent
zabbix-trapper 10051/tcp Zabbix Trapper
zabbix-trapper 10051/udp  Zabbix Trapper

* 複製配置文件:

mkdir /etc/zabbix
cp misc/conf/zabbix_server.conf /etc/zabbix/
cp  misc/conf/zabbix_proxy.conf /etc/zabbix/
cp misc/conf/zabbix_agent.conf  /etc/zabbix/
cp misc/conf/zabbix_agentd.conf /etc/zabbix/

* 修改 zabbix server 配置文件 /etc/zabbix/zabbix_server.conf 中的數據庫用戶名和密碼:

DBUser=zabbix
DBPassword=zabbix

* 安裝啓動腳本

cp misc/init.d/gentoo/zabbix-server /etc/init.d/
cp  misc/init.d/gentoo/zabbix-agentd /etc/init.d/

添加可執行權限:

chmod +x /etc/init.d/zabbix-server
chmod +x  /etc/init.d/zabbix-agentd

修改 zabbix-server 頭部變量定義:

NAME=zabbix_server
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/local/sbin/${NAME}
DESC="Zabbix  1.4"
PID=/var/run/$NAME.pid

修改 zabbix-agentd 頭部變量定義:

NAME=zabbix_agentd
PATH=/bin:/usr/bin:/sbin:/usr/sbin
DAEMON=/usr/local/sbin/${NAME}
DESC="Zabbix  1.4"
PID=/var/run/$NAME.pid

* 添加到啓動服務:

rc-update add zabbix-server default
rc-update add zabbix-agentd  default

* 啓動 Zabbix Server:

/etc/init.d/zabbix-server start

我啓動時提示錯誤:

zabbix_server: error while loading shared libraries: libmysqlclient.so.16:  cannot open shared object file: No such file or directory

由於個人 mysql client 庫不在系統默認庫中,作如下修改後從新啓動就能夠了:

echo /usr/local/mysql/lib/mysql/ >>  /etc/ld.so.conf
ldconfig

* 啓動 Zabbix Agentd

/etc/init.d/zabbix-agentd start

* 複製 Web Interface 到 web 目錄:

cp -r frontends/php /work/www/zabbix

* 新建 nginx 配置:

server {
listen       80;
server_name  zabbix.local zabbix.hily;

access_log  /work/www/logs/zabbix.local.access.log  main;

location / {
root   /work/www/zabbix;
index  index.html index.htm index.php;
}

location ~ \.php$ {
root           /work/www/zabbix;
fastcgi_index  index.php;
include        fastcgi_params;
}

}

* 開始安裝 Zabbix Web Interface
打開 http://zabbix.local/,看到提示:

Timezone for PHP is not set. Please set "date.timezone" option in  php.ini.

按照提示,修改 php.ini 中時區設置:

date.timezone = Asia/Shanghai

重啓 PHP-FPM:

/etc/init.d/php-fpm restart


再次修改 php.ini:

post_max_size = 16M
max_execution_time = 300
mbstring.func_overload =  2

解決後按提示繼續安裝便可。

*  結束:
安裝完後直接訪問:
http://zabbix.local/
默認用戶名和密碼是:
Admin/zabbix
到此安裝完成!

本文出自 「王偉」 博客,請務必保留此出處http://wangwei007.blog.51cto.com/68019/741093

相關文章
相關標籤/搜索