在ubuntu 1404 64位部署zabbix 2210

WBOY
發布: 2016-07-30 13:29:53
原創
958 人瀏覽過

架構:
Nginx
php5
mysql


安裝依賴

<code><span>#apt</span><span>-get</span> install <span>-y</span> nginx php5<span>-fpm</span> php5<span>-gd</span> mysql<span>-server</span> php5<span>-mysql</span> libmysqld<span>-dev</span> libxml2<span>-dev</span> libsnmp<span>-dev</span> libcurl4<span>-openssl</span><span>-dev</span></code>
登入後複製
f5-f

下載並解壓縮pkg

<code><span>#/etc/php5/fpm/pool.d/www.conf</span><span>...</span>
> <span>33</span> ;listen = /var/run/php5-fpm.sock
> <span>34</span> listen = <span>9000</span><span>#service php5-fpm restart</span></code>
登入後複製

創建使用者account

<code><span>#cp /etc/nginx/sites-available/default{,.bak}</span><span>#vim /etc/nginx/sites-enabled/default</span><span>...</span><span>24</span><span>##      root /usr/share/nginx/html;</span><span>25</span>         root /var/www/html/zabbix;
 <span>26</span>         index index.php index.html index.htm;

<span>...</span><span>54</span>         location ~ \.php$ {
 <span>55</span>                 fastcgi_split_path_info ^(.+\.php)(/.+)$;
 <span>56</span><span>#       # NOTE: You should have "cgi.fix_pathinfo = 0;" in php.ini</span><span>57</span><span>#</span><span>58</span><span>#       # With php5-cgi alone:</span><span>59</span>                 fastcgi_pass <span>127.0</span><span>.0</span><span>.1</span>:<span>9000</span>;
 <span>60</span><span>#       # With php5-fpm:</span><span>61</span><span>#       fastcgi_pass unix:/var/run/php5-fpm.sock;</span><span>62</span>                 fastcgi_index index.php;
 <span>63</span>                 include fastcgi_params;
 <span>64</span>         }

<span>...</span><span>#nginx -t</span>
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful

<span>#service nginx reload</span></code>
登入後複製

建立Zabbix資料庫

對於Zabbix伺服器和代理守護程式以及Zabbix前端,需要一個資料庫。不需要運行 Zabbix 代理程式。

提供 SQL 腳本用於建立資料庫模式和插入資料集。 Zabbix代理資料庫只需要

schema,而Zabbix伺服器資料庫還需要schema之上的資料集。

例如:

config mysql


<code><span>#wget http://7mnldi.com1.z0.glb.clouddn.com/zabbix-2.2.10.tar.gz</span><span>#tar -xf zabbix-2.2.10.tar.gz</span></code>
登入後複製

建立了Zabbix資料庫,繼續編譯Zabbix的以下步驟。

配置來源當配置 Zabbix 伺服器或代理程式的來源時,必須指定要使用的資料庫類型。伺服器或代理程式一次只能編譯一種資料庫類型。

要查看所有支持的配置選項,請在提取的Zabbix 源目錄中運行:

<code><span>#groupadd zabbix</span><span>#useradd -g zabbix zabbix</span></code>
登入後複製

要配置Zabbix 服務器和代理的源,你可以運行類似的命令:

<code>shell> mysql -u<span><<span>username</span>></span> -p<span><<span>password</span>></span>
mysql> create database zabbix character set utf8 collate utf8_bin;
mysql> quit;
shell> mysql -u<span><<span>username</span>></span> -p<span><<span>password</span>></span> zabbix <span>< <span>database</span>/<span>mysql</span>/<span>schema.sql</span>
# <span>stop</span><span>here</span><span>if</span><span>you</span><span>are</span><span>creating</span><span>database</span><span>for</span><span>Zabbix</span><span>proxy</span><span>shell</span>></span> mysql -u<span><<span>username</span>></span> -p<span><<span>password</span>></span> zabbix <span>< <span>database</span>/<span>mysql</span>/<span>images.sql</span><span>shell</span>></span> mysql -u<span><<span>username</span>></span> -p<span><<span>password</span>></span> zabbix <span>< <span>database</span>/<span>mysql</span>/<span>data.sql</span></span></code>
登入後複製

