rapid7 / dogwatch Goto Github PK
View Code? Open in Web Editor NEWA Ruby DSL to create DataDog monitors.
License: MIT License
A Ruby DSL to create DataDog monitors.
License: MIT License
hello, this looks like an interesting project, i was wondering if it was possible to create composite monitors with this tool?
I am not sure what would be the best way to represent a dependency graph of monitors something like this:
+-----------------+
+----+composite monitor+---+
| +-----------------+ |
| |
| |
+-----v-----------+ +--------v--+
+-+composite monitor+--+ |query alert|
| +-----------------+ | +-----------+
| |
| |
+---------v-------+ +------v----+
+--+composite monitor+--+ |query alert|
| +-----------------+ | +-----------+
| |
| |
+-----v-----+ +-------v---+
|query alert| |query alert|
+-----------+ +-----------+
We should support deleting (as well as creating/updating) monitors managed via DogWatch.
Dogwatch resolves monitors by name. So if you have two different teams sharing one DataDog account, they can accidentally clobber each others monitors if they don't have a naming scheme thought out. Dogwatch should resolve monitors by ID instead.
I'm thinking this should be similar to what Terraform does, where monitors are tracked in a local state file that's committed to source control.
Add support for thresholds on metric_alert(s). From the docs:
METRIC ALERT OPTIONS
These options only apply to metric alerts.
thresholds
a dictionary of thresholds by threshold type. Currently we have two threshold types for >metric alerts: critical and warning. Critical is defined in the query, but can also be specified in this option. Warning threshold can only be specified using the thresholds option.
Example:{'critical': 90, 'warning': 80}
With the following Dogfile
:
DogWatch.monitor do
# Check if restdb is available via haproxy
monitor "Logentries: restdb available" do
type :metric_alert
query "max(last_1m):min:haproxy.backend_hosts{service:servicenamei,available:true} < 1"
message %Q(service not available via haproxy
Playbook:
* Run `something magic`
Setup via Dogwatch)
options do
notify_no_data true
end
end
end
generates the following exception:
/var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/model/options.rb:25:in `render': undefined method `to_h' for nil:NilClass (NoMethodError)
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/model/monitor.rb:56:in `options'
from /tmp/Dogfile:17:in `block (2 levels) in create'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/monitor.rb:28:in `instance_eval'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/monitor.rb:28:in `monitor'
from /tmp/Dogfile:4:in `block in create'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/monitor.rb:20:in `instance_exec'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/monitor.rb:20:in `initialize'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch.rb:7:in `new'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch.rb:7:in `monitor'
from /tmp/Dogfile:2:in `create'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/dogfile.rb:19:in `instance_eval'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/dogfile.rb:19:in `create'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/bin/dogwatch:23:in `create'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/bin/dogwatch:28:in `<top (required)>'
from /usr/local/bin/dogwatch:23:in `load'
from /usr/local/bin/dogwatch:23:in `<main>'
๐ฎ
Currently, trying to add some monitors and my queries are clearly broken, but all I'm seeing is:
"error ["The value provided for parameter 'query' is invalid"]"
I think it'd be helpful to see at the very least what the query was that it was trying to use.
$ /usr/local/bin/dogwatch create --dogfile=Dogfile
/var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/dogfile.rb:19:in `instance_eval': /tmp/Dogfile:10: syntax error, unexpected ':', expecting keyword_end (SyntaxError)
silenced '*': nil
^
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/lib/dogwatch/dogfile.rb:19:in `create'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/bin/dogwatch:23:in `create'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/command.rb:27:in `run'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/invocation.rb:126:in `invoke_command'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor.rb:359:in `dispatch'
from /var/lib/gems/1.9.1/gems/thor-0.19.1/lib/thor/base.rb:440:in `start'
from /var/lib/gems/1.9.1/gems/dogwatch-1.0.4/bin/dogwatch:28:in `<top (required)>'
from /usr/local/bin/dogwatch:23:in `load'
from /usr/local/bin/dogwatch:23:in `<main>'
with the following content in Dogfile
# $ cat Dogfile
DogWatch.monitor do
## Create a new monitor - monitor name is REQUIRED
monitor 'MONITOR NAME' do
type :metric_alert # REQUIRED: One of [:metric_alert | :service_check | :event_alert]
query 'time_aggr(time_window):space_aggr:metric{tags} [by {key}] operator' # REQUIRED
message 'MESSAGE'
tags %w(A list of tags to associate with your monitor)
options do
silenced '*': nil
notify_no_data false
no_data_timeframe 3
timeout_h 99
renotify_interval 60
escalation_message 'oh snap'
include_tags true
end
end
end
which is exactly the example provided in the README.md file
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.