RousselTMLEARNING

Article · Datadog: from discovery to expertise

Agent and integrations

1. Installing the agent #

Linux, Docker, Kubernetes.

Linux #

DD_API_KEY=<cle_api> DD_SITE="datadoghq.eu" \
  bash -c "$(curl -L https://install.datadoghq.com/scripts/install_script_agent7.sh)"
sudo datadog-agent status | head -40

Docker #

docker run -d --name dd-agent \
  -e DD_API_KEY=<cle_api> -e DD_SITE=datadoghq.eu \
  -e DD_LOGS_ENABLED=true -e DD_LOGS_CONFIG_CONTAINER_COLLECT_ALL=true \
  -e DD_APM_ENABLED=true -e DD_APM_NON_LOCAL_TRAFFIC=true -e DD_DOGSTATSD_NON_LOCAL_TRAFFIC=true \
  -v /var/run/docker.sock:/var/run/docker.sock:ro \
  -v /proc/:/host/proc/:ro -v /sys/fs/cgroup/:/host/sys/fs/cgroup:ro \
  -p 8126:8126 -p 8125:8125/udp \
  gcr.io/datadoghq/agent:7

Kubernetes with the operator #

helm repo add datadog https://helm.datadoghq.com && helm repo update
helm install datadog-operator datadog/datadog-operator -n datadog --create-namespace
kubectl -n datadog create secret generic datadog-secret --from-literal api-key=<cle_api>
apiVersion: datadoghq.com/v2alpha1
kind: DatadogAgent
metadata: { name: datadog, namespace: datadog }
spec:
  global:
    site: datadoghq.eu
    clusterName: prod-eu
    credentials:
      apiSecret: { secretName: datadog-secret, keyName: api-key }
  features:
    logCollection: { enabled: true, containerCollectAll: true }
    apm: { instrumentation: { enabled: true } }
    liveProcessCollection: { enabled: true }

2. Integrations #

Enabling a check.

Configuration file #

# /etc/datadog-agent/conf.d/nginx.d/conf.yaml
init_config:
instances:
  - nginx_status_url: http://localhost:81/nginx_status
    tags: [service:front, env:prod]
sudo datadog-agent check nginx        # exécuter le check une fois
sudo systemctl restart datadog-agent

Container autodiscovery #

For containers, configuration goes into annotations (Kubernetes) or labels (Docker): the agent applies the check to every matching container, wherever it runs.

metadata:
  annotations:
    ad.datadoghq.com/nginx.checks: |
      {"nginx": {"instances": [{"nginx_status_url": "http://%%host%%:81/nginx_status"}]}}
    ad.datadoghq.com/nginx.logs: '[{"source": "nginx", "service": "front"}]'
Good practice: The %%host%% variable is replaced by the container's address: the same annotation works for all pods.

3. Diagnosing the agent #

Useful commands.

Commands #

sudo datadog-agent status            # état des checks, logs, APM, erreurs
sudo datadog-agent configcheck       # configurations chargées (dont autodiscovery)
sudo datadog-agent flare <ticket>    # paquet de diagnostic pour le support
kubectl -n datadog exec ds/datadog-agent -- agent status

📄 Installing the Datadog agent and configuring integrations →

My progress

  • ⏱ Estimated time : ≈ 7 min

Sign in to track your progress and take notes. Sign in

💬 Recent discussions about this course

Ask a question about this lesson →See all discussions about this course

Recommended Articles

Datadog on Kubernetes: Operator, Cluster Agent and Autodiscovery

Monitor Kubernetes with Datadog: the Datadog Operator and the DatadogAgent resource, Cluster Agen...

Datadog: the SaaS observability platform at a glance

What Datadog is, its products (infrastructure, logs, APM, RUM, synthetics, security), its concept...

Elastic Agent on Kubernetes

Deploy Elastic Agent on Kubernetes: Fleet-managed DaemonSet, Kubernetes integration, kube-state-m...

Datadog platform architecture: sites, organizations, keys and data model

Understand Datadog's architecture: data sources (agent, cloud integrations, SDKs, OpenTelemetry),...

Advanced infrastructure with Datadog: network, cloud, containers and databases

Monitor infrastructure beyond hosts: Network Performance Monitoring, AWS, Azure and GCP integrati...

Monitors, SLOs, dashboards and Datadog as code

Create effective monitors (metrics, logs, APM, composites, anomalies), SLOs, dashboards, and mana...

OneAgent: collection methods, installation, Kubernetes and health

Dynatrace collection methods (OneAgent, OpenTelemetry, Prometheus, API), installing OneAgent with...

Advanced Datadog APM: sampling, retention, profiler and Software Catalog

Go further with Datadog APM: ingestion control and sampling, retention filters, trace metrics, Co...

RUM and Synthetic Monitoring with Datadog: synthetic transaction monitoring and user experience

Measure user experience with Datadog: browser and mobile RUM, Core Web Vitals, Session Replay, li...

Support us

♥ SUPPORT US

Support RousselTM Learning

Courses, articles, labs and certificates stay free with no intrusive ads. A voluntary contribution, of any amount you choose, pays for hosting, lab environments and new content.

Contribute with PayPal Any amount · card or PayPal accountLearn more
QR code PayPal
Or scan this QR code with your phone

Thank you, every contribution counts!