Created
December 2, 2021 17:30
-
-
Save miohtama/bb5bef5e4751dd2465b44b47d8d01e8f to your computer and use it in GitHub Desktop.
Bash script for pgmetrics + pgdash reporting loop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
# | |
# Monitor loop for TimescaleDB using pgdash | |
# - TimescaleDB runs in a Docker, exposed over TCP/IP socket 127.0.0.1:5555 | |
# - pgdash SaaS offering used https://pgdash.io | |
# - run the sample collection loop every 30 seconds | |
# | |
# | |
set -e | |
set -x | |
# read secrets | |
source ~/secrets.env | |
# Give postgresql password to pgmetrics | |
export PGPASSWORD=$POSTGRES_PASSWORD | |
SERVER_NAME=myserver | |
while true ; do | |
./pgmetrics_1.12.0_linux_amd64/pgmetrics -f json -h 127.0.0.1 -p 5555 -U postgres | \ | |
./pgdash_1.8.0_linux_amd64/pgdash -a $PGDASH_API_KEY report $SERVER_NAME | |
sleep 30 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment