作業系統:CentOS 5.4
軟體版本:Zabbix 1.8.2 (stable)
// 安裝 RPMforge 套件庫
( http://wiki.centos.org/zh-tw/Additio...22e7ac9f42bf4d )
i386 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
x86_64 http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
# rpm -i rpmforge-release-0.5.1-1.el5.rf.i386.rpm # yum check-update
// 檢查必要的套件是否安裝
# rpm -q gcc mysql-devel curl-devel httpd php php-mysql php-bcmath php-gd net-snmp-devel fping e2fsprogs-devel zlib-devel libgssapi-devel krb5-devel openssl-devel libidn-devel iksemel iksemel-devel
// 安裝遺漏的套件
# yum install mysql-devel php-mysql php-bcmath php-gd net-snmp-devel fping libgssapi-devel iksemel iksemel-devel
// 啟動 MySQL
# service mysqld start # chkconfig mysqld on
// 下載 zabbix 安裝程式
下載位址:http://sourceforge.net/projects/zabbix/files/
# wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/1.8.2/zabbix-1.8.2.tar.gz/download # tar -xzf zabbix-1.8.2.tar.gz
// 新增資料庫
# mysql -u root -p mysql> create database zabbix character set utf8; mysql> quit; # cd create/schema # mysql -uroot -p zabbix < mysql.sql # cd ../data # mysql -uroot -p zabbix < data.sql # mysql -uroot -p zabbix < images_mysql.sql
// 編譯安裝 zabbix 主程式
# cd /tmp/zabbix-1.8.2/ # ./configure --prefix=/opt/zabbix --enable-server --enable-agent --with-mysql --with-net-snmp --with-jabber --with-libcurl # make install
// 設定服務名稱
編輯 /etc/services,為方便管理,插入的位置可依照 port 的順序為主。
zabbix-agent 10050/tcp #Zabbix Agent zabbix-agent 10050/udp #Zabbix Agent zabbix-trapper 10051/tcp #Zabbix Trapper zabbix-trapper 10051/udp #Zabbix Trapper
// 設定 zabbix
adduser -r -d /var/run/zabbix-server -s /sbin/nologin -c "Zabbix" zabbix mkdir -p /etc/zabbix/alert.d mkdir -p /var/log/zabbix-server mkdir -p /var/log/zabbix-agent mkdir -p /var/run/zabbix-server mkdir -p /var/run/zabbix-agent chown zabbix.zabbix /var/run/zabbix* chown zabbix.zabbix /var/log/zabbix* cp /tmp/zabbix-1.8.2/misc/conf/zabbix_server.conf /etc/zabbix cp /tmp/zabbix-1.8.2/misc/conf/zabbix_agentd.conf /etc/zabbix cp /tmp/zabbix-1.8.2/misc/init.d/redhat/8.0/zabbix_server /etc/init.d cp /tmp/zabbix-1.8.2/misc/init.d/redhat/8.0/zabbix_agentd /etc/init.d
// 設定檔 zabbix_server.conf , zabbix_agentd.conf
編輯 /etc/zabbix/zabbix_server.conf
LogFile=/var/log/zabbix-server/zabbix_server.log PidFile=/var/run/zabbix-server/zabbix_server.pid DBName=zabbix DBUser=root DBPassword=<DB Password> AlertScriptsPath=/etc/zabbix/alert.d/
編輯 /etc/zabbix/zabbix_agentd.conf
PidFile=/var/run/zabbix-agent/zabbix_agentd.pid LogFile=/var/log/zabbix-agent/zabbix_agentd.log EnableRemoteCommands=1 Server=127.0.0.1 Timeout=10
// 啟動檔 zabbix_server , zabbix_agentd
編輯 /etc/init.d/zabbix_server 及 /etc/init.d/zabbix_agentd
progdir="/opt/zabbix/sbin/"
// 啟動 zabbix_server 及 zabbix_agentd
chmod +x /etc/init.d/zabbix_server chmod +x /etc/init.d/zabbix_agentd chkconfig --add zabbix_server chkconfig --add zabbix_agentd chkconfig zabbix_server on chkconfig zabbix_agentd on service zabbix_server restart service zabbix_agentd restart
// 設定 Web
# mkdir /var/www/html/zabbix # cd /tmp/zabbix-1.8.2/frontends/php/ # cp -a ./* /var/www/html/zabbix # chown -R root:root /var/www/html/zabbix # cd /var/www/html/zabbix/conf # cp -a zabbix.conf.php.example zabbix.conf.php # vi zabbix.conf.php $DB["DATABASE"] = "zabbix"; $DB["USER"] = "<DB NAME>"; $DB["PASSWORD"] = "<DB PASS>"; # chmod 666 zabbix.conf.php # service httpd start # chkconfig httpd on
編輯 /etc/php.ini
memory_limit = 128M post_max_size = 8M max_execution_time = 300
//
Q: 設定都完成了,但網頁仍無法開啟?
A: 請關閉所有防火牆設定
# chkconfig iptables off # chkconfig ip6tables off # service iptables stop # service ip6tables stop # vi /etc/selinux/config SELINUX=disabled # setenforce 0
Q: