This quickstart guide will help you get a Datadog agent up and running with Container Apps on Crunchy Bridge. We recommend you start with the Container Apps Quickstart to get a general understanding of Container Apps.
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.
First, make sure you have Container Apps enabled. As a user with superuser
CREATE EXTENSION pgpodman; to install the extension in the
postgres database of the desired cluster.
Next, find your cluster's database URL to include as the
parameter when you run the container. You can find the URL in the Connection
section of the cluster dashboard (choose the
application role), or by running
cb uri --role application <database name> on the command line.
You'll also need to locate your API key from Datadog to include as the
DD_API_KEY parameter when you start the container.
Create a Datadog user in your database, and note the password to include as the
DD_INSTANCES_PASSWORD parameter when you start the container:
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; $$ LANGUAGE sql VOLATILE SECURITY DEFINER; CREATE VIEW pg_stat_activity_dd AS SELECT * FROM pg_stat_activity(); grant SELECT ON pg_stat_activity_dd to datadog;
To start your Datadog collector, run the following using your own values for
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="your-API-key" -e DD_INSTANCES_HOST="your-database-URL" -e DD_HOSTNAME="<cluster_hostname>" -e DD_INSTANCES_PASSWORD="Datadog-user-password" docker.io/datadog/agent');
The collector should immediately begin sending data to Datadog. Visit the Datadog documentation for more details on the Datadog collector.