Skip to content
Merged
Show file tree
Hide file tree
Changes from 10 commits
Commits
Show all changes
33 commits
Select commit Hold shift + click to select a range
364e750
add new pgwatch-helm-chart for k8s/openshift
Schmaetz Dec 3, 2024
9df2f8e
added option for using an existing database as metric store
Schmaetz Dec 3, 2024
90a7ebc
change default values
Schmaetz Dec 3, 2024
7c5595c
update Helm-Chart-Version
Schmaetz Dec 3, 2024
abd8207
added option for prometheus sink and allows to bring your own prom or…
Schmaetz Apr 4, 2025
ff998dd
replace cmd modifications by mounting launcher script
Schmaetz Apr 4, 2025
2e12348
added retention setting for pg sink
Schmaetz Apr 7, 2025
94cfec1
cleanup and change variable-name
Schmaetz Apr 7, 2025
00734cf
added prom retention for new prometheus
Schmaetz Apr 7, 2025
ce14f56
change default values
Schmaetz Apr 7, 2025
5ec3259
Update README.md
Schmaetz Apr 14, 2025
820b224
Create README.md
Schmaetz Apr 14, 2025
d92fcfc
Update README.md
Schmaetz Apr 14, 2025
b472a04
Update values.yaml
Schmaetz Apr 14, 2025
e54264a
Update prometheus-config.yaml
Schmaetz Apr 14, 2025
8da8309
Update grafana-deployment.yaml
Schmaetz Apr 14, 2025
cbcf502
Update README.md
Schmaetz Apr 14, 2025
cf52c36
Update values.yaml
Schmaetz Apr 14, 2025
d9ee500
Create alertmanager_deployment
Schmaetz Apr 14, 2025
958ca28
Create charts-folder
Schmaetz Apr 15, 2025
8ff62e9
Delete charts
Schmaetz Apr 15, 2025
a238476
Create index
Schmaetz Apr 15, 2025
f90c999
Update values.yaml
Schmaetz Apr 15, 2025
188e41a
Update grafana-deployment.yaml
Schmaetz Apr 15, 2025
deffb81
added chart repo & updates version
Schmaetz Apr 15, 2025
a2cacdf
remove unneeded file
Schmaetz Apr 15, 2025
0d5cd04
rename charts folder to docs for github-limitations
Schmaetz Apr 15, 2025
4f06741
added sslmode to values
Schmaetz Apr 17, 2025
e3f9488
add custom datasource if using existing pg db
Schmaetz Apr 17, 2025
3c1dd78
update datasource and basic values file
Schmaetz Apr 17, 2025
2b0c21f
update helm repo
Schmaetz Apr 17, 2025
38b4394
Updates for Readme
Schmaetz Apr 17, 2025
ef7c32f
Merge branch 'main' into pgwatch-3-helm-chart
Schmaetz Apr 17, 2025
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
helm/pgwatch/test_values.yaml
168 changes: 159 additions & 9 deletions helm/README.md
Original file line number Diff line number Diff line change
@@ -1,11 +1,161 @@
# Documentation
[![Documentation](https://img.shields.io/badge/Documentation-pgwat.ch-brightgreen)](https://pgwat.ch)
[![License: MIT](https://img.shields.io/badge/License-BSD_3-green.svg)](https://opensource.org/license/bsd-3-clause)
[![Go Build & Test](https://github.com/cybertec-postgresql/pgwatch/actions/workflows/build.yml/badge.svg)](https://github.com/cybertec-postgresql/pgwatch/actions/workflows/build.yml)
[![Coverage Status](https://coveralls.io/repos/github/cybertec-postgresql/pgwatch/badge.svg?branch=master&service=github)](https://coveralls.io/github/cybertec-postgresql/pgwatch?branch=master)


Key | Default value | Description
---|---|---
storage | influx | influx or postgres; Defines backend for storing data
postgres_storage.database | pgwatch2_metrics | in case if storage is set to postgres, defines database name
metrics_preset | |
metrics_preset.name | remotedba | name of the default metrics_preset
metrics_preset.description| Metrics used for monitoring of Remote-DBA Databases | Metrics preset description
metrics_preset.metrics | '{"kpi": 120, "wal": 60, "locks": 60, "db_size": 300, "archiver": 60, "backends": 60, "bgwriter": 60, "cpu_load": 60, "db_stats": 60, "settings": 7200, "wal_size": 300, "locks_mode": 60, "index_stats": 900, "replication": 120, "sproc_stats": 180, "table_stats": 300, "wal_receiver": 120, "change_events": 300, "table_io_stats": 600, "sequence_health": 3600, "replication_slots": 120}' | Metrics
# pgwatch v3-beta. Please test it as much as possible!
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should we rewrite readme? It still shows beta


This is the next generation of [pgwatch2](https://github.com/cybertec-postgresql/pgwatch2/).

## Quick Start

To fetch and run the latest **demo** Docker image, exposing
- Grafana on port 3000,
- the administrative web UI on port 8080,
- the internal configuration and metrics database on port 5432:

```shell
docker run -d --name pw3 -p 5432:5432 -p 3000:3000 -p 8080:8080 -e PW_TESTDB=true cybertecpostgresql/pgwatch-demo
```

After some minutes you could open the ["Database Overview"](http://127.0.0.1:3000/dashboard/db/db-overview) dashboard and start looking at metrics. For defining your own dashboards you need to log in Grafana as admin (`admin`/`pgwatchadmin`).

If you don't want to add the test database for monitoring, remove the `PW_TESTDB` parameter when launching the container.



## Development and production use

For production and long term installation `cybertecpostgresql/pgwatch` Docker image should be used.
For the fastest development and deployment experience the Docker compose files are provided:

```shell
git clone https://github.com/cybertec-postgresql/pgwatch.git && cd pgwatch

docker compose -f ./docker/docker-compose.yml up --detach
```
<pre>
✔ Network pgwatch_default Created
✔ Container pgwatch-postgres-1 Healthy
✔ Container pgwatch-pgwatch-1 Started
✔ Container pgwatch-grafana-1 Started
</pre>

These commands will build and start services listed in the compose file:
- configuration and metric database;
- pgwatch monitoring agent with WebUI;
- Grafana with dashboards.

## Monitor Database

After start, you could open the [monitoring dashboard](http://localhost:3000/) and start
looking at metrics.

To add a test database under monitoring, you can use [built-in WebUI](http://localhost:8080/). Or simply
execute from command line:
```shell
docker compose -f ./docker/docker-compose.yml up add-test-db --force-recreate
```
<pre>
[+] Running 2/0
✔ Container pgwatch-postgres-1 Running 0.0s
✔ Container pgwatch-add-test-db-1 Created 0.0s
Attaching to pgwatch-add-test-db-1
pgwatch-add-test-db-1 | BEGIN
...
pgwatch-add-test-db-1 | GRANT
pgwatch-add-test-db-1 | COMMENT
pgwatch-add-test-db-1 | INSERT 0 1
pgwatch-add-test-db-1 exited with code 0
</pre>

## Produce Workload

To emulate workload for added test database execute:
```shell
docker compose -f ./docker/docker-compose.yml up pgbench
```
<pre>
[+] Running 2/2
✔ Container pgwatch-postgres-1 Running 0.0s
✔ Container pgwatch-pgbench-1 Created 0.1s
Attaching to pgwatch-pgbench-1
pgwatch-pgbench-1 | dropping old tables...
pgwatch-pgbench-1 | NOTICE: table "pgbench_accounts" does not exist, skipping
pgwatch-pgbench-1 | NOTICE: table "pgbench_branches" does not exist, skipping
pgwatch-pgbench-1 | NOTICE: table "pgbench_history" does not exist, skipping
pgwatch-pgbench-1 | NOTICE: table "pgbench_tellers" does not exist, skipping
pgwatch-pgbench-1 | creating tables...
pgwatch-pgbench-1 | generating data (client-side)...
pgwatch-pgbench-1 | 100000 of 5000000 tuples (2%) done (elapsed 0.11 s, remaining 5.17 s)
pgwatch-pgbench-1 | 200000 of 5000000 tuples (4%) done (elapsed 0.25 s, remaining 6.06 s)
...
pgwatch-pgbench-1 | 5000000 of 5000000 tuples (100%) done (elapsed 16.28 s, remaining 0.00 s)
pgwatch-pgbench-1 | vacuuming...
pgwatch-pgbench-1 | creating primary keys...
pgwatch-pgbench-1 | done in 42.29 s (drop tables 0.03 s, create tables 0.04 s, client-side generate 18.23 s, vacuum 1.29 s, primary keys 22.70 s).
pgwatch-pgbench-1 | pgbench (15.4)
pgwatch-pgbench-1 | starting vacuum...
pgwatch-pgbench-1 | end.
pgwatch-pgbench-1 | progress: 5.0 s, 642.2 tps, lat 15.407 ms stddev 11.794, 0 failed
pgwatch-pgbench-1 | progress: 10.0 s, 509.6 tps, lat 19.541 ms stddev 9.493, 0 failed
...
pgwatch-pgbench-1 | progress: 185.0 s, 325.3 tps, lat 16.825 ms stddev 8.330, 0 failed
pgwatch-pgbench-1 |
pgwatch-pgbench-1 |
pgwatch-pgbench-1 | transaction type: builtin: TPC-B (sort of)
pgwatch-pgbench-1 | scaling factor: 50
pgwatch-pgbench-1 | query mode: simple
pgwatch-pgbench-1 | number of clients: 10
pgwatch-pgbench-1 | number of threads: 2
pgwatch-pgbench-1 | maximum number of tries: 1
pgwatch-pgbench-1 | number of transactions per client: 10000
pgwatch-pgbench-1 | number of transactions actually processed: 100000/100000
pgwatch-pgbench-1 | number of failed transactions: 0 (0.000%)
pgwatch-pgbench-1 | latency average = 18.152 ms
pgwatch-pgbench-1 | latency stddev = 13.732 ms
pgwatch-pgbench-1 | initial connection time = 25.085 ms
pgwatch-pgbench-1 | tps = 534.261013 (without initial connection time)
pgwatch-pgbench-1 | dropping old tables...
pgwatch-pgbench-1 | done in 0.45 s (drop tables 0.45 s).
pgwatch-pgbench-1 exited with code 0
</pre>

## Inspect database

> [!IMPORTANT]
pgAdmin uses port 80. If you want it to use another port, change it in `docker-compose.yml` file.

To look what is inside `pgwatch` database, you can spin up pgAdmin4:
```shell
docker compose -f ./docker/docker-compose.yml up --detach pgadmin
```
Go to `localhost` in your favorite browser and login as `admin@local.com`, password `admin`.
Server `pgwatch` should be already added in `Servers` group.

## Development

If you apply any changes to the source code and want to restart the agent, it's usually enough to run:

```shell
docker compose -f ./docker/docker-compose.yml up pgwatch --build --force-recreate --detach
```

The command above will rebuild the `pgwatch` agent from sources and relaunch the container.

## Logs

If you are running containers in detached mode, you still can follow the logs:
```shell
docker compose -f ./docker/docker-compose.yml logs --follow
```

Or you may check the log of a particular service:
```shell
docker compose -f ./docker/docker-compose.yml logs pgwatch --follow
```

# Contributing

Feedback, suggestions, problem reports, and pull requests are very much appreciated.
5 changes: 5 additions & 0 deletions helm/pgwatch/Chart.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
apiVersion: v1
appVersion: "3.0"
description: A Helm chart for pgwatch monitoring tools
name: pgwatch
version: 3.0.1
Loading