Skip to content

Commit

Permalink
Initial commit2
Browse files Browse the repository at this point in the history
  • Loading branch information
mmohali committed Dec 14, 2020
1 parent 27c6737 commit a91a9ce
Show file tree
Hide file tree
Showing 3 changed files with 62 additions and 17 deletions.
Binary file modified .DS_Store
Binary file not shown.
79 changes: 62 additions & 17 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,72 @@
# PG COLLECTOR
# PG Collector <img src="img/pg_collector_logo.png" align="right" alt="">

## Overview

PG COLLECTOR Tool/Script for [Postgresql](https://www.postgresql.org/) database, it gathers the important database and object information and presents it in a consolidated HTML file which provides a convenient way to view and navigate between different sections of the report, PG Collector will not create any objects in the Database.

## PG COLLECTOR report header
PG Collector for [Postgresql](https://www.postgresql.org/) is a sql script that gathers valuable database information and presents it in a consolidated HTML file which provides a convenient way to view and navigate between different sections of the report.

PG Collector is safe to run on production environments and does not create any database objects to produce the output.

With PG Collector an operator gains insights on various aspects of the database, such as:
* Database size
* Configuration parameters
* Installed extensions
* Vacuum & Statistics
* Unused Indexes & invalid indexes
* Users & Roles Info
* Toast Tables Mapping
* Database Scehmas
* Fragmentation (Bloat)
* Tablespaces Info
* Memory setting
* Tables and Indexes Size and info
* Transaction ID
* Vacuum & Statistics
* Replication slots
* public Schema info
* Unlogged Tables

and more, please check the example reports

## PG Collector report header
<img src="img/pg_collector_header_V2.6.png" alt="">

## Example of PG COLLECTOR report
[pg_collector v2.6](https://github.com/awslabs/pg-collector/blob/main/ample_reports/pg_collector_testdb-2020-10-16_021546.html )

## PG COLLECTOR report Name
PG COLLECTOR script will generate HTML file using the following naming convention pg_colletcor_[DB Name]-[timestamp].html.

## Example of PG Collector report

[pg_collector v2.6](http://pg-collector.s3-website-us-west-2.amazonaws.com/pg_collector_testdb-2020-10-16_021546.html)

[pg_collector v2.7](http://pg-collector.s3-website-us-west-2.amazonaws.com/pg_collector_postgres-2020-12-14_053537.html)

All Sample reportes in [sample report folder](https://github.com/awslabs/pg-collector/tree/main/sample_reports).


## PG Collector output

### Report name:
PG Collector script will generate HTML file using the following naming convention pg_colletcor_[DB Name]-[timestamp].html .

[DB Name] : is the database name that you are connected to.

```
example : pg_collector_testdb-2020-10-10_030920.html
Example : pg_collector_testdb-2020-10-10_030920.html
```
## PG COLLECTOR report location
PG COLLECTOR script will generate HTML file under [/tmp](https://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/tmp.html) directory.

## How to run PG COLLECTOR script ( pg_collector.sql )

### Report location:
PG Collector script will generate HTML file under [/tmp](https://tldp.org/LDP/Linux-Filesystem-Hierarchy/html/tmp.html) directory.



## How to run PG Collector script ( pg_collector.sql )

1- you need [psql](https://www.postgresql.org/docs/10/app-psql.html) to be able to connect to the postgresql DB and run the pg_collector.sql script

2- Download pg_collector.sql in your labtop or the host that want to access the database from

3- login to the database using psql
```
psql -h [hostname/RDS endpoint] -p [Port] -d [Database name ] -U [user name]
psql -h [hostname or RDS endpoint] -p [Port] -d [Database name ] -U [user name]
```
4- run the pg_collector.sql script

Expand Down Expand Up @@ -57,23 +94,31 @@ mohamed@mydevhost ~ %ls -lhrt /tmp/pg_colletcor_*
```
5- open the report using any internet browser



## Notes:
1- it is ok to see below errors while executing the pg_colletcor.sql script if you did not install pg_stat_statements extension

```
psql:pg_collector.sql:435: ERROR: relation "pg_stat_statements" does not exist
postgres=> \i pg_collector.sql
Output format is html.
Default footer is off.
psql:pg_collector.sql:481: ERROR: relation "pg_stat_statements" does not exist
LINE 10: from pg_stat_statements
^
psql:pg_collector.sql:449: ERROR: relation "pg_stat_statements" does not exist
psql:pg_collector.sql:495: ERROR: relation "pg_stat_statements" does not exist
LINE 10: from pg_stat_statements
^
psql:pg_collector.sql:463: ERROR: relation "pg_stat_statements" does not exist
psql:pg_collector.sql:509: ERROR: relation "pg_stat_statements" does not exist
LINE 10: from pg_stat_statements
^
psql:pg_collector.sql:477: ERROR: relation "pg_stat_statements" does not exist
psql:pg_collector.sql:523: ERROR: relation "pg_stat_statements" does not exist
LINE 10: from pg_stat_statements
^
postgres=> \q
```


# License

This library is licensed under the MIT-0 License. See the LICENSE file.
Binary file added img/pg_collector_logo.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.

0 comments on commit a91a9ce

Please sign in to comment.