Skip to content
This repository has been archived by the owner on May 31, 2024. It is now read-only.

codenize-tools/barkdog

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

64 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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

About

Barkdog is a tool to manage Datadog monitors.

Resources

License

Stars

Watchers

Forks

Packages

No packages published

Languages