Datadog Quickstart

This page contains a quickstart to help you get a Datadog agent up and running with Postgres Container Apps on Crunchy Bridge. We recommend you start with the quickstart to get an understanding of container apps.

About Datadog

Datadog collects metrics and logs for Postgres and other applications servers and hosts. For Postgres, the agent will monitor PostgreSQL states. You can visualize system metrics including load, cpu usage, i/o wait, memory, and network traffic. You can configure notifications about events and customize to your use cases inside the Datadog dashboard.

Datadog with Postgres Container Apps Quickstart

  • Ensure you have Postgres Container Apps enabled with CREATE EXTENSION pgpodman;.
  • Create a Datadog account and create an API Key. Note this key for use inside the podman select command below.
  • Create a Datadog user inside your database
create user datadog with password '<DATADOG_USER_PASSWORD>';
grant pg_monitor to datadog;
grant SELECT ON pg_stat_database to datadog;
  • Create a function so Datadog can collect your system activity
CREATE FUNCTION pg_stat_activity() RETURNS SETOF pg_catalog.pg_stat_activity AS
$$ SELECT * from pg_catalog.pg_stat_activity; $$

CREATE VIEW pg_stat_activity_dd AS SELECT * FROM pg_stat_activity();
grant SELECT ON pg_stat_activity_dd to datadog;
  • Start a podman container
SELECT run_container('-dt -p 5438:5438 --name dd-agent -v /proc/:/host/proc/:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro --privileged -e DD_API_KEY=<API_KEY> -e DD_INSTANCES_HOST=<DATABASE_HOST_URL> -e DD_INSTANCES_PASSWORD=<DATADOG_USER_PASSWORD>');

Additional Resources

See Datadog’s Docker page for information about environment and configuration variables. See datadog’s page on podman.