zabbix是開源的分散式系統監控和網路監控方案,zabbix可以監控系統和網路的各種參數,並且提供各種報警的方式.zabbix主要包含zabbix server和zabbix agent兩部分,zabbix server可以通過zabbix agent,SNMP,ping,埠監控等方式收集遠程伺服器的系統和網路相關信息,zabbix agent可以運行在linux,Unix,bsd,Windows,hp-ux,solaris等等系統上負責收集系統和網路的相關信息.zabbix server可以主動輪詢每個zabbix agent收集信息,也可以被動收集從zabbix agent發送過來的相關信息.
zabbix的優勢主要有以下幾點:
1. 開源免費的
2. 安裝配置簡單,資料很詳細,而且支持中文
3. 監控方式很多,可以模塊化,可以自動發現新的伺服器和網路設備, 可以監控CPU,內存,磁碟,網路,埠,日誌,服務等等
4. 分散式的監控,集中式的管理
5. 報警方式多,email,簡訊等
6. 支持安全驗證
zabbix server 1.8.1環境搭建
所需軟體:Apache PHP MysqL
mso-bidi-font-family:宋體;mso-bidi-theme-font:minor-fareast;color:#BC5F5F">第一部
Mysql 是直接用yum安裝的,若想用源碼包裝請參考官方文檔
啟動MysqL
- #service mysqld start
mso-bidi-font-family:宋體;mso-bidi-theme-font:minor-fareast;color:#BC5F5F">第二部 font-family:"Verdana","sans-serif";mso-bidi-font-family:Arial;color:#BC5F5F">PHP的安裝配置
Step 1: 解壓文件
- # tar -zxvf php-5.2.13.tar.gz
Step 2: 編譯安裝
- #./configure --prefix=/usr/local/php5 --enable-mbstring --enable-bcmath --with-mysql --with-png-dir=/usr --with-gettext --with-png --with-zlib --with-xml --enable-calendar --with-apxs=/usr/local/httpd/bin/apxs
- ake ; make install
mso-bidi-font-family:宋體;mso-bidi-theme-font:minor-fareast;color:#BC5F5F">第三部 font-family:"Verdana","sans-serif";mso-bidi-font-family:Arial;color:#BC5F5F">Apache 安裝配置
Step 1: 解壓文件
- # tar -zxvf httpd-2.2.14.tar.gz
Step 2: 編譯安裝
- # ./configure --prefix=/usr/local/httpd --enable-module=so
- #make ; make install
Step 3: 編輯httpd.conf
- #vi /usr/local/httpd/conf/httpd.conf
- 加 AddType application/x-httpd-php .php .phtml .php4 .inc
- DirectoryIndex index.php .php index.html
Step 4:
- #vi /var/www/html/info.php
- <?php
- phpinfo();
- ?>
Step 5: 啟動Apache服務,且訪問info.php
- #/usr/local/httpd/bin/httpd –f /usr/local/httpd/conf/httpd.conf
- #ps –ef | grep httpd
#netstat –antup | grep 80
打開瀏覽器:http://IP/info.php,若看到php的信息則成功
mso-bidi-font-family:宋體;mso-bidi-theme-font:minor-fareast;color:#BC5F5F">第四部 font-family:"Verdana","sans-serif";mso-bidi-font-family:Arial;color:#BC5F5F">Zabbix server
Step 1: 創建
- # useradd -s /sbin/nologin zabbix
Step 2: 解壓zabbix文件
- # tar -zxvf zabbix-1.8.1.tar.gz
Step 3: 創建zabbix資料庫(以
- mysql> create database zabbix character set utf8;
- mysql>quit;
- # cd create/schema
- # cat mysql.sql | mysql –u root –p zabbix
- # cd ../data
- # cat data.sql | mysql –u root –p zabbix
- # cat images_mysql.sql | mysql –u root -p zabbix
Step 4: 編譯安裝
- # ./configure --enable-server --with-mysql --with-net-snmp --with-jabber --with-libcurl (若要同時啟用agent可以加上 --enable-agent)
- #make ; make install
Step 5: 編輯/etc/services
- #vi /etc/services
- zabbix-agent 10050/tcp #zabbix agent
- zabbix-agent 10050/ucp #zabbix agent
- zabbix-trapper 10051/tcp #zabbix trapper
- zabbix-trapper 10051/ucp #zabbix trapper
Step 6: 配置zabbix
編輯配置文件,將配置文件中的一些參數修改一下
- #mkdir /etc/zabbix
- # chown -R zabbix.zabbix /etc/zabbix/
- # cp misc/conf/zabbix_* /etc/zabbix/
啟動服務:
- # cp misc/init.d/fedora/zabbix_server /etc/init.d/ (注意不同系統)
- #cp misc/init.d/fedora/zabbix_agentd /etc/init.d/
- #mkdir /var/www/html/zabbix
- # cp -Rpf frontends/php/* /var/www/html/zabbix
- #chkconfig --add zabbix-server
- #chkconfig --add zabbix-agentd
- #chkconfig zabbix-server on
- #chkconfig zabbix-agentd on
- #/usr/local/zabbix/sbin/zabbix_server -c /etc/zabbix/zabbix_server.conf
- #/usr/local/zabbix/sbin/zabbix_agentd -c /etc/zabbix/zabbix_agentd.conf
Step 7: 登陸http://ip /zabbix 配置,看到如下界面
Next>>
Next>>
Next>>
Next>>
Next>>
Next>>
點擊下載zabbix.conf.php 文件,並將其保存在/var/www/html/zabbix/conf/ 下,完成後點擊retry,
Next>>
點擊finish
登陸zabbix,用戶名admin 密碼 zabbix
mso-bidi-font-family:宋體;mso-bidi-theme-font:minor-fareast;color:#BC5F5F">第五部 mso-ascii-font-family:Verdana;mso-fareast-font-family:宋體;mso-fareast-theme-font: minor-fareast;mso-hansi-font-family:Verdana;mso-bidi-font-family:Arial; color:#BC5F5F">安裝過程中的問題及解答
在安裝過程中主要的問題是集中在檢查先決條件,前面的apache 和php 以及 MysqL 的安裝整合沒什麼問題.
其中php memory limit ,post max size ,max execution time ,timezone等參數可以通過修改
而以下問題
關鍵是要修改/etc/php.ini 中extension_dir 該參數,該路徑應該包含所需的擴展模塊,我的是在/usr/lib/php/modules/
其他都已經OK,而且配置文件中mbstring.func_overload = 2 也設置正確,但是還不可以.原因是要安裝 php-mbstring.可以使用
第二次安裝筆記
- 安裝mysql
- groupadd mysql
- useradd -g mysql mysql
- tar -zxvf mysql-5.1.44.tar.gz
- cd mysql-5.1.44
- ./configure --prefix=/usr/local/mysql
- make
- make install
- mkdir /usr/local/mysql/etc
- cp /usr/local/src/mysql-5.1.44/support-files/my-medium.cnf /usr/local/mysql/etc/my.cnf
- chown –R root /usr/local/mysql
- chown –R mysql /usr/local/mysql/var
- /usr/local/mysql/bin/mysql_install_db --basedir=/usr/local/mysql/ --datadir=/usr/local/mysql/data --user=mysql
- /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf --user=mysql &
- 測試:
- /usr/local/mysql/bin/mysql -u root –p
- mysql> show databases;
- 安裝PHP
- tar -zxvf php-5.2.13.tar.gz
- cd php-5.2.13
- ./configure --prefix=/usr/local/php --with-config-file-path=/usr/local/php/etc --with-mysql=/usr/local/mysql/ --with-gd --enable-bcmath --enable-mbstring --with-xml --with-png-dir=/usr --enable-sockets --with-apxs2=/usr/local/httpd/bin/apxs --enable-maintainer-zts
- make
- make install
- 安裝apache
- ./configure --prefix=/usr/local/httpd --datadir=/usr/local/httpd/var/ --with-mpm=worker
- LoadModule php5_module modules/libphp5.so
- AddType application/x-httpd-php .php
- AddType application/x-httpd-php .php5
- AddType application/x-httpd-php-source .phps
- AddType application/x-httpd-php-source .php5s
- DirectoryIndex index.php DirectoryIndex index.php5
- cat mysql.sql | /usr/local/mysql/bin/mysql -u root -p Zabbix
- cat data.sql |/usr/local/mysql/bin/mysql -u root -p Zabbix
- cat images_mysql.sql |/usr/local/mysql/bin/mysql -u root -p Zabbix
- ./configure --prefix=/usr/local/zabbix --enable-server --enable-agent --with-mysql=/usr/local/mysql/bin/mysql_config --with-net-snmp --with-libcurl
- echo /usr/local/mysql/lib/mysql/ >>/etc/ld.so.conf
- ldconfig
- /usr/local/zabbix/sbin/zabbix_server -c /usr/local/zabbix/etc/zabbix_server.conf
- /usr/local/zabbix/sbin/zabbix_agentd -c /usr/local/zabbix/etc/zabbix_agentd.conf
- /usr/local/httpd/bin/httpd -f /usr/local/httpd/etc/httpd.conf
- /usr/local/mysql/bin/mysqld_safe --defaults-file=/usr/local/mysql/etc/my.cnf &
本文出自 「Waydee的博客」 博客,請務必保留此出處http://waydee.blog.51cto.com/4677242/853624
[火星人 ] Zabbix 1.8.1監控系統搭建已經有482次圍觀