Getting Started
Last updated
Last updated
View a quick screencast at https://asciinema.org/a/190659 to get an overview of the steps detailed below to get pgDash setup:
pgmetrics is the open-source collection agent for pgDash. This is available as a single, zero-dependency, statically-linked binary executable that you can copy to your $PATH
. You can download this from GitHub here, or see other install options here. Once downloaded, try invoking it and seeing a report for your database:
The command-line syntax is almost exactly the same as for psql
and other utilities. Environment variables (like PGHOST
, PGPORT
, PGSSLMODE
, PGPASSFILE
etc) and files like ~/.pgpass
, ~/.postgresql/postgresql.crt
are also understood by pgmetrics.
You should see an output similar to this:
The pgmetrics binary is also available for Windows and macOS.
The command-line tool for uploading reports to the pgDash website is also available from GitHub here. This too is a single binary that can be placed anywhere.
Once you signup for pgDash, you can copy the API key from your profile page.
The pgdash report
command will upload the report in JSON format, piped to it from pgmetrics into https://app.pgdash.io/. “myserver1” is a friendly name to identify your database server -- we recommend the hostname of the server you're connecting to.
For this to work successfully, pgmetrics should be able to complete without asking for a password (this step is meant to be automated and run as a cron job). You can use the usual techniques (.pgpass file, client certificates, trust/peer authentication in pg_hba.conf), or even supply the password using the environment variable PGPASSWORD (although this is not recommended):
Tips:
If the command appears to hang, it's probably waiting for you enter the password.
If you get a 429 error, it means you've hit a rate limit. Wait for 60 seconds before trying again.
You should now be able to see the report in pgDash after logging in.
You can repeat this command say, every 10 minutes or so, and see the timeseries graphs populating under “myserver1”.
Learn more about automating this operation.