PostgreSQL開源監控工具——pgwatch詳細安裝和測試

來源:互聯網
上載者:User

pgwatch詳細安裝和測試

安裝時一直出錯,但是網上又搜不到任何文檔決定自己寫一篇詳細的安裝文檔。

1.下載pgwatch,我這裡我用的版本是1.0,如下:

wget http://www.cybertec.at/download/pgwatch/pgwatch-1.0.tar.gz

2.解壓並開啟README檔案,查看安裝所需,這裡的安裝就不詳細講解

tar -zxvf pgwatch-1.0.tar.gz

vim README

------------------------------------------------------------

Requirements:

-------------

 

You will need a handful of components to make this work:

 

        - Apache (webserver)                                                    # apache用作web伺服器

        - PHP 5  (scripting language)                                              # php5版本

        - pgsql extension for PHP (see http://www.php.net/manual/en/book.pgsql.php)      # postgresql的php用戶端

        - PostgreSQL 9 (to store the data we collect)                                  # postgresql支援最低版本為9

        - dblink (contribution module for PostgreSQL 9)                                # 需要安裝dblink(並非預設安裝)

 

        - For now we only support PostgreSQL >= 9.0 databases.

          Older systems cannot be monitored, however, we will

          add support for future database releases.

 
 

3.首先把你剛剛解壓的檔案夾,放在apache的目錄下。(這裡要注意的是要設定好檔案夾的許可權)

4.檢測是否安裝postgresql的php用戶端,如果沒有可以直接用yum安裝:

yum installphp-pgsql.i386(我的是32位,同學們可以自己用yum search搜尋下,之後重啟apache)

檢測是否安裝指令碼(php):

// Connecting, selecting database

$dbconn = pg_connect("host=192.168.30.200 port=5434 dbname=lengzijian user=postgres password=123456")

    or die('Could not connect: ' . pg_last_error());

 

// Performing SQL query

$query = 'SELECT * FROM t_user limit 10';

$result = pg_query($query) or die('Query failed: ' . pg_last_error());

 

// Printing results in HTML

echo "<table>\n";

while ($line = pg_fetch_array($result, null, PGSQL_ASSOC)) {

    echo "\t<tr>\n";

    foreach ($line as $col_value) {

        echo "\t\t<td>$col_value</td>\n";

    }

    echo "\t</tr>\n";

}

echo "</table>\n";

 

// Free resultset

pg_free_result($result);

 

// Closing connection

pg_close($dbconn);

?>

  • 1
  • 2
  • 下一頁

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.