Documentation

PostgreSQL Checks

About PostgreSQL Checks

The PostgreSQL check allows you to monitor PostgreSQL database services. You can verify that the database server is accepting connections, or optionally to login and run a query, and verify that the query results match or are within user-defined limits. The check works with or without SSL and certificate verification can be disabled for self-signed certificates.

If you choose to verify query results, the check connects to the Postgres service and makes a user-defined database query. It then verifies the results of the query with user-defined fields. The results can be either numeric or strings.

For numeric query results, the Postgres check will verify that the number is within the user-defined minimum and maximum range. If the result is outside that range, the check will fail and notifications will be sent.

For string query results, the PostgreSQL check will try an exact match against the user-defined 'match' field. The 'match' field also support regular expressions (regex) matching.

When to use PostgreSQL Checks

NodePing's PostgreSQL checks can be used to test the availability of a PostgreSQL database service. It can also be used to verify the results of a query. It is often required to whitelist connections from our probes in the service firewall for the monitoring to function. A list of our probe IPs can be found in the FAQ.

If your PostgreSQL service requires authentication please remember that by providing a username/password to someone that is not you, you are creating a new risk. This decision should be weighed very carefully. Please keep our Terms of Service in mind when you are configuring your Postgres checks. It is best practice when you are creating a user for pg monitoring that you have a separate user for monitoring that is restricted to read-only as discussed in the PostgreSQL documentation.

Using PostgreSQL Checks

To set up a PostgreSQL check,

  1. Select PostgreSQL from the Check type drop down.
  2. Give it a friendly label to identify this check in lists and notifications.
  3. Enable Automated Diagnostics if you'd like detailed technical info about the failure that may help you troubleshoot.
  4. Set how often you want the check to run on the Check Frequency field. Sub-minute intervals may have additional costs.
  5. Set the URI of the PostgreSQL service. username, password, port, and database must all be set in the URI. For example:
    postgresql://myuser:mypassword@psql.example.com:5432/mydatabase
    The port in the above URI is 5432 and the database is mydatabase. For TLS-enabled services the URI should end with '?sslmode=require'
  6. If using SSL to connect to PostgreSQL, you can optionally verify the SSL certificate. Set to "Ignore Certificate" if you're service is using a self-signed SSL certificate.
  7. Set your optional database query in the 'Query' field. If left blank, the default query of 'SELECT NOW();' will be sent.
  8. If you've set a query, you can verify the results using the 'Query Results' section. Enter the field name. If the results are expected to be numeric, set the 'Min' and 'Max' fields to your desired range. If the results are expected to be a string, set the 'Match' field to either the exact match expected or a regular expression (regex).
  9. Set a time out. The default 5 seconds works fine for most situations.
  10. Set the Sensitivity. High is usually appropriate.
  11. Set the notifications for this check. More information about notifications.

Common usage:
To monitor availability of PostgreSQL database services.

Other considerations

IPv6 URLs require the bracket formatting such as postgresql://[2606:c700:4020:11::53:4a3b]/mydb

SSLv3/TLS1.0 are not supported.

If you have any questions, get in touch at support@nodeping.com, or use our Contact form.