Barkdog is a tool to manage Datadog monitors.
Clone or download
Permalink
Type Name Latest commit message Commit time
Failed to load latest commit information.
bin Fix fail-if-empty bug, should be true when enabled Feb 7, 2017
lib Bump up version [ci skip] Feb 8, 2017
spec Add new parameter new_host_delay Sep 30, 2016
.gitignore Add client May 17, 2015
.rspec Add spec skelton May 31, 2015
.travis.yml Fix .travis.yml Sep 18, 2016
Gemfile first commit May 17, 2015
LICENSE.txt first commit May 17, 2015
README.md Merge pull request #15 from PagerDuty/disallow-no-existing-monitors Feb 7, 2017
Rakefile Add spec skelton May 31, 2015
barkdog.gemspec Fix specs Sep 18, 2016

README.md

Barkdog

Barkdog is a tool to manage Datadog monitors.

It defines Datadog monitors using Ruby DSL, and updates monitors according to DSL.

Gem Version Build Status

Notice

  • >= 0.1.3
    • Support Template

Installation

Add this line to your application's Gemfile:

gem 'barkdog'

And then execute:

$ bundle

Or install it yourself as:

$ gem install barkdog

Usage

export BARKDOG_API_KEY=...
export BARKDOG_APP_KEY=...

barkdog -e -o Barkfile
vi Barkfile
barkdog -a --dry-run
barkdog -a

Help

Usage: barkdog [options]
        --api-key API_KEY
        --app-key APP_KEY
    -a, --apply
    -f, --file FILE
        --dry-run
        --ignore-silenced
    -e, --export
    -o, --output FILE
        --no-color
        --no-delete
        --delete-only-tagged TAG
        --debug
        --datadog-timeout TIMEOUT
        --fail-if-empty
    -h, --help

Barkfile example

monitor "Check load avg", :type=>"metric alert" do
  query "avg(last_5m):avg:ddstat.load_avg.1m{host:i-XXXXXXXX} > 1"
  message "@winebarrel@example.net"
  tags ["load", "host", "example"]
  options do
    locked false
    new_host_delay 300
    notify_no_data true
    no_data_timeframe 2
    notify_audit true
    silenced({})
  end
end

Use template

template "cpu template" do
  query "avg(last_5m):avg:#{context.target}.load_avg.1m{host:i-XXXXXXXX} > 1"
  message context.message
  options do
    locked false
    new_host_delay 300
    notify_no_data true
    no_data_timeframe 2
    notify_audit true
    silenced({})
  end
end

monitor "Check load avg", :type=>"metric alert" do
  context.message = "@winebarrel@example.net"
  include_template "cpu template", :target=>"ddstat"
end

template "basic monitor" do
  monitor "#{context.target} cpu" do
    query "avg(last_5m):avg:#{context.target}.load_avg.1m{host:i-XXXXXXXX} > 1"
    ...
  end

  # any other monitor
  monitor ...
end

"myhost".tap do |host|
  include_template "basic monitor", :target=>host
  include_template "mysql monitor", :target=>host
  ...
end

Similar tools