Database Monitoring Fundamentals Certification / 02 / 05
Database Monitoring (DBM) Configuration and Setup
What this domain covers
This domain covers the configuration and verification steps for getting DBM running. There are four pillars. First, Agent configuration: dbm: true in the database check, the connection target, a read-only user, and secret references. Second, preparation on the database side: pg_stat_statements and track_activity_query_size for Postgres, the Performance Schema for MySQL, and the function needed for explain plans. Third, choosing an architecture: direct connections, a separate host for managed databases, and the Cluster Agent on Kubernetes. Fourth, verification and troubleshooting: agent status, running a check by hand, connectivity to the intake, and tags. The exam asks questions such as "Which setting is missing?" and "Where do you check?" Figures are based on the official documentation as of October 2026.
Topics listed in the official guide
- Configure the Datadog Agent for DBM
- Validate connectivity, permissions, and required components
- Adjust configuration settings when needed
- Verify DBM data collection and tagging
- Enable trace-to-query correlation
- Troubleshoot setup and data collection issues
Key points
- DBM is enabled by writing dbm: true in the database check's instance configuration (such as conf.d/postgres.d/conf.yaml) and restarting the Agent.
- The Agent logs in as a dedicated user with read-only access (datadog in the procedure). An administrator account is not used.
- For Postgres, add pg_stat_statements to shared_preload_libraries, restart the server, and create the extension in every database you connect to.
- The default for track_activity_query_size is 1024 bytes; if long SQL is cut off, raise it to a value such as 4096.
- Postgres explain plans require the datadog.explain_statement function in every database from which queries are collected.
- For MySQL, enable the Performance Schema, and for a same-host connection use 127.0.0.1 or a socket instead of localhost.
- The Agent connects directly to the host it monitors. Do not go through a proxy, load balancer, or pgbouncer, and for Aurora connect to the individual instances rather than the cluster endpoint.
- Keep the instances monitored by one Agent to about 30, and on Kubernetes distribute them with Cluster Agent cluster checks.
- After setup, use agent status to check for configuration errors and the Query Metrics / Query Samples values, and if data does not arrive, check connectivity to the intake on port 443.
- Do not add a custom db tag, because it overrides the per-database value. Fix a hostname recorded through a proxy with reported_hostname.
Terms and concepts
dbm: true and the database check
DBM is a feature of the database checks included in the standard Agent. For self-hosted Postgres, you write dbm: true, host, port, username, and password under instances in conf.d/postgres.d/conf.yaml and restart the Agent. It is enabled per instance and is not enabled by a global setting in datadog.yaml or by an environment variable on the database process. How to write the configuration is on the setup page for each database type.
- Datadog AgentProduct
- Monitoring PostgreSQL with Datadog - Extensions and Monitoring RoleArticle
The Agent user and privileges
The Agent logs in as a user with read-only access to read database statistics and queries. In the procedure, you create a user named datadog and grant only the privileges it needs. In Postgres, seeing other users' queries requires the pg_monitor role; without it, only the datadog user's own queries appear. Do not write the password in plain text; store it in a secrets management system such as Vault and reference it with ENC[<SECRET_NAME>].
- datadog.yamlGlossary
Preparing the Postgres side
postgresql.queries.* metrics require shared_preload_libraries = pg_stat_statements, and after the change you restart the server for it to take effect. The extension is created with CREATE EXTENSION in every database the Agent connects to. track_activity_query_size is the maximum size of SQL text exposed to the Agent, and the default of 1024 bytes cuts off long statements. Explain plans require the datadog.explain_statement function in every database from which queries are collected.
- Monitoring PostgreSQL with Datadog - Extensions and Monitoring RoleArticle
Preparing the MySQL side
For MySQL, you enable the Performance Schema (performance_schema = ON) and configure the related options to collect query metrics, samples, and explain plans. When the Agent and MySQL are on the same host, set the connection target to host: 127.0.0.1 rather than localhost; using a socket is also fine. The general query log and the query cache are not required settings for DBM.
Direct connections and managed databases
The Agent must connect directly to the host it monitors. Going through a proxy, load balancer, or pgbouncer changes the connected host during operation, so the Agent computes the difference between two hosts' statistics and the values become inaccurate. For databases such as Amazon RDS where the Agent cannot be installed inside, place the Agent on a separate host that connects remotely, and collect system metrics such as CPU and disk with the cloud integration. For Aurora, connect to the individual instances.
- Agent ProxyGlossary
Kubernetes and Cluster Agent cluster checks
When monitoring databases outside the cluster from Agents on Kubernetes, Cluster Agent cluster checks distribute database instances one at a time across a pool of Agents so that each check runs in only one place. If an Agent stops, the work is redistributed to another Agent. Placing many instances on one Agent can overload it and produce the warning Job loop stopping due to check inactivity, so split them using about 30 instances per Agent as a guideline.
- Cluster AgentGlossary
- Container MonitoringProduct
How to verify after setup
First run agent status, check in the Config Errors section that the configuration file is valid, and confirm that the values on the Database Monitoring Query Metrics and Query Samples lines are greater than 0. If you cannot find the cause, run datadog-agent check postgres -t 2 with the debug log level and synchronous execution specified. Query metrics are sent for queries that have run across at least two 10-second intervals after an Agent restart.
- FlareGlossary
Checking connectivity to the intake
If system metrics arrive but data is missing only from DBM views, check connectivity on port 443 to the DBM intakes (dbm-metrics-intake and dbquery-intake). Send an empty payload with an invalid API key; if 403 Forbidden is returned, the path is open. If not, review the proxy and firewall allowances.
- Agent ProxyGlossary
Tags and hostnames
Datadog attaches a db tag to database metrics to indicate which database they belong to. Writing a custom db tag in the instance's tags overrides this value, and the databases appear merged into one in the list. In setups where you can connect only through a proxy, all telemetry is recorded under the proxy's hostname, so override the recorded hostname with the instance's reported_hostname.
Configuring trace-to-query correlation
Correlation is configured on the application side. Use DD_SERVICE, DD_ENV, and DD_VERSION so services can be identified, and specify full or service in DD_DBM_PROPAGATION_MODE in each language's SDK. With Postgres and MySQL, prepared statements do not support full, and JDBC calls that use prepared statements fall back to service, so many Java applications end up in service mode.
Check your understanding
Check what you have learned with 5 questions