注意:虛擬機監控需要– with-libxml2設定選項,從Zabbix 2.2.0開始支援。

要設定Zabbix伺服器的來源(使用PostgreSQL等),您可以執行:

<code><span>#./configure --help</span></code>
登入後複製
要設定Zabbix 代理程式的來源(使用SQLite 等),您可以執行:

<code><span>#</span><span>.</span><span>/configure</span><span>-</span><span>-</span><span>enable</span><span>-</span><span>server</span><span>-</span><span>-</span><span>enable</span><span>-</span><span>agent</span><span>-</span><span>-</span><span>with</span><span>-</span><span>mysql</span><span>-</span><span>-</span><span>enable</span><span>-</span><span>ipv6</span><span>-</span><span>-</span><span>with</span><span>-</span><span>net</span><span>-</span><span>snmp</span><span>-</span><span>-</span><span>with</span><span>-</span><span>libcurl</span><span>-</span><span>-</span><span>with</span><span>-</span><span>libxml2</span></code>
登入後複製

要設定Zabbix 代理程式的來源,您可以執行:
<code><span>#</span><span>.</span><span>/configure</span><span>-</span><span>-</span><span>enable</span><span>-</span><span>server</span><span>-</span><span>-</span><span>with</span><span>-</span><span>postgresql</span><span>-</span><span>-</span><span>with</span><span>-</span><span>net</span><span>-</span><span>snmp</span></code>
登入後複製

要設定Zabbix 代理程式的來源,您可以執行:

<code><span>#</span><span>.</span><span>/configure</span><span>-</span><span>-</span><span>prefix=/usr</span><span>-</span><span>-</span><span>enable</span><span>-</span><span>proxy</span><span>-</span><span>-</span><span>with</span><span>-</span><span>net</span><span>-</span><span>snmp</span><span>-</span><span>-</span><span>with</span><span>-</span><span>sqlite3</span><span>-</span><span>-</span><span>with</span><span>-</span><span>ssh2</span></code>
登入後複製

要設定Zabbix運行:

<code><span>#./configure --enable-agent</span></code>
登入後複製

製作並安裝所有內容

<code><span>#make install</span></code>
登入後複製

此步驟應以具有足夠權限的用戶身份運行(通常為“root”,或使用

sudo

)。 運行

make install

預設情況下將在 / 中安裝守護程式二進位檔案(zabbix_server、zabbix_agentd、zabbix_proxy)usr/local/sbin 和 /usr/local/bin 中的客戶端二進位檔案(zas)。

要指定與 /usr/local 不同的位置,請在上一步配置中使用
--prefix

鍵來源,例如--prefix=/home/zabbix。在這種情況下,守護程式二進位檔案將安裝在 /sbin 下,而公用程式將安裝在 /bin 下。手冊頁將安裝在 /share 下。

檢視與編輯設定檔

編輯 Zabbix
    agent
  • 設定檔 /usr/local/etc/zabbix_agentd.conf 您需要為每個安裝了 zabbix_agentd 的主機設定此檔案。
  • 您必須在檔案中指定 Zabbix 伺服器 IP 位址。來自其他主機的連線將被拒絕。

編輯Zabbix伺服器設定檔/usr/local/etc/zabbix_server.conf
    您必須指定資料庫名稱、使用者和密碼(如果使用的話)。

對於 SQLite,必須指定資料庫檔案的完整路徑;不需要資料庫使用者和密碼。

如果您的安裝規模較小(最多十個受監控的主機),則其餘參數將適合您的預設值。如果您想最大化 Zabbix 伺服器(或代理程式)的效能,您應該更改預設參數。更多詳情請參閱效能調優部分。

如果你安裝了Zabbix代理,編輯代理設定檔/usr/local/etc/zabbix_proxy.conf
  • 你必須指定伺服器IP位址和代理主機名稱(必須伺服器知道),以及資料庫名稱、使用者和密碼(如果使用的話)

對於SQLite,必須指定資料庫檔案的完整路徑;不需要DB使用者和密碼。

啟動守護程式

在伺服器端執行zabbix_server。

