> example. It must stay as it is. Only make sure the Docker PAT is correctly
> mounted into the Datadog agent in the specified filesystem path. Save the
> file as `conf.yaml` and restart the agent.
When creating a Datadog agent configuration of your own, make sure to edit the
`openmetrics_endpoint` property to target your organization, by replacing
`dockerscoutpolicy` with the namespace of your Docker organization.
### Datadog sample project
If you don't have a Datadog server set up, you can run a [sample project](https://github.com/dockersamples/scout-metrics-exporter)
using Docker Compose. The sample includes a Datadog agent, running as a
container, that scrapes metrics for a Docker organization enrolled in Docker
Scout. This sample project assumes that you have a Datadog account, an API key,
and a Datadog site.
1. Clone the starter template for bootstrapping a Datadog Compose service for
scraping the Docker Scout metrics endpoint:
```console
$ git clone git@github.com:dockersamples/scout-metrics-exporter.git
$ cd scout-metrics-exporter/datadog
```
2. [Create a Docker access token](/security/for-developers/access-tokens/#create-an-access-token)
and store it in a plain text file at `/datadog/token` under the template directory.
```plaintext {title=token}
$ echo $DOCKER_PAT > ./token
```
3. In the `/datadog/compose.yaml` file, update the `DD_API_KEY` and `DD_SITE` environment variables
with the values for your Datadog deployment.
```yaml {hl_lines="5-6"}
datadog-agent:
container_name: datadog-agent
image: gcr.io/datadoghq/agent:7
environment:
- DD_API_KEY=${DD_API_KEY} # e.g. 1b6b3a42...
- DD_SITE=${DD_SITE} # e.g. datadoghq.com
- DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true
volumes:
- /var/run/docker.sock:/var/run/docker.sock:ro
- ./conf.yaml:/etc/datadog-agent/conf.d/openmetrics.d/conf.yaml:ro
- ./token:/var/run/secrets/scout-metrics-exporter/token:ro
```
The `volumes` section mounts the Docker socket from the host to the
container. This is required to obtain an accurate hostname when running as a
container ([more details here](https://docs.datadoghq.com/agent/troubleshooting/hostname_containers/)).
It also mounts the agent's config file and the Docker access token.
4. Edit the `/datadog/config.yaml` file by replacing the placeholder `<ORG>` in
the `openmetrics_endpoint` property with the namespace of the Docker
organization that you want to collect metrics for.
```yaml {hl_lines=2}
instances:
- openmetrics_endpoint: "https://api.scout.docker.com/v1/exporter/org/<<ORG>>/metrics"
namespace: "scout-metrics-exporter"
# ...
```
5. Start the Compose services.
```console
docker compose up -d
```
If configured properly, you should see the OpenMetrics check under Running
Checks when you run the agent’s status command whose output should look similar
to:
```text
openmetrics (4.2.0)
-------------------
Instance ID: openmetrics:scout-prometheus-exporter:6393910f4d92f7c2 [OK]
Configuration Source: file:/etc/datadog-agent/conf.d/openmetrics.d/conf.yaml
Total Runs: 1
Metric Samples: Last Run: 236, Total: 236
Events: Last Run: 0, Total: 0
Service Checks: Last Run: 1, Total: 1
Average Execution Time : 2.537s
Last Execution Date : 2024-05-08 10:41:07 UTC (1715164867000)
Last Successful Execution Date : 2024-05-08 10:41:07 UTC (1715164867000)
```
For a comprehensive list of options, take a look at this [example config file](https://github.com/DataDog/integrations-core/blob/master/openmetrics/datadog_checks/openmetrics/data/conf.yaml.example) for the generic OpenMetrics check.
### Visualizing your data
Once the agent is configured to grab Prometheus metrics, you can use them to build comprehensive Datadog graphs, dashboards, and alerts.
Go into your [Metric summary page](https://app.datadoghq.com/metric/summary?filter=scout_prometheus_exporter)