PostgreSQL open-source monitoring tool-Detailed installation and test of pgwatch

Source: Internet
Author: User

Detailed installation and testing of pgwatch

An error occurred during installation, but no documentation was found online. I decided to write a detailed installation document myself.

1. Download pgwatch. Here I use Version 1.0, as shown below:

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

2. decompress and open the README file to check the installation requirements. The installation here is not described in detail.

Tar-zxvf pgwatch-1.0.tar.gz

Vim README

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

Requirements:

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

 

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

 

-Apache (webserver) # Use apache as a web Server

-PHP 5 (scripting language) # php5

-Pgsql extension for PHP (see http://www.php.net/manual/en/book.pgsql.php) # postgresql php Client

-PostgreSQL 9 (to store the data we collect) # postgresql supports the lowest version of 9

-Dblink (contribution module for PostgreSQL 9) # Install dblink (not by default)

 

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

Older systems cannot be monitored, however, we will

Add support for future database releases.

 
 

3. First, put the folder you just decompressed in the apache directory. (The folder permission must be set)

4. Check whether the postgresql php client is installed. If not, use yum to install it directly:

Yum installphp-pgsql.i386 (I am a 32-bit student can use yum search to search, and then restart apache)

Check whether the script (php) is installed ):

// Connecting, selecting database

$ Dbconn = pg_connect ("host = 192.168.30.200 port = 5434 dbname = lengzijian user = s password = 123456 ")

Or die ('could not connect: '. pg_last_error ());

 

// Specify Ming 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 <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
  • Next Page

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.