---
title: Headings and TOC tests
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > Cdocs e2e tests > Headings and TOC tests
---

# Headings and TOC tests

## Overview{% #overview %}

This page tests that the table of contents updates correctly when content filters change which headings are visible. Several headings are intentionally repeated across database options to verify unique ID generation.

**Everything below this line is fake test content.**

## Prerequisites{% #prerequisites %}

All databases require a Datadog Agent running on the host. Confirm the Agent is installed and reporting before proceeding.

{% section displayed-if="Database is Postgres" %}
This section only applies to users who meet the following criteria: Database is Postgres

## Installation{% #installation %}

Install the Postgres integration by adding the following to your Agent configuration directory:

```
instances:
  - host: localhost
    port: 5432
    username: datadog
    password: <PASSWORD>
```

### Authentication{% #authentication %}

Postgres supports several authentication methods. The Datadog Agent uses password-based authentication by default. To configure trust-based or certificate-based authentication, update the `pg_hba.conf` file on your database host.

### Permissions{% #permissions %}

Create a dedicated `datadog` user with read-only access to the tables you want to monitor. Run the following commands from a `psql` session:

```
CREATE USER datadog WITH PASSWORD '<PASSWORD>';
GRANT SELECT ON pg_stat_database TO datadog;
```

## Configuration{% #configuration %}

After installation, configure the integration to collect additional metrics.

### Query metrics{% #query-metrics %}

Enable query-level metrics by setting `collect_query_metrics: true` in the instance configuration. This requires the `pg_stat_statements` extension.

### Custom queries{% #custom-queries %}

Define custom queries to collect business-specific metrics from your Postgres instance. Each custom query runs at the check interval you configure.

## Vacuuming and maintenance{% #vacuuming-and-maintenance %}

Postgres requires periodic vacuuming to reclaim storage and update query planner statistics. The Datadog integration collects autovacuum metrics by default, including the number of dead tuples and the last vacuum timestamp for each table.

### Autovacuum tuning{% #autovacuum-tuning %}

Adjust `autovacuum_vacuum_threshold` and `autovacuum_vacuum_scale_factor` in `postgresql.conf` to control how aggressively autovacuum runs. Lower thresholds result in more frequent vacuuming on write-heavy tables.

## Troubleshooting{% #troubleshooting %}

### Connection refused{% #connection-refused %}

Verify that Postgres is listening on the expected host and port. Check `postgresql.conf` for the `listen_addresses` and `port` settings.

### Permission denied{% #permission-denied %}

Confirm the `datadog` user has the required grants. Re-run the permission commands from the Installation section if needed.
{% /section %}

{% section displayed-if="Database is MySQL" %}
This section only applies to users who meet the following criteria: Database is MySQL

## Installation{% #installation-2 %}

Install the MySQL integration by adding the following to your Agent configuration directory:

```
instances:
  - host: localhost
    port: 3306
    username: datadog
    password: <PASSWORD>
```

### Authentication{% #authentication-2 %}

MySQL supports native password authentication and caching_sha2_password. The Datadog Agent is compatible with both methods. Configure the authentication plugin in your `my.cnf` if needed.

### Permissions{% #permissions-2 %}

Create a dedicated `datadog` user with the necessary privileges. Run the following commands from a `mysql` session:

```
CREATE USER 'datadog'@'localhost' IDENTIFIED BY '<PASSWORD>';
GRANT REPLICATION CLIENT, PROCESS ON *.* TO 'datadog'@'localhost';
```

## Configuration{% #configuration-2 %}

After installation, configure the integration to collect additional metrics.

### Query metrics{% #query-metrics-2 %}

Enable query-level metrics by setting `collect_query_metrics: true` in the instance configuration. This requires the Performance Schema to be enabled.

### Custom queries{% #custom-queries-2 %}

Define custom queries to collect business-specific metrics from your MySQL instance. Custom queries follow the same structure as other database integrations.

### Replication monitoring{% #replication-monitoring %}

If your MySQL instance is part of a replica set, enable replication monitoring to track lag and thread status:

```
options:
  replication: true
```

## InnoDB monitoring{% #innodb-monitoring %}

The Datadog integration collects InnoDB-specific metrics, including buffer pool usage, row-level lock waits, and data throughput. These metrics help identify storage engine bottlenecks.

### Buffer pool{% #buffer-pool %}

Monitor `innodb_buffer_pool_reads` and `innodb_buffer_pool_read_requests` to assess cache hit ratio. A low hit ratio may indicate the buffer pool is undersized for the working dataset.

## Troubleshooting{% #troubleshooting-2 %}

### Connection refused{% #connection-refused-2 %}

Verify that MySQL is running and accepting connections on the configured host and port. Check the `bind-address` setting in `my.cnf`.

### Permission denied{% #permission-denied-2 %}

Confirm the `datadog` user has the correct grants. Re-run the permission commands from the Installation section and flush privileges.
{% /section %}

{% section displayed-if="Database is MongoDB" %}
This section only applies to users who meet the following criteria: Database is MongoDB

## Installation{% #installation-3 %}

Install the MongoDB integration by adding the following to your Agent configuration directory:

```
instances:
  - hosts:
      - localhost:27017
    username: datadog
    password: <PASSWORD>
    database: admin
```

### Authentication{% #authentication-3 %}

MongoDB supports SCRAM and x.509 certificate authentication. The Datadog Agent uses SCRAM by default. To use x.509, provide the certificate path in the instance configuration.

### Permissions{% #permissions-3 %}

Create a dedicated `datadog` user with the `clusterMonitor` and `read` roles. Run the following commands from a `mongosh` session:

```
db.createUser({
  user: "datadog",
  pwd: "<PASSWORD>",
  roles: [
    { role: "clusterMonitor", db: "admin" },
    { role: "read", db: "admin" }
  ]
});
```

## Configuration{% #configuration-3 %}

After installation, configure the integration to collect additional metrics.

### Query metrics{% #query-metrics-3 %}

Enable query-level metrics by setting `collect_query_metrics: true` in the instance configuration. This requires the database profiler to be enabled on the target databases.

### Custom queries{% #custom-queries-3 %}

Define custom queries to collect business-specific metrics from your MongoDB instance. Custom queries use the aggregation pipeline syntax.

### Replica set monitoring{% #replica-set-monitoring %}

If your MongoDB deployment uses replica sets, the integration automatically detects members and collects replication lag metrics. No additional configuration is required.

## Sharding metrics{% #sharding-metrics %}

For sharded clusters, the integration collects chunk distribution and balancer activity metrics. Connect the Agent to a `mongos` router to collect cluster-wide sharding data.

### Chunk distribution{% #chunk-distribution %}

Monitor the number of chunks per shard to detect imbalances. An uneven distribution may indicate the shard key is not distributing writes effectively.

## Troubleshooting{% #troubleshooting-3 %}

### Connection refused{% #connection-refused-3 %}

Verify that `mongod` is running and listening on the expected host and port. Check the `net.bindIp` and `net.port` settings in your MongoDB configuration file.

### Permission denied{% #permission-denied-3 %}

Confirm the `datadog` user has the `clusterMonitor` role on the `admin` database. Re-run the user creation commands from the Installation section if needed.

### Replica set lag{% #replica-set-lag %}

If replication lag metrics are missing, verify that the Agent can connect to all replica set members. The Agent resolves members from the replica set configuration automatically.
{% /section %}
