Skip to content

Instantly share code, notes, and snippets.

@burnsie7
burnsie7 / lambda_cloudwatch_get_and_send
Last active September 12, 2019 22:21
Query cloudwatch metrics and submit to Datadog as custom metrics
import boto3
import json
import os
import pprint
import requests
from datetime import datetime, timedelta
from datadog_lambda.wrapper import datadog_lambda_wrapper
from datadog_lambda.metric import lambda_metric
@burnsie7
burnsie7 / config_map_example.md
Created August 6, 2019 20:57
Custom AD names w/ Config Map Example

Example config map for redis where the redis image name is customized as redis-test or redis-stage:

---
kind: ConfigMap
apiVersion: v1
metadata:
  name: redis-config
  namespace: default
data:
 redis_ad: |-
@burnsie7
burnsie7 / gen_fake_data.py
Last active June 10, 2019 02:35
generate logs w/ pii
import time
import json
from faker import Factory
fake = Factory.create()
start_time = time.time() + 900
while time.time() < start_time:
p = fake.profile()
@burnsie7
burnsie7 / update_host_tags_with_metadata.py
Created February 4, 2019 21:53
update host tags with metadata (example)
"""
Disclaimer
These projects are not a part of Datadog's subscription services and are provided for example purposes only.
They are NOT guaranteed to be bug free and are not production quality.
If you choose to use to adapt them for use in a production environment, you do so at your own risk.
"""
import json
import os
import requests
@burnsie7
burnsie7 / historic_usage_to_csv.py
Last active January 16, 2019 17:57
Query historic usage metrics and export to CSV
import datetime
import os
import time
import csv
import requests
import simplejson
from datadog import initialize, api
"""
@burnsie7
burnsie7 / agent_check_parse_values.py
Created November 20, 2018 03:22
agent check example parsing the values from directory listing
import os
import pprint
import subprocess
import random
from checks import AgentCheck
# for logging
def log_parsed_output(output_list):
with open(writepath, mode) as f:
for i in output_list:
@burnsie7
burnsie7 / custom_docker_agent.md
Created November 14, 2018 22:19
Building custom docker agent image for jmx (or any integration)

Example of building your own agent image using jmx.yaml

Step 0 - Create jmx.yaml

Example:

touch jmx.yaml
@burnsie7
burnsie7 / readme.md
Last active November 14, 2018 19:42
dd_jmx_apm_readme.md

Running Datadog Java APM in Docker example

Step 0 (Optional) - Create conf directory for jmx auto discovery

Create a directory to house any custom integration yaml files for integrations running in other docker containers on this host. You can also extend or customize integration settings generated by auto discovery. Example:

mkdir /opt/datadog-agent-conf.d
touch /opt/datadog-agent-conf.d/jmx.yaml
{
"containerDefinitions": [
{
"name": "datadog-agent",
"image": "datadog/agent:latest",
"cpu": 10,
"memory": 256,
"essential": true,
"portMappings": [
{
@burnsie7
burnsie7 / host_tag_update_v2.py
Last active July 16, 2019 22:28
host_tag_update_v2.py
"""
Disclaimer
These projects are not a part of Datadog's subscription services and are provided for example purposes only.
They are NOT guaranteed to be bug free and are not production quality.
If you choose to use to adapt them for use in a production environment, you do so at your own risk.
"""
import json
import os
import requests