kennel 1.75.1 → 1.76.0

This diff has not been reviewed by any users.
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 23af2ecfb9019df555f7fe3a3954f4d992208927744093ff1f8886afd571e457
4
- data.tar.gz: 6e2c902c47020e46b5fc0e647d8d63bbd7227657ce78303c673470be840ecbf9
3
+ metadata.gz: a109923efbaef4c2beb6ccf136ea593a43c06b92e45add81d7f07fcbd594779e
4
+ data.tar.gz: 44a1b83e6b2e708eb3f91d98c19e90aeb663f4a6cf0926f296faae2b2570064d
5
5
  SHA512:
6
- metadata.gz: c2dfa7e9f54c83d3369b48b91896cb7dc7cfe75bb94d672d7de07bc7a6b8ea3f63ebe38788dddf5de90ead3b73f977c42f87497d61e7b23def6ae385d0a42213
7
- data.tar.gz: 9ebb18f6d9c54be18a783d8511e3128b9c59b5898f9f14a1be77c871dcdab837681bf04050ec97a1a2f675c84fda624469edaed0af9f5e0da11b60517ba93cea
6
+ metadata.gz: bfb64f23ff80eca8a8034a2bbb7c2cb08e867ec356879b85b487b093cea1109a5fca0da431355fdd597693a4da2b6a42231b99deb23398d562dfd74650448b64
7
+ data.tar.gz: e3034cd7215d04fd2020e6d12e27c1831f8e4167c3befaf24cd6725c81e9caafc71c7b14a8813d55fdd8439ae7ec4a4efa09a58a9c2d1c4616d302c77ed87a20
data/Readme.md CHANGED
@@ -257,7 +257,8 @@ Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a
257
257
 
258
258
  ### Grepping through all of datadog
259
259
 
260
- `TYPE=monitor rake kennel:dump`
260
+ `rake kennel:dump`
261
+ focus on a single type: `TYPE=monitors`
261
262
 
262
263
  ### Find all monitors with No-Data
263
264
 
@@ -42,10 +42,15 @@ module Kennel
42
42
 
43
43
  case resource
44
44
  when "monitor"
45
- # flatten monitor options so they are all on the base
45
+ # flatten monitor options so they are all on the base which is how Monitor builds them
46
46
  data.merge!(data.delete(:options))
47
47
  data.merge!(data.delete(:thresholds) || {})
48
- [:notify_no_data, :notify_audit].each { |k| data.delete(k) if data[k] } # monitor uses true by default
48
+
49
+ # clean up values that are the default
50
+ data.delete(:notify_no_data) if data[:notify_no_data] # Monitor uses true by default
51
+ data.delete(:notify_audit) unless data[:notify_audit] # Monitor uses false by default
52
+
53
+ # keep all values that are settable
49
54
  data = data.slice(*model.instance_methods)
50
55
 
51
56
  # make query use critical method if it matches
@@ -61,6 +66,8 @@ module Kennel
61
66
  widgets&.each { |widget| dry_up_query!(widget) }
62
67
  end
63
68
 
69
+ data.delete(:tags) if data[:tags] == [] # do not create super + [] call
70
+
64
71
  # simplify template_variables to array of string when possible
65
72
  if vars = data[:template_variables]
66
73
  vars.map! { |v| v[:default] == "*" && v[:prefix] == v[:name] ? v[:name] : v }
@@ -18,6 +18,7 @@ module Kennel
18
18
  new_host_delay: 300,
19
19
  timeout_h: 0,
20
20
  renotify_interval: 0,
21
+ notify_audit: false,
21
22
  no_data_timeframe: nil, # this works out ok since if notify_no_data is on, it would never be nil
22
23
  groupby_simple_monitor: false
23
24
  }.freeze
@@ -36,9 +37,9 @@ module Kennel
36
37
  warning: -> { nil },
37
38
  ok: -> { nil },
38
39
  id: -> { nil },
39
- notify_no_data: -> { true },
40
+ notify_no_data: -> { true }, # datadog sets this to false by default, but true is the safer
40
41
  no_data_timeframe: -> { 60 },
41
- notify_audit: -> { true },
42
+ notify_audit: -> { MONITOR_OPTION_DEFAULTS.fetch(:notify_audit) },
42
43
  new_host_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:new_host_delay) },
43
44
  tags: -> { @project.tags },
44
45
  timeout_h: -> { MONITOR_OPTION_DEFAULTS.fetch(:timeout_h) },
@@ -124,10 +124,18 @@ namespace :kennel do
124
124
  Kennel.out.puts Kennel::Importer.new(Kennel.send(:api)).import(resource, id)
125
125
  end
126
126
 
127
- desc "Dump ALL of datadog config as raw json ... useful for grep/search TYPE=slo|monitor|dashboard"
127
+ desc "Dump ALL of datadog config as raw json ... useful for grep/search [TYPE=slo|monitor|dashboard]"
128
128
  task dump: :environment do
129
- Kennel.send(:api).list(ENV.fetch("TYPE")).each do |r|
130
- Kennel.out.puts JSON.pretty_generate(r)
129
+ resources =
130
+ if type = ENV["TYPE"]
131
+ [type]
132
+ else
133
+ Kennel::Models::Record.subclasses.map(&:api_resource)
134
+ end
135
+ resources.each do |resource|
136
+ Kennel.send(:api).list(resource).each do |r|
137
+ Kennel.out.puts JSON.pretty_generate(r)
138
+ end
131
139
  end
132
140
  end
133
141
 
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.75.1"
3
+ VERSION = "1.76.0"
4
4
  end
@@ -239,7 +239,8 @@ Run `rake kennel:alerts TAG=service:my-service` to see all un-muted alerts for a
239
239
 
240
240
  ### Grepping through all of datadog
241
241
 
242
- `TYPE=monitor rake kennel:dump`
242
+ `rake kennel:dump`
243
+ focus on a single type: `TYPE=monitors`
243
244
 
244
245
  ### Find all monitors with No-Data
245
246
 
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kennel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.75.1
4
+ version: 1.76.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2020-07-23 00:00:00.000000000 Z
11
+ date: 2020-08-23 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: faraday