Agent setup on EC2 instance

To install datadog, run the below command on the instance. Make sure to replace the placeholder <dns> with the correct endpoint name.

DD_UPGRADE=true DD_API_KEY=kloudfuse DD_URL="https://<dns>/ingester" bash -c "$(curl -L https://s3.amazonaws.com/dd-agent/scripts/install_script_agent7.sh)"

By default, the above command will start collecting and reporting - cpu, memory, network and uptime - metrics for the ec2 instance itself.

Configuring metrics collection

Datadog agent can be configured to more metrics by enabling various “checks”. For eg: to enable openmetrics check, copy the conf.yaml.example file into conf.yaml located in the openmetrics.d directory.

cp /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml.example /etc/datadog-agent/conf.d/openmetrics.d/conf.yaml

Follow the documentation at - https://docs.datadoghq.com/integrations/openmetrics/ to configure the check.

Enable logs collection

Edit “/etc/datadog-agent/datadog.yaml” and set the following items.

logs_enabled: true logs_config: logs_dd_url: <dns>:443 logs_no_ssl: false force_use_http: true use_compression: true use_v2_api: false

Follow the documentation at https://docs.datadoghq.com/agent/logs/?tab=tailfiles#custom-log-collection to add files to collect logs from. Note the start_position setting in the custom conf.yaml if you are tailing custom files, to ensure receiving all the data and not just the “live” data.