<code><span>#zabbix_server</span></code>
登入後複製

確保你的系統允許分配36MB(或更多)的共享內存,否則伺服器可能無法啟動,並且您將看到“無法為 分配共享內存”。在伺服器日誌檔案中。這可能會發生在 FreeBSD、Solaris 8 上。
請參閱本頁底部的「另請參閱」部分,以了解如何配置共享記憶體。


在所有受監控的機器上運行 zabbix_agentd。
<code><span>#zabbix_agentd</span></code>
登入後複製

確保您的系統允許分配 2MB 共享內存,否則代理可能無法啟動,並且您將看到“無法為收集器分配共享內存”。在代理日誌檔中。這可能會發生在 Solaris 8 上。

如果您安裝了 Zabbix proxy,請執行 zabbix_proxy。
<code><span>#zabbix_proxy</span></code>
登入後複製

安裝 Zabbix Web 介面

複製 PHP 檔案

Zabbix 前端是用 PHP 編寫的,因此運行它需要一個支援 PHP 的網頁伺服器。只需將 PHP 檔案從 frontends/php 複製到網頁伺服器 HTML 文件目錄即可完成安裝。

<code><span>#mkdir /var/www/html/zabbix</span><span>#cd frontends/php</span><span># cp -a . /var/www/html/zabbix</span></code>
登入後複製

安裝前端

Step 1
In your browser, open Zabbix URL: http://<server_ip_or_name></span>
You should see the first screen of the frontend installation wizard.

Step 2
Make sure that all software prerequisites are met.

<code>
    Current <span>value</span>   Required
PHP <span>version</span><span>5.5</span><span>.9</span>-<span>1</span>ubuntu4<span>.12</span><span>5.3</span><span>.0</span>   OK
PHP option memory_limit <span>128</span>M    <span>128</span>M    OK
PHP option post_max_size        <span>8</span>M  <span>16</span>M Fail
PHP option upload_max_filesize  <span>2</span>M  <span>2</span>M  OK
PHP option max_execution_time   <span>30</span><span>300</span> Fail
PHP option max_input_time       <span>60</span><span>300</span> Fail
PHP <span>time</span> zone                   unknown     Fail
PHP databases support           MySQL   OK
PHP bcmath                      <span><span>on</span><span>OK</span></span>
PHP mbstring                    <span><span>on</span><span>OK</span></span>
PHP sockets                     <span><span>on</span><span>OK</span></span>
PHP gd                          <span>2.1</span><span>.1</span><span>2.0</span> OK
PHP gd PNG support              <span><span>on</span><span>OK</span></span>
PHP gd JPEG support             <span><span>on</span><span>OK</span></span>
PHP gd FreeType support         <span><span>on</span><span>OK</span></span>
PHP libxml                      <span>2.9</span><span>.1</span><span>2.6</span><span>.15</span>  OK
PHP xmlwriter                   <span><span>on</span><span>OK</span></span>
PHP xmlreader                   <span><span>on</span><span>OK</span></span>
PHP ctype                       <span><span>on</span><span>OK</span></span>
PHP session                     <span><span>on</span><span>OK</span></span>
PHP session auto start          off off OK
PHP gettext                     <span><span>on</span><span>OK</span></span></code>
登入後複製

Resolve:

<code><span>#vim /etc/php5/fpm/php.ini</span><span>...</span><span>385</span><span>#max_execution_time = 30</span><span>386</span> max_execution_time = <span>300</span><span>396</span><span>#max_input_time = 60</span><span>397</span> max_input_time = <span>300</span><span>675</span><span>#post_max_size = 8M</span><span>676</span> post_max_size = 32M

 <span>883</span> date.timezone =<span>'Asia/Shanghai'</span></code>
登入後複製

make sure like this:

<code>
    Current <span>value</span>   Required
