|
2 | 2 |
|
3 | 3 | cd "$(dirname "${BASH_SOURCE[0]}")" |
4 | 4 |
|
5 | | -docker compose exec postgres psql -d pgwatch -v ON_ERROR_STOP=1 -c \ |
6 | | -"CREATE EXTENSION IF NOT EXISTS pg_stat_statements; |
7 | | -CREATE EXTENSION IF NOT EXISTS plpython3u; |
8 | | -CREATE FUNCTION get_load_average(OUT load_1min float, OUT load_5min float, OUT load_15min float) AS ' |
9 | | - from os import getloadavg |
10 | | - la = getloadavg() |
11 | | - return [la[0], la[1], la[2]]' |
12 | | -LANGUAGE plpython3u VOLATILE; |
13 | | -GRANT EXECUTE ON FUNCTION get_load_average() TO pgwatch; |
14 | | -GRANT EXECUTE ON FUNCTION pg_stat_file(text) TO pgwatch; |
15 | | -GRANT EXECUTE ON FUNCTION pg_stat_file(text, boolean) TO pgwatch; |
16 | | -INSERT INTO pgwatch.source (name, preset_config, connstr) |
17 | | - SELECT 'demo', 'exhaustive', 'postgresql://pgwatch:pgwatchadmin@postgres/pgwatch' |
| 5 | +export MSYS_NO_PATHCONV=1 |
| 6 | + |
| 7 | +# We want to pipe the output of the `pgwatch metric print-init` command to the `psql` command |
| 8 | +docker compose exec -T pgwatch /pgwatch/pgwatch metric print-init full | \ |
| 9 | +docker compose exec -T -i postgres psql -d pgwatch -v ON_ERROR_STOP=1 |
| 10 | + |
| 11 | +docker compose exec -T postgres psql -d pgwatch -v ON_ERROR_STOP=1 -c \ |
| 12 | +"INSERT INTO pgwatch.source (name, preset_config, connstr) |
| 13 | + SELECT 'demo', 'full', 'postgresql://pgwatch:pgwatchadmin@postgres/pgwatch' |
18 | 14 | WHERE NOT EXISTS (SELECT * FROM pgwatch.source WHERE name = 'demo')" |
0 commit comments