[Zabbix] Install Zabbix on CentOS 6.3

Zabbix Server 需求套件
=========================================================
#yum install zlib-devel.*
#yum install openssl-devel.*
#yum install libxml2-devel.*
#yum install curl curl-devel net-snmp net-snmp-devel
#yum install flex
#yum install bison gcc automake autoconf snmp rrdtool
#yum install php-gd php-mysql php-pear phpMyAdmin mysql-server mysql mysql-devel php
#yum install php-bcmath php-mbstring php-xml

***
1. 用 vi /etc/httpd/conf/httpd.conf 設定Apache中的語系為:( (記得restart)
         AddDefaultCharset UTF-8

2. 用 vi /etc/php.ini 設定php中的語系為:( (記得restart)
         default_charset = "utf-8"

3. 用 vi /etc/my.cnf 設定MySQL中的語系為:( (記得restart)
      [mysqld]
         init_connect='SET NAMES utf8'
         default-character-set=utf8
      [client]
         default-character-set = utf8

安裝 Zabbix Server
=========================================================
取得 Zabbix 原始碼: http://www.zabbix.com/download.php
# tar zxf zabbix-2.0.5.tar.gz -C /usr/local/src
# cd /usr/local/src/zabbix-2.0.5
# ./configure --prefix=/opt/zabbix-2.0.5 --enable-server --enable-agent \
   --with-mysql --with-libcurl --with-net-snmp
# make install
# mysql -u root -p -A mysql
mysql> CREATE DATABASE `zabbix` DEFAULT CHARACTER SET utf8 COLLATE utf8_unicode_ci;
mysql> grant all privileges on zabbix.* to zabbix@localhost identified by 'zabbix';
mysql> quit
# cd /usr/local/src/zabbix-2.0.5/database/mysql
# mysql -u root -p -A zabbix < schema.sql
# mysql -u root -p -A zabbix < images.sql
# mysql -u root -p -A zabbix < data.sql
# cd /opt
# ln -s zabbix-2.0.5 zabbix
# vi /opt/zabbix/etc/zabbix_server.conf
DBName=zabbix
DBUser=zabbix
DBPassword=zabbix
# groupadd zabbix
# useradd -g zabbix -s /sbin/nologin -M zabbix
啟動 Zabbix Server 與 Zabbix Agent Daemon
# /opt/zabbix/sbin/zabbix_server
# /opt/zabbix/sbin/zabbix_agentd
開機自動啟動
# echo "/opt/zabbix/sbin/zabbix_server" >> /etc/rc.d/rc.local
# echo "/opt/zabbix/sbin/zabbix_agentd" >> /etc/rc.d/rc.local
在 Zabbix Server 安裝 Web 介面
# cp -r /usr/local/src/zabbix-2.0.5/frontends/php/. /var/www/zabbix/
# chown apache:apache /var/www/zabbix/conf
# vi /etc/php.ini
date.timezone = "Asia/Taipei"
post_max_size = 16M
max_execution_time = 300
max_input_time = 300
memory_limit = 128M
# vi /etc/httpd/conf.d/zabbix.conf
Alias /zabbix /var/www/zabbix

    AllowOverride Limit
    Order allow,deny
    Allow from 192.168.

# service httpd restart

Zabbix Agent @ Linux 安裝步驟
=========================================================
# ./configure --prefix=/opt/zabbix-2.0.1 --enable-agent
# make install
# cd /opt
# ln -s zabbix-2.0.1 zabbix
# vi /opt/zabbix/etc/zabbix_agentd.conf
Server=zabbix.server.name.or.ip
Hostname=my.host.name
# groupadd zabbix
# useradd -g zabbix -s /sbin/nologin -M zabbix
# /opt/zabbix/sbin/zabbix_agentd
# echo "/opt/zabbix/sbin/zabbix_agentd" >> /etc/rc.d/rc.local

Zabbix Agent @ Windows 安裝步驟
=========================================================
1. 取得 Zabbix Agent for Windows: http://www.zabbix.com/download.php
2. 將 win32 (32位元) 或 win64 (64位元) 裡的檔案解壓縮到 C:\zabbix
3. 以 Administrator 身份執行 cmd
4. 產生 zabbix_agentd.conf 設定檔
> echo Server=zabbix.server.name.or.ip > c:\zabbix\zabbix_agentd.conf
5. 註冊 Zabbix Agent 服務
> c:\zabbix\zabbix_agentd.exe --config c:\zabbix\zabbix_agentd.conf --install
6. 啟動 Zabbix Agent 服務
> net start "Zabbix Agent"
7. 開機自動啟動 Zabbix Agent 服務 (注意空格)
> sc config "Zabbix Agent" start= auto
註: 如果沒有出現防火牆開放提示, 必須到控制台手動操作防火牆設定, 允許 C:\zabbix\zabbix_agentd.exe 通過防火牆, 或開放 TCP 10050 port