kennel 1.83.0 → 1.85.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/kennel/importer.rb +3 -0
- data/lib/kennel/models/dashboard.rb +5 -2
- data/lib/kennel/models/monitor.rb +0 -10
- data/lib/kennel/tasks.rb +3 -1
- data/lib/kennel/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: 80ab3a8fb786a4b556aa1318d3b1ab758a9b7d33e786023c02550ee004abd6e8
|
|
4
|
+
data.tar.gz: 0e5896d464686e750a3973feff199f25030cea119c7ccb03ddc9820a359f0c74
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: a5df094d658262ddb50a40234be1f371ebd9120ed66a0a625d68a7ec8debde55980ccc8e2c64e84afbdc16160228700c8361108b526f54ca68403e12318f8a19
|
|
7
|
+
data.tar.gz: cb924336b3e9caac886fbc60ffc0301500a6dd59f9af53c42d1c7ac13ad5891765165b28fa7da36751da64491ca8e5070e1e1ce047830e8cb3b78363e9e2da4d
|
data/lib/kennel/importer.rb
CHANGED
|
@@ -60,6 +60,9 @@ module Kennel
|
|
|
60
60
|
query.sub!(/([><=]) (#{Regexp.escape(critical.to_f.to_s)}|#{Regexp.escape(critical.to_i.to_s)})$/, "\\1 \#{critical}")
|
|
61
61
|
end
|
|
62
62
|
|
|
63
|
+
# using float in query is not allowed, so convert here
|
|
64
|
+
data[:critical] = data[:critical].to_i if data[:type] == "event alert"
|
|
65
|
+
|
|
63
66
|
data[:type] = "query alert" if data[:type] == "metric alert"
|
|
64
67
|
when "dashboard"
|
|
65
68
|
widgets = data[:widgets]&.flat_map { |widget| widget.dig(:definition, :widgets) || [widget] }
|
|
@@ -5,7 +5,6 @@ module Kennel
|
|
|
5
5
|
include TemplateVariables
|
|
6
6
|
include OptionalValidations
|
|
7
7
|
|
|
8
|
-
DASHBOARD_DEFAULTS = { template_variables: [] }.freeze
|
|
9
8
|
READONLY_ATTRIBUTES = superclass::READONLY_ATTRIBUTES + [
|
|
10
9
|
:author_handle, :author_name, :modified_at, :url, :is_read_only, :notify_list
|
|
11
10
|
]
|
|
@@ -22,13 +21,14 @@ module Kennel
|
|
|
22
21
|
template_variable_presets: nil
|
|
23
22
|
}.freeze
|
|
24
23
|
|
|
25
|
-
settings :title, :description, :definitions, :widgets, :layout_type, :template_variable_presets
|
|
24
|
+
settings :title, :description, :definitions, :widgets, :layout_type, :template_variable_presets, :reflow_type
|
|
26
25
|
|
|
27
26
|
defaults(
|
|
28
27
|
description: -> { "" },
|
|
29
28
|
definitions: -> { [] },
|
|
30
29
|
widgets: -> { [] },
|
|
31
30
|
template_variable_presets: -> { DEFAULTS.fetch(:template_variable_presets) },
|
|
31
|
+
reflow_type: -> { layout_type == "ordered" ? "auto" : nil },
|
|
32
32
|
id: -> { nil }
|
|
33
33
|
)
|
|
34
34
|
|
|
@@ -41,6 +41,7 @@ module Kennel
|
|
|
41
41
|
super
|
|
42
42
|
|
|
43
43
|
ignore_default(expected, actual, DEFAULTS)
|
|
44
|
+
ignore_default(expected, actual, reflow_type: "auto") if expected[:layout_type] == "ordered"
|
|
44
45
|
|
|
45
46
|
widgets_pairs(expected, actual).each do |pair|
|
|
46
47
|
# conditional_formats ordering is randomly changed by datadog, compare a stable ordering
|
|
@@ -116,6 +117,8 @@ module Kennel
|
|
|
116
117
|
widgets: all_widgets
|
|
117
118
|
}
|
|
118
119
|
|
|
120
|
+
@json[:reflow_type] = reflow_type if reflow_type # setting nil breaks create with "ordered"
|
|
121
|
+
|
|
119
122
|
@json[:id] = id if id
|
|
120
123
|
|
|
121
124
|
validate_json(@json) if validate
|
|
@@ -5,8 +5,6 @@ module Kennel
|
|
|
5
5
|
include OptionalValidations
|
|
6
6
|
|
|
7
7
|
RENOTIFY_INTERVALS = [0, 10, 20, 30, 40, 50, 60, 90, 120, 180, 240, 300, 360, 720, 1440].freeze # minutes
|
|
8
|
-
# 2d and 1w are valid timeframes for anomaly monitors
|
|
9
|
-
QUERY_INTERVALS = ["1m", "5m", "10m", "15m", "30m", "1h", "2h", "4h", "1d", "2d", "1w"].freeze
|
|
10
8
|
OPTIONAL_SERVICE_CHECK_THRESHOLDS = [:ok, :warning].freeze
|
|
11
9
|
READONLY_ATTRIBUTES = superclass::READONLY_ATTRIBUTES + [
|
|
12
10
|
:multi, :matching_downtimes, :overall_state_modified, :overall_state, :restricted_roles
|
|
@@ -202,14 +200,6 @@ module Kennel
|
|
|
202
200
|
invalid! "renotify_interval must be one of #{RENOTIFY_INTERVALS.join(", ")}"
|
|
203
201
|
end
|
|
204
202
|
|
|
205
|
-
if type == "query alert"
|
|
206
|
-
# verify interval is valid
|
|
207
|
-
interval = data.fetch(:query)[/\(last_(\S+?)\)/, 1]
|
|
208
|
-
if interval && !QUERY_INTERVALS.include?(interval)
|
|
209
|
-
invalid! "query interval was #{interval}, but must be one of #{QUERY_INTERVALS.join(", ")}"
|
|
210
|
-
end
|
|
211
|
-
end
|
|
212
|
-
|
|
213
203
|
if ["query alert", "service check"].include?(type) # TODO: most likely more types need this
|
|
214
204
|
# verify is_match/is_exact_match uses available variables
|
|
215
205
|
message = data.fetch(:message)
|
data/lib/kennel/tasks.rb
CHANGED
|
@@ -158,7 +158,9 @@ namespace :kennel do
|
|
|
158
158
|
found.each do |resource|
|
|
159
159
|
if ENV["URLS"]
|
|
160
160
|
parsed = JSON.parse(resource)
|
|
161
|
-
|
|
161
|
+
url = models[parsed.fetch("api_resource")].url(parsed.fetch("id"))
|
|
162
|
+
title = parsed["title"] || parsed["name"]
|
|
163
|
+
Kennel.out.puts "#{url} # #{title}"
|
|
162
164
|
else
|
|
163
165
|
Kennel.out.puts resource
|
|
164
166
|
end
|
data/lib/kennel/version.rb
CHANGED
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.
|
|
4
|
+
version: 1.85.2
|
|
5
5
|
platform: ruby
|
|
6
6
|
authors:
|
|
7
7
|
- Michael Grosser
|
|
8
8
|
autorequire:
|
|
9
9
|
bindir: bin
|
|
10
10
|
cert_chain: []
|
|
11
|
-
date: 2021-
|
|
11
|
+
date: 2021-04-17 00:00:00.000000000 Z
|
|
12
12
|
dependencies:
|
|
13
13
|
- !ruby/object:Gem::Dependency
|
|
14
14
|
name: faraday
|