標籤:blank target mysql
1. 安裝依賴包:
Yum –y install gcc gcc-c++ autoconf httpd php mysql mysql-server php-mysql httpd-manual mod_ssl mod_perl mod_auth_mysql php-gd php-xml php-mbstring php-ldap php-pear php-xmlrpc php-bcmath mysql-connector-odbc mysql-devel libdbi-dbd-mysql net-snmp-devel curl-devel unix-ODBC-devl OpenIPMI-devel java-devel
650) this.width=650;" title="clip_image002" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image002" src="http://s3.51cto.com/wyfs02/M01/6E/C5/wKiom1WGfJ3j5pdPAAAdvbX7CM8824.jpg" "244" height="30" />
2. 配置PHP所需環境
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下載安裝Zbbix-Server
wget http://sourceforge.net/projects/zabbix/files/ZABBIX%20Latest%20Stable/2.2.2/zabbix-2.2.2.tar.gz -P /root
增加zabbix使用者
groupadd zabbix
useradd –g zabbix –m zabbix
tar zxf zabbix-2.2.2-tar.gz –C /usr/src
cd /usr/src/zabbix-2.2.2
./configure --prefix=/usr/local/zabbix --sysconfir=/etc/zabbix –enable-server –enable-proxy –enable-agent –enable-ipv6 –with-mysql=/usr/bin/msyql_config –with-net-snmp –with-libcurl –with-openipmi –with-unixodbc –with-ldap –with-ssh2 –enable-java
650) this.width=650;" title="clip_image004" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image004" src="http://s3.51cto.com/wyfs02/M02/6E/C2/wKioL1WGflOgSoKCAAAZeqI11Fk916.jpg" "244" height="29" />
650) this.width=650;" title="clip_image005" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image005" src="http://s3.51cto.com/wyfs02/M00/6E/C2/wKioL1WGflOThsyvAAAfFrB_vd0930.jpg" "244" height="37" />
安裝yum install php-pecl-ssh2 libssh2-devel
650) this.width=650;" title="clip_image007" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image007" src="http://s3.51cto.com/wyfs02/M01/6E/C2/wKioL1WGflOgNhzxAAAUrZuudHM450.jpg" "244" height="26" />
安裝 :
yum install openldap openldap-devel
編譯安裝:
make && make install
3. 開戶資料庫
service mysqld start
chkconfig mysqld on
4. 建立zabbix 資料庫
mysql –u root
create database zabbix ;
grant all on zabbix.* to [email protected] identified by ‘zabbix’;
匯入zabbix-server的資料庫
650) this.width=650;" title="clip_image008" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image008" src="http://s3.51cto.com/wyfs02/M02/6E/C2/wKioL1WGflOiDRGSAAAUslETsbo059.jpg" "244" height="18" />
cd /usr/src/zabbix-2.2.2/database/mysql
mysql –u zabbix –p zabbix < schema.sql
注意:如果是安裝proxy,只匯入SCHEMA.SQL就好,無須匯入下面的SQL,否則proxy無法工作
mysql –u zabbix –p zabbix < images.sql
mysql –u zabbix –p zabbix < data.sql
或者在資料庫裡這樣匯入:source /usr/src/zabbix-2.2.2/database/mysql/schema.sql
5. 複製Service 啟動指令碼
650) this.width=650;" title="clip_image009" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image009" src="http://s3.51cto.com/wyfs02/M02/6E/C6/wKiom1WGfJ6j8iMUAAAgsQR1YsQ862.jpg" "244" height="37" />
cp /usr/src/zabbix-2.2.2/misc/init.d/fedora/core/zabbix_server /etc/init.d/
chmod +x /etc/init.d/zabbix_server
並修改/etc/init.d/zabbix_server
BASEDIR=/usr/local 改為:/usr/local/zabbix
6. 配置zabbix_server.conf
DBUser=zabbix
DBName=zabbix
DBPassword=zabbix
7. 複製網頁檔案到/var/www/html 下
650) this.width=650;" title="clip_image010" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image010" src="http://s3.51cto.com/wyfs02/M00/6E/C6/wKiom1WGfJ6gggFsAAAca3gEjtk193.jpg" "244" height="25" />
cp -r /usr/src/zabbix-2.2.2/frontends/php/ /var/www/html/zabbix
chown –R apache.apache /var/www/html/zabbix
8. 開啟zabbix服務
chkconfig zabbix_server on
service zabbix_server start
service httpd start
chkconfig httpd on
9. 訪問http://ip/zabbix
650) this.width=650;" title="clip_image012" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image012" src="http://s3.51cto.com/wyfs02/M02/6E/C6/wKiom1WGfJ6S5WH3AAAzwJeo0vc804.jpg" "244" height="127" />
點擊 next
650) this.width=650;" title="clip_image013" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image013" src="http://s3.51cto.com/wyfs02/M00/6E/C2/wKioL1WGflSzMow8AAASaTr378k272.jpg" "244" height="23" />
vim /etc/php.ini
搜尋date.timezone =
修改:date.timezone=Asia/Shanghai
650) this.width=650;" title="clip_image015" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image015" src="http://s3.51cto.com/wyfs02/M02/6E/C6/wKiom1WGfJ7zOccgAABK6d89uOk611.jpg" "244" height="153" />
測試連接:
650) this.width=650;" title="clip_image017" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image017" src="http://s3.51cto.com/wyfs02/M00/6E/C6/wKiom1WGfJ7jPX6-AAAN8goruwE066.jpg" "244" height="30" />
輸入名字:
650) this.width=650;" title="clip_image019" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image019" src="http://s3.51cto.com/wyfs02/M00/6E/C6/wKiom1WGfJ6z64SaAAAe1uuTwo0618.jpg" "244" height="84" />
OK,finish
650) this.width=650;" title="clip_image021" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image021" src="http://s3.51cto.com/wyfs02/M01/6E/C6/wKiom1WGfJ7QMM1qAAAtZTtlu18354.jpg" "244" height="120" />
登入:預設使用者名admin 密碼:zabbix
650) this.width=650;" title="clip_image023" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; margin: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image023" src="http://s3.51cto.com/wyfs02/M02/6E/C6/wKiom1WGfJ_DCEj7AAAzaF65VGs086.jpg" "244" height="111" />
650) this.width=650;" title="clip_image025" style="border-top: 0px; border-right: 0px; background-image: none; border-bottom: 0px; padding-top: 0px; padding-left: 0px; border-left: 0px; padding-right: 0px" border="0" alt="clip_image025" src="http://s3.51cto.com/wyfs02/M00/6E/C6/wKiom1WGfJ-zn--AAAA0hFaLkt0286.jpg" "244" height="109" />
到此,zabbix-server 安裝完成。
註:防火牆,selinux。
1. 可以直接關閉防火牆和selinux
service iptables stop
vim /etc/selinux/config SELINUX=disable
2或者設定策略
iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 22 –j ACCEPT
iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 80 –j ACCEPT
iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 10051 –j ACCEPT
iptables –A OUTPUT –m state –state NEW –m tcp –p tcp –dport 10050 –j ACCEPT
iptables –A INPUT –m state –state NEW –m tcp –p tcp –dport 10050 –j ACCEPT
Centos zabbix 編譯安裝