# pg_stats_reporter 1.0

1. What is pg_stats_reporter?
2. Summary
3. Install
   1. Requirement
   2. Install pg_stats_reporter
   3. Initial settings
   4. Install cheack
4. Usage
5. Uninstall
6. configuration
7. restrictions and cautions
8. FAQ
9. See also
10. Acknowledgement

## What is pg_stats_reporter?

Pg_stats_reporter can make statistical and graphical reports by pg_statsinfo's(2.4 or later) statistical database(we call it 'snapshot'). Example of report is here

## Summary

Pg_stats_reporter is web-based software and can make statistical and graphical reports by pg_statsinfo's snapshot which is statistic of PostgreSQL.

## Install

Please get install package of pg_stats_reporter.
If you want to install source package, please see the INSTALL.en file which is included in source package.

### Requirement

PostgreSQL
  version 8.3 or later
pg_statsinfo
  version 2.4 or later
PHP
  version 5.3.3(recommend) Later version is not tested.
OS
  RHEL 5.x, 6.x, CentOS 5.x, 6.x
web browser
  Firefox : 3.6.9, 16.0.2 Later and other version is not tested.
  Google Chrome : 23.0.1271.64 m
HTTP Server
  Apache HTTP Server : 2.2.15(recommend) Later and other version is not tested.
libraries (They are included in package of pg_stats_reporter.)
  - jQuery : 1.8.2
  - jQuery UI : 1.9.1
  - jquery-ui-timepicker-addon : 0.9.9
  - dygraphs JavaScript Visualization Library : 4d3672f
  - jqPlot : 1.0.4 r1121
  - tablesorter : 2.0.3
  - Superfish : 1.4.8
  - Smarty : 3.1.12
Resolutino
  1024x786(SXGA) or higher

### How to install pg_stats_reporter?

There are dependency packages in pg_stats_reporter. You should install them. Example of install method is under following.

    $ su
    # rpm -ivh httpd-2.2.15-15.el6_2.1.x86_64.rpm
    # rpm -ivh php-5.3.3-3.el6_2.8.x86_64.rpm
    # rpm -ivh php-common-5.3.3-3.el6_2.8.x86_64.rpm
    # rpm -ivh php-pgsql-5.3.3-3.el6_2.8.x86_64.rpm
    # rpm -ivh php-intl-5.3.3-3.el6_2.8.x86_64.rpm
    # rpm -ivh pg_stats_reporter-1.0.0-1.el6.noarch.rpm

### Initial Setting

#### How to set the configure file?

There is sample file in pg_stats_reporter package. Details of setting parameter is following.
You set configuration in sample file for your environment. Setting example is under following.

    # cd /var/www/pg_stats_reporter
    # vi pg_stats_reporter.ini
    ----- Set your repository database -----
    host = localhost
    port = 5432
    dbname = postgres
    username = postgres
    password =

In here, repository database is pg_statsinfo's database.

### Install check

Start HTTP server and browse pg_stats_reporter's web page from web browser(See Usage in this document.)

    # service httpd start

## Usage

Pg_stats_reporter is visual and graphical report software for pg_statsinfo's statistical snapshot database.
You prepare installing pg_statsinfo before you use pg_stats_reporter.

### create reports

You access pg_stats_reporter.php by web browser.
When you access your report which is created by pg_stats_reporter by web browser,It is an example of URL as follows.

    http://localhost/pg_stats_reporter/pg_stats_reporter.php

When first your access, pg_stats_reporter.php display report in default settings as follows.

- selected repository database: This item is head of configuration file.
- start of report term : 0 o'clock two days ago
- end of report term :time now

This example is pg_stats_reporter to "January 9th 10:52:21 of 2013" when executing it.

### Detail usage

Detail usage on display is under following.

#### report display

① : Button of create report
  This button can create report and select term. More details is "dialog of creating report and selecting term"
② : Menu of repository databases
  If you select a repository database in this menu, pg_stats_reporter displays management instances in this repository database.
③ : Menu of report instances
  If you select a instance in this menu, pg_stats_reporter displays graphical reports in the instance.
④ : Botton of reload pg_stats_reporter.ini
  If you push this button, pg_stats_reporter reload configuration file(pg_stats_reporter.ini) and create new report in latest setting.
⑤ : Menu of report items
  If you select a item, pg_stats_reporter displays selective item in the report.
⑥ : Button of display or not left-side menu
  If you push this button, left-side menu is displayed or not
⑦ : Help button
  Display explanation which is how to see this table or graph.

#### Dialog of creating report and selecting term

⑧ : Text box of begginnig date of report
  Input beginning date of report in this box. If you select this box, pop up a calender dialog.
⑨ : Text box of end date of report
  Input end date of report in this box. If you select this box, pop up a calender dialog.
⑩ : Button of create report
  Create report in your inputting report term
⑪ : Cancel button
  Cancel for creating report

## Uninstall

If you use rpm package, please command under following.
If you use source package, please see INSTALL.en for details.

    $ su
    # rpm -e pg_stats_reporter-1.0.0-1.el6.noarch

## Configuration

pg_stats_reporter.ini is setting file which is in database connections and report display settings. Configuration item is under following.
If you want to use multiple repository database, you set multi [repository database].
Please see here for setting details.

parameter | kind of parameter | default setting | example | description
--- | --- | --- | --- | ---
[repository database] | chararacter | not omission | [repository1] | Repository name at left-side menu in pg_stats_reporter.
host | host name or IP address | *1 | host = localhost | Host name or IP address of repostory database.
port | port number | *1 | port = 5432 | Port number of repository datanase cluster.
dbname | character | *1 | dbname = postgres | repository database name.Please set repository database in pg_statsinfo(Defalut repository database is 'postgres'.).
username | char | *1 | username = postgres | connect user for repository database. Plsese set user which has read permission in repository database.
password | char | no password | password = hogehoge | connect password for repository database. If you use .pgpass, do not set this parameter.
language | auto/ja/en | auto | language = ja | language in report.If you set auto, we use browser information for language setting.
report item settings (summary ? profiles) | true/false | true | summary = true | If you set true, this report item is created.

*1: If you do not set this parameter, please see PostgreSQL document.

## Caution and Restriction

- In some distribution, HTTP Server's document root home directory is /home/user. You should confirm that .pgpass is not visible from web browser and check file's parmission.

## FAQ

#### Q1. Pg_stats_reporter does not display in my web browser.

A1. You had better review setting which are firewall(iptables etc) and SE Linux.

#### Q2. error massage which is database conecction error is displayed in my browser. What should I do?

A2. You had better review under following.

- Setting of "database connection" in pg_stats_reporter.ini
- Connection setting in PostgreSQL (postgresql.conf, pg_hba.conf)

#### Q3. I use Internet Explorer browser. But I think that createing report and display may not correctly.

A3. Internext Explore is not recommended browser. We recommend Firefox.

## See also

pg_statsinfo

## Acknowledgements

Pg_stats_reporter use under following libraries. Thank you for developper of libraries

- jQuery : http://jquery.com/
- jQuery UI : http://jqueryui.com/
- jquery-ui-timepicker-addon : http://trentrichardson.com/examples/timepicker/
- dygraphs JavaScript Visualization Library : http://dygraphs.com/
- jqPlot : http://www.jqplot.com/
- tablesorter : http://tablesorter.ru/docs/
- Superfish : http://users.tpg.com.au/j_birch/plugins/superfish/
- Smarty : http://www.smarty.net/