Using:
Kubernetes: 1.18.8
Helm: 3.3.4
Datadog DaemonSet agent: 7.23.0
Datadog cluster-agent: 1.9.0
Azure Database for PostgreSQL 11.x (i.e. external postgres-service)
I am deploying Datadog as a DaemonSet and with the cluster-agent enabled to a Kubernetes cluster using the instructions provided here.
helm install my-kubernetes -f values.yaml --set datadog.apiKey=<DATADOG_API_KEY> datadog/datadog --set targetSystem=linux
I'm configuring Datadog using the values.yaml file as specified.
I want to do some custom metrics, specifically using the integration formerly known as postgres.yaml. I have tried to do this as specified in the values.yaml template found here, like this (putting it in the cluster-agent, since these are cluster-wide metrics):
# clusterAgent.confd -- Provide additional cluster check configurations
## Each key will become a file in /conf.d
## ref: https://docs.datadoghq.com/agent/autodiscovery/
confd:
postgres.yaml: |-
init_config:
instances:
- host: my-postgres-host.com
port: 5432
username: my-user
password: some-password
dbname: some-database
ssl: True
tags:
- some_tag
custom_queries:
- metric_prefix: some.prefix
query: SELECT COUNT(*) FROM bla WHERE timestamp > NOW() - INTERVAL '1 hour';
columns:
- name: countLastHour
type: count
As per the documentation, I can confirm that using the |- prefix this indeed creates a file in the path /etc/datadog-agent/conf.d/postgres.yaml on the node, where I would expect it to. The file correctly has all the contents in the block, i.e. starting with init_config:...
Now, when starting the node I see this in the logs (DEBUG):
'/conf.d/postgres.yaml' -> '/etc/datadog-agent/conf.d/postgres.yaml' /conf.d/..2020_10_22_10_22_27.239825358 -> /etc/datadog-agent/conf.d/..2020_10_22_10_22_27.239825358 '/conf.d/..2020_10_22_10_22_27.239825358/postgres.yaml' -> '/etc/datadog-agent/conf.d/..2020_10_22_10_22_27.239825358/postgres.yaml'
2020-10-22 10:22:29 UTC | CLUSTER | DEBUG | (pkg/autodiscovery/providers/file.go:196 in collectEntry) | Found valid configuration in file: /etc/datadog-agent/conf.d/postgres.yaml
2020-10-22 10:22:29 UTC | CLUSTER | DEBUG | (pkg/collector/scheduler.go:154 in getChecks) | Unable to load a check from instance of config 'postgres': Core Check Loader: Check postgres not found in Catalog
2020-10-22 10:22:29 UTC | CLUSTER | ERROR | (pkg/collector/scheduler.go:201 in GetChecksFromConfigs) | Unable to load the check: unable to load any check from config 'postgres'
The documentation here states, that the postgres yaml-contents in agents v7.x should actually be in /etc/datadog-agent/conf.d/postgres.d/conf.yaml and not in /etc/datadog-agent/conf.d/postgres.yaml. It is not possible to create a subfolder / use forward slashes in the config key (internally, the file is created using ConfigMap).
I'm not even sure if the problem is the yaml-file path or if a core integration is missing. So my broad quest is: how do I enable Datadog postgres-integration correctly in my setup?



