# Pushing VGS Metrics to Datadog

To connect VGS Metrics to your Datadog account and begin collecting metrics, follow these steps:

### Prerequisites

* [Datadog API Key](https://docs.datadoghq.com/account_management/api-app-keys/#add-an-api-key-or-client-token): Obtain this from your Datadog account.
* [Datadog Site Parameter](https://docs.datadoghq.com/getting_started/site/#access-the-datadog-site): Identify the appropriate site for your account.

### Step 1. Configure the Datadog Agent

Create a configuration file named `dd-agent-conf.yml`. This file specifies:

* The Prometheus endpoints to be scraped
* Basic authentication credentials
* Specific metrics to collect

Here's an example configuration:

```yaml
init_config:
instances:
  - prometheus_url: https://metrics.apps.verygood.systems/vaults/tntasd123/api/metrics # note, your Vault ID must be added to the path
    username: prometheus
    password: hunter2
    namespace: vgs
    send_distribution_buckets: true
    max_returned_metrics: 10000
    send_histograms_buckets: true
    label_to_hostname: vgs_tier
    metrics: # List of metrics to collect (required)
    - vault_record_usage: record_usage
    - vault_record_usage_failure: record_usage_failure
    - http_proxy_request
    - http_proxy_response
    - http_proxy_processing_duration_ms
    - http_upstream_response
    - http_upstream_processing_duration_ms
    - sftp_proxy_request
    - sftp_proxy_processing_duration_ms
    - iso_8583_proxy_request
    - iso_8583_proxy_processing_duration_ms
```

### Step 2. Start the Datadog Agent in Docker

Run the following command to start the Datadog Agent in a Docker container. Replace `path/to/your/dd-agent-conf.yml` with the actual path to your configuration file.

```bash
docker run -d --name dd-agent \
    -v /var/run/docker.sock:/var/run/docker.sock:ro \
    -v /proc/:/host/proc/:ro \
    -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
    -e DD_API_KEY="my-dd-api-key" \
    -e DD_SITE="datadoghq.com" \
    -v path/to/your/dd-agent-conf.yml:/etc/datadog-agent/conf.d/openmetrics.d/conf.yaml \
    gcr.io/datadoghq/agent:latest
```

### Step 3. Verify the Agent

Once the Docker container has successfully started, the agent will begin periodic checks and push metrics to your Datadog account. Verify the metrics in your Datadog dashboard.

### Further Reading

For more information on integrating Prometheus metrics with Datadog, check out these resources:

* [Getting Started with Datadog](https://docs.datadoghq.com/integrations/openmetrics/)
* [Prometheus and OpenMetrics metrics collection from a host](https://docs.datadoghq.com/integrations/guide/prometheus-host-collection/#parameters-available)


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.verygoodsecurity.com/enterprise-platform/core-platform-services/observability/accessing-vgs-metrics-via-prometheus-api/pushing-vgs-metrics-to-datadog.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
