sudo DD_API_KEY=REDACTED bash -c "$(curl -L https://raw.githubusercontent.com/DataDog/datadog-agent/master/cmd/agent/install_script.sh)"
sudo cp /etc/datadog-agent/trace-agent.conf.example /etc/datadog-agent/trace-agent.conf
Add to config:
import os | |
import boto3 | |
from botocore.exceptions import ClientError | |
import requests | |
""" | |
http://boto3.readthedocs.io/en/latest/guide/configuration.html | |
Boto by default will look for configuration files in the following order: |
The datadog agent runs under the dd-agent user and dd-agent group. This prevents dd-agent accessing the logs in /var/log as they are only accessible by root (or a sudo admin).
In order to allow read only access for dd-agent only, create ACL's and modify logrotate to persist the permissions changes.
You can manually set the ACL with:
sudo setfacl -m g:dd-agent:rx /var/log/<application-name>
This will not persist as logrotate will not re-apply the ACL setting so for a more permanent solution you can add a rule to logrotate to reset the ACL. You will need to create a new file:
import datetime | |
import time | |
import requests | |
import simplejson | |
from datadog import initialize, api | |
""" | |
This script gives a real time report on ec2 and Datadog agent host usage | |
from multiple organizations and reports them up to the 'main' parent account. |
mkdir /etc/datadog-agent/conf.d/logtest.d | |
touch /etc/datadog-agent/conf.d/logtest.d/conf.yaml | |
##Log section | |
logs: | |
- type: file | |
path: /home/vagrant/logout.log | |
service: cawa-server | |
source: cawa |
import json | |
import os | |
import requests | |
import pprint | |
from datadog import initialize, api | |
DD_API_KEY = os.getenv('DD_API_KEY', '<YOUR_API_KEY>') | |
DD_APP_KEY = os.getenv('DD_APP_KEY', '<YOUR_APP_KEY>') |
from checks import AgentCheck | |
import os | |
''' | |
This is for demostration purposes only and not recommended for production use. | |
Because of the nature of ping, it could result in a very long running check if there are excessive timeouts. | |
Long running checks could potentially result in other metrics and checks being skipped. | |
Example conf.yaml: |
import random | |
import time | |
import requests | |
import json | |
''' | |
Set the following options in /etc/datadog-agent/datadog.yaml: | |
# Trace Agent Specific Settings | |
apm_config: |