Skip to content

Instantly share code, notes, and snippets.

View davidmlentz's full-sized avatar

David M. Lentz davidmlentz

  • Datadog
  • Boise, ID
View GitHub Profile
@davidmlentz
davidmlentz / aws_create_account.sh
Last active March 30, 2018 20:50
Shell script to call the AWS Organizations API to create an AWS account and parse out the AccountId
# Create an AWS account
# The account must use an email address not associated with any other AWS account
ACCOUNT_EMAIL='new-team@company.com'
ACCOUNT_NAME='new-team'
AWS_RESULT=$(aws organizations create-account --email ${ACCOUNT_EMAIL} --account-name "${ACCOUNT_NAME}")
# Get the request ID from the create-account operation
AWS_REQUEST_ID=`echo $AWS_RESULT | python -mjson.tool | grep '^\(.*\)Id\(.*\)$' | sed 's/^\(.*\)": "\(.*\)",$/\2/'`
# From http://webpy.org/docs/0.3/tutorial
import web
urls = (
'/', 'index'
)
class index:
def GET(self):
return "Hello, world!"
[Unit]
Description=Redis In-Memory Data Store
After=network.target
[Service]
User=redis
Group=redis
ExecStart=/usr/local/bin/redis-server /etc/redis/redis.conf
ExecStop=/usr/local/bin/redis-cli shutdown
Restart=always
# Set up to collect HAProxy logs via UDP:
$ModLoad imudp
$UDPServerAddress 127.0.0.1
$UDPServerRun 514
# Define the log files where local0 and local1 will write:
$template haproxy-access,"/var/log/haproxy/haproxy-access.log"
$template haproxy-events,"/var/log/haproxy/haproxy-events.log"
local0.* -?haproxy-access
global
log 127.0.0.1:1514 local0
log 127.0.0.1 local1 notice
user haproxy
group haproxy
defaults
mode http
log global
option httplog
# Adapted from http://webpy.org/docs/0.3/tutorial
import redis, random, web
urls = (
'/', 'index'
)
from ddtrace import patch, Pin
# Patch the Redis library to automatically enable tracing:
patch(redis=True)
init_config:
instances:
- url: http://localhost:9000/haproxy_stats
username: Username
password: Password
collate_status_tags_per_host: True
logs:
- type: udp
port: 514
global
log /dev/log local0
user haproxy
group haproxy
defaults
mode http
log global
option httplog
option dontlognull
local0.* /var/log/haproxy0.log
& stop
init_config:
instances:
- url: http://localhost:9000/haproxy_stats
username: Username
password: Password
collate_status_tags_per_host: True
## Log section (Available for Agent >=6.0)