PHP <span>version</span><span>5.5</span><span>.9</span>-<span>1</span>ubuntu4<span>.12</span><span>5.3</span><span>.0</span>   OK
PHP option memory_limit <span>128</span>M    <span>128</span>M    OK
PHP option post_max_size        <span>32</span>M <span>16</span>M OK
PHP option upload_max_filesize  <span>2</span>M  <span>2</span>M  OK
PHP option max_execution_time   <span>300</span><span>300</span> OK
PHP option max_input_time       <span>300</span><span>300</span> OK
PHP <span>time</span> zone                   Asia/Shanghai   OK
PHP databases support           MySQL   OK
PHP bcmath                      <span><span>on</span><span>OK</span></span>
PHP mbstring                    <span><span>on</span><span>OK</span></span>
PHP sockets                     <span><span>on</span><span>OK</span></span>
PHP gd                          <span>2.1</span><span>.1</span><span>2.0</span> OK
PHP gd PNG support              <span><span>on</span><span>OK</span></span>
PHP gd JPEG support             <span><span>on</span><span>OK</span></span>
PHP gd FreeType support         <span><span>on</span><span>OK</span></span>
PHP libxml                      <span>2.9</span><span>.1</span><span>2.6</span><span>.15</span>  OK
PHP xmlwriter                   <span><span>on</span><span>OK</span></span>
PHP xmlreader                   <span><span>on</span><span>OK</span></span>
PHP ctype                       <span><span>on</span><span>OK</span></span>
PHP session                     <span><span>on</span><span>OK</span></span>
PHP session auto start          off off OK
PHP gettext                     <span><span>on</span><span>OK</span></span></code>
登入後複製

Step 3
Enter details for connecting to the database. Zabbix database must already be created.

Step 4
Enter Zabbix server details.

Step 5
Review a summary of settings.

Step 6
Download the configuration file and place it under conf/.

Step 7
Finish the installation.

Step 8
Zabbix frontend is ready! The default user name is Admin, password zabbix.

ISSUES

missing libmysqld-dev

<code><span>#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2</span><span>...</span>checking <span>for</span> mysql_config... no
configure: error: MySQL <span>library</span> not found</code>
登入後複製

Resolve:

<code><span>#apt</span><span>-get</span> install <span>-y</span> libmysqld<span>-dev</span></code>
登入後複製

missing libxml2-dev

<code><span>#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2</span><span>...</span>checking <span>for</span> xml2-config... no
configure: error: LIBXML2 <span>library</span> not found</code>
登入後複製

Resolve:

<code><span>#apt</span><span>-get</span> install <span>-y</span> libxml2<span>-dev</span></code>
登入後複製

missing libsnmp-dev

<code><span>#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2</span><span>...</span>
checking <span>for</span> net-snmp-config... no
configure: error: Invalid Net-SNMP directory - unable to find net-snmp-config</code>
登入後複製

Resolve:

<code><span>#apt</span><span>-get</span> install libsnmp<span>-dev</span></code>
登入後複製

missing libcurl4-openssl-dev

<code><span>#./configure --enable-server --enable-agent --with-mysql --enable-ipv6 --with-net-snmp --with-libcurl --with-libxml2</span><span>...</span>checking <span>for</span> curl-config... no
configure: error: Curl <span>library</span> not found
</code>
登入後複製

Resolve:

<code><span>#apt</span><span>-get</span> install <span>-y</span> libcurl4<span>-openssl</span><span>-dev</span></code>
登入後複製

On the dashboard of zabbix, it’s display:

<code>"Zabbix server <span>is</span><span>not</span> running: the information displayed may <span>not</span><span>be</span> current."</code>
登入後複製

Resolve:

<code><span>#vim /var/www/html/zabbix/conf/zabbix.conf.php</span><span>$ZBX_SERVER</span>      = <span>'localhost'</span>;
> <span>$ZBX_SERVER</span>      = <span>'192.168.22.122'</span>; <span>#your ip address</span><span>#</span></code>
登入後複製

版权声明:本文为博主原创文章,未经博主允许不得转载。

以上就介绍了deploy zabbix 2210 on ubuntu 1404 64bit,包括了方面的内容,希望对PHP教程有兴趣的朋友有所帮助。

相關標籤:
來源:php.cn
本網站聲明
本文內容由網友自願投稿,版權歸原作者所有。本站不承擔相應的法律責任。如發現涉嫌抄襲或侵權的內容,請聯絡admin@php.cn
熱門教學
更多>
最新下載
更多>
網站特效
網站源碼
網站素材
前端模板