Skip to content

Instantly share code, notes, and snippets.

@alq666
alq666 / dogapi.sh
Created August 29, 2012 22:39
Deploy the dog cli in your home directory
#!/bin/bash -e
# Check python 2.6 or greater
python -V 2>&1 | awk '$2 !~ /^2.[67]|^3/ {exit 1}'
# Download virtualenv
curl https://raw.github.com/pypa/virtualenv/master/virtualenv.py > virtualenv.py
python virtualenv.py $HOME/datadog
source $HOME/datadog/bin/activate
# Install dogapi
pip install dogapi
# Set up the dog alias
@alq666
alq666 / gist:3521334
Created August 30, 2012 01:07
Simple shell script without dog
#!/bin/bash
echo "I'm busy doing work"
# produce widgets
count = produce_widgets
# Notify alq by email
echo "I'm done now and I made $count widgets" | mail [email protected]
@alq666
alq666 / dogevent.sh
Created August 30, 2012 01:13
Turn a simple shell script into a Datadog event
#!/bin/bash
echo "I'm busy doing work"
# produce widgets
count = 100
echo "I'm done now and I made $count widgets." | dog event post "$count Widgets produced"
@alq666
alq666 / dogevent-notify.sh
Created August 30, 2012 01:18
Details of notifications
echo "@alq I'm done now and I made $count widgets." | dog event post "$count Widgets produced"
@alq666
alq666 / post-metric.sh
Created August 30, 2012 01:20
Blog post: send metric details
dog metric post acme.widgets.count $count
@alq666
alq666 / dog-full-example.sh
Created August 30, 2012 01:22
Blog post: full example
#!/bin/bash
echo "I'm busy doing work"
# produce widgets
count = produce_widgets
# Notify @alq and post the event in the Datadog stream
echo "@alq I'm done now and I made $count widgets." | dog event post "$count Widgets produced"
# Post the metric
dog metric post acme.widgets.count $count
#!/bin/sh
if [ -n "$DD_API_KEY" ]; then
apikey=$DD_API_KEY
fi
unamestr=`uname`
if [ $(which curl) ]; then
dl_cmd="curl -L -o"
#!/bin/bash
# make sure dog cli is installed first
# sudo easy_install dogapi
# then run
# dog event post "My first post" "Yada yada yada"
# to make sure you're prompted for credentials
# which will be stored in $HOME/.dogrc
# Now let's test SMTP on localhost
require 'rubygems'
require 'dogapi'
# Create a simple client
# The host is optional here, it's a shortcut to tie event and metrics to a given host
#
# You typically want to do:
# Dogapi::Client.new(your_actual_api_key_as_a_string, ...)
# We are using ENV to let you experiment via an environment variable.
dog = Dogapi::Client.new(ENV['DATADOG_KEY'])
require 'rubygems'
require 'dogapi'
# Create a simple client
# The host is optional here, it's a shortcut to tie event and metrics to a given host
#
# You typically want to do:
# Dogapi::Client.new(your_actual_api_key_as_a_string, ...)
# We are using ENV to let you experiment via an environment variable.
dog = Dogapi::Client.new(ENV['DATADOG_KEY'])