監控 zabbix安裝篇
備注:本次安裝使用的是Ubuntu OS
-
首先安裝Apache、php、mysql,構建LAMP環境
sudo apt-get install apache2
安裝完成末尾,有如下信息:
- Starting web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
</pre> 根據網上查找的結論:沒有配置httpd.conf. 檢查apahe2.conf文件發現(sudo vim /etc/apache2/apache2.conf) 根本沒有httpad.conf的配置項,/etc/apache2/下也沒有httpd.conf的文件,所以只好如下這樣做:
1、在/etc/apache2/下新建httpd.conf文件,內容為:ServerName 127.0.0.1 2、修改/etc/apache2/apache2.conf文件在 IncludeOptional mods-enabled/
.conf后邊增加如下: # Include all the user configurations: Include /etc/apache2/httpd.conf</pre> </span> </li> -
</li><p> <span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;">sudo /etc/init.d/apache2 restart</span> </p>
-
</li><p> <span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;">sudo apt-get install php5</span> </p>
-
</li><p> <span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;">sudo apt-get install libapache2-mod-php5</span> </p>
-
</li><p> <span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;">sudo apt-get install mysql-server(設置密碼和重復密碼:root)</span> </p>
-
</li><p> <span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;">sudo apt-get install libapache2-mod-auth-mysql</span> </p>
-
</li><p> <span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;"><span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;">sudo apt-get install php5-mysql</span></span> </p>
-
</li><p> <span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;"><span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;"><span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;">sudo /etc/init.d/apache2 restart</span></span></span> </p>
-
</span></span><p> <span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;"><span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;"><span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;">sudo ls /etc/apache2/mods-enabled 看到<span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;">php5.conf 和 php5.load</span></span>說明OK<br />
</li></p>
-
<p> <span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;"><span style="line-height:18px;font-family:Consolas, "Courier New", Courier, mono, serif;font-size:12px;background-color:#ffffff;"><span style="line-height:26px;font-family:Arial;font-size:14px;background-color:#ffffff;">這里還需要配置下/etc/php5/apache2/php.ini</span> </span></span> </p>
;date.timezone ===>去掉注釋在=后添加 Asia/Shanghai
max_input_time =600
max_execution_time= 600
post_max_size =32M</pre> </li>
- Starting web server apache2
AH00558: apache2: Could not reliably determine the server's fully qualified domain name, using 127.0.1.1. Set the 'ServerName' directive globally to suppress this message
</pre> 根據網上查找的結論:沒有配置httpd.conf. 檢查apahe2.conf文件發現(sudo vim /etc/apache2/apache2.conf) 根本沒有httpad.conf的配置項,/etc/apache2/下也沒有httpd.conf的文件,所以只好如下這樣做:
-
sudo /etc/init.d/apache2 restart
</li> - ZABBIX安裝
-
sudo apt-get install zabbix-server-mysql
安裝過程很安靜,沒有出現網上說的會輸入2-3次數據庫的密碼, sudo /etc/init.d/zabbix-server start 會出現:
- zabbix_server is disabled in /etc/default/zabbix-server. 查看相關文件:sudo vim /etc/default/zabbix-server
如下一段
This is by default set to "no" because a MySQL database needs to be prepared
and configured before you can start the Zabbix server for the first time.
#
Instructions on how to set up the database can be found in
/usr/share/doc/zabbix-server-mysql/README.Debian
START=no
被設成no了,當然啟動不了,改成yes</pre> </strong></span> </li>
這還沒完呢,因為數據庫什么的沒有設置
查看相關文件:cat /usr/share/doc/zabbix-server-mysql/README.Debian可以看到相關信息: -> apt-get install mysql-server
Create a new database (let's call it "zabbix"):
-> mysql -p -e "create database zabbix character set utf8"
Create a MySQL user that has access rights to the database (please use another password than 'SECRETPASSWORD'):
-> mysql -p -e "grant all on zabbix.* to 'zabbix'@'localhost' identified by 'SECRETPASSWORD'"
Create the database schema:
-> zcat /usr/share/zabbix-server-mysql/{schema,images,data}.sql.gz \ | mysql -uzabbix -pSECRETPASSWORD zabbix
我們照著做就好(不過我加上了用戶名,因為我當前登錄賬戶不是root,如果是的話就不用加上): mysql -uroot -p -e "create database zabbix character set utf8" mysql -uroot -p -e "grant all on zabbix.* to 'zabbix'@'localhost' identified by 'zabbix'" zcat /usr/share/zabbix-server-mysql/{schema,images,data}.sql.gz \ | mysql -uzabbix -pzabbix zabbix(等待一小會)</pre> </li>
sudo /etc/init.d/zabbix-server start (成功!)
接著安裝zabbix網站
sudo apt-get install zabbix-frontend-php 又是安靜靜的裝完了,沒有讓輸入什么root之類,于是,手動拷貝到apache目錄下: sudo cp -r /usr/share/zabbix /var/www/html/zabbix 重啟zabbix sudo /etc/init.d/zabbix-server stop sudo /etc/init.d/zabbix-server start
</li>現在訪問,終于可以出現設置界面了: http://服務器地址或域名/zabbix
第三步:Port 3306,password,user 都是root
不過安裝到最后一步又出問題了,還算好,提供了下載,下載后ftp到服務器
下載之后把文件放到/etc/zabbix/目錄下,刷新頁面,OK
OK,終于可以了。登錄用戶名密碼admin/zabbix
最后,安裝zabbix客戶端
sudo apt-get install zabbix-agent
安裝客戶端后,若不是服務器本機,都需要修改zabbix配置文件/etc/zabbix/zabbix_agent.conf和/etc/zabbix/zabbix_sagentd.conf的一行 server=zabbix服務端地址或域名</strong></pre> </li>
可能遇到的問題
解決方法: 1.在頁面上設置“組態->主機”將主機設置為監控客戶端的機器hostname。 2./etc/zabbix/zabbix_agent.conf 中的hostname與1中設置的一致。
</li>最后,本帖子參考:http://blog.csdn.net/Yoara/article/details/41845473