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
Pg_stats_reporter is web-based software and can make statistical and graphical reports by pg_statsinfo's snapshot which is statistic of PostgreSQL.
We can create reports in two ways which are under following.
This method can easy to create reports on Web browser, program executes on Apache HTTP Server.
If you access web server by Web browser, you can create reports by GUI on your Web browser window.
This method can create reports on command-line.
This method doesn't need Apache HTTP Server. If you cannot use Apache HTTP Server or would like to create reports by crond in specific period, you had better select this method.
Please download install package of pg_stats_reporter.
If you would like to install by source package, please read the INSTALL.en file which is included in source package.
Install rpm packages which has dependency by yum or rpm command. Install command example is under following.
$ su
/* Example of install command by yum. */
# yum install httpd php php-pgsql php-intl php-cli
/* Example of install command by rpm. */
# rpm -ivh httpd-2.2.15-15.el6_2.1.x86_64.rpm \
php-common-5.3.3-3.el6_2.8.x86_64.rpm \
php-5.3.3-3.el6_2.8.x86_64.rpm \
php-pdo-5.3.3-22.el6.x86_64.rpm \
php-pgsql-5.3.3-3.el6_2.8.x86_64.rpm \
php-intl-5.3.3-3.el6_2.8.x86_64.rpm \
php-cli-5.3.3-22.el6.x86_64.rpm
[caution1] php-intl rpm file is included under following directory in OS install disk 2.
Packages/php-intl-5.3.3-22.el6.x86_64.rpm
[caution2] It can work without php-intl rpm file. However, it doesn't work feature of auto language detection.
Install pg_stats_reporter by rpm command. Install example is under following.
# rpm -ivh pg_stats_reporter-2.0.0-1.el6.noarch.rpm
Under following install example, it only uses feature of createing reports by command-line.
$ su
/* Example of install command by yum. */
# yum install php-pgsql php-intl php-cli
/* Example of install command by rpm. */
# rpm -ivh php-common-5.3.3-3.el6_2.8.x86_64.rpm \
php-pdo-5.3.3-22.el6.x86_64.rpm \
php-pgsql-5.3.3-3.el6_2.8.x86_64.rpm \
php-intl-5.3.3-3.el6_2.8.x86_64.rpm \
php-cli-5.3.3-22.el6.x86_64.rpm
[caution1] php-intl rpm file is included under following directory in OS install disk 2.
Packages/php-intl-5.3.3-22.el6.x86_64.rpm
[caution2] It can work without php-intl rpm file. However, it doesn't work feature of auto language detection.
Install pg_stats_reporter by rpm command. Install example is under following.
# rpm -ivh --nodeps pg_stats_reporter-2.0.0-1.el6.noarch.rpm
Edit configuration file for connecting repository database. Configuration method is here.
And sample of configuration is here.
If you would like to use Web reporting feature, start HTTP Server.
# service httpd start
Check Usage of creating reports by Web browser and access HTTP server by your web browser. If you see report window of pg_stats_reporter, install is collectly finished.
Check Usage of creating reports by command-line and show snapshot list on conmmad-line. If you see snapshot list, instakk is collectly finished.
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.
You access pg_stats_reporter.php by web browser.
When you access your report which is created by pg_stats_reporter by web browser, example of reports URL is under following.
http://<hostname>/pg_stats_reporter/pg_stats_reporter.php
If you access above URL, you can see a pg_statsinfo's GUI.
Detail usage on window is under following.
$ pg_stats_reporter [-R DBNAME] [-i INSTANCEID] [-a] [-O DIRECTORY] [-b SNAPID] [-e SNAPID] [-B DATE] [-E DATE]
Example of command is under following.
This sample of command shows creating report which is created from snapshot which is in repository database named sample, and it is default report setting.
When you create reports, HTML reports and directories which are JavaScript libraries and CSS files are created in report output directory.
$ pg_stats_reporter -R sample
*1: Can not set snapshot id and date in a same.
*2: If you ommit period of snapshot, default setting sets from 0:00 a.m. of the day before to the present.
$ pg_stats_reporter -l [-R DBNAME] [-i INSTANCEID]
Sample command is under following.
Under following command example shows list of snapshots stored in sample database in the repository database.
$ pg_stats_reporter -l -R sample
$ pg_stats_reporter -L [-R DBNAME]
Sample command is under following.
Under following command sample shows list of monitored instances submitted in "sample" database in repository database.
$ pg_stats_reporter -L -R sample
$ pg_stats_reporter -s [-R DBNAME]
Sample command is under following. The command example shows snapshots size in "sample" database stored in repository database.
$ pg_stats_reporter -s -R sample
$ pg_stats_reporter --index [-O DIRECTORY]
Sample command is under following. In this sample command, create an index of report in /var/report directory.
$ pg_stats_reporter --index -O /var/report
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-2.0.0-1.el6.noarch
Configuration file of pg_stats_reporter is "pg_stats_reporter.ini" in /etc directory.
Configuration file is composed mainly two sections which are global setting and repository database setting.
Global setting is "[global_setting]" of section name.
If you install pg_stats_reporter from rpm package, you don't need to set global setting
If you install it only from source, set global setting. More detail is written in INSTALL.ja which is included source package.
Please set one setting section by one repository database server; Global settig section is repository database setting section.
The section name in repository database setting is be repository database name.
Configuration of repository database is under following.
Sample configuration is here
| parameter | kind of parameter | Not set parameter | Default setting | example | description |
|---|---|---|---|---|---|
| [repository database] | character | not omission | not omission | [repository1] | Repository name at left-side menu in pg_stats_reporter. |
| host | host name or IP address | (*1) | NULL | host = localhost | Host name or IP address of repository database. |
| port | port number | (*1) | NULL | port = 5432 | Port number of repository database cluster. |
| dbname | character | (*1) | (*1) | dbname = postgres | repository database name.Please set repository database in pg_statsinfo(Defalut repository database is 'postgres'.). |
| username | char | (*1) | (*1) | username = postgres | connect user for repository database. Please set user which has read permission in repository database. |
| password | char | no password | no password | password = hogehoge | connect password for repository database. If you use .pgpass, do not set this parameter. |
| language | auto/ja/en | auto | en | language = ja | language in reports. If you set auto, we use browser information for language setting. (*2) |
| report item settings (summary ~ profiles) |
true/false | true | false | summary = true | If you set true, this report item is created. |
(*1): If you do not set this parameter, please see PostgreSQL document.
(*2): If it didn't install php-intl package, it will show messages in English.
pg_stats_reporter has cautions and restrictions under following. Please read it before you use.
Change points from pg_stats_reporter 1.0 is under following.
Pg_stats_reporter use under following libraries. Thank you for developper of libraries