kennel 1.144.1 → 1.145.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/lib/kennel/models/monitor.rb +5 -14
- 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: ed091ba0fa4fda310e5444a6e01fd21cf03f2b19dee5c7d4b0988a61855ca28e
|
4
|
+
data.tar.gz: 8a720d21972b01c5863722bf56834eccbcaf91ebcd949512142239afa364ec77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: e478b0fea488349ef09f1402f146d5d1383849f292b34fd9575378abdb547d1de00124f9063a0e4dab5f80749470013d22416198db912723cd23e2588ffdf2dc
|
7
|
+
data.tar.gz: f64c88e17f5b1e016c8e8503b9e098bdaf56167b5d9084c4245199bad52fd142253b9f672647597fb24c0dd4b798c1382f9b45eeaaf1cdc76c4cc04fdeb70956
|
@@ -4,7 +4,6 @@ module Kennel
|
|
4
4
|
class Monitor < Record
|
5
5
|
include TagsValidation
|
6
6
|
|
7
|
-
RENOTIFY_INTERVALS = [0, 10, 20, 30, 40, 50, 60, 90, 120, 180, 240, 300, 360, 720, 1440].freeze # minutes
|
8
7
|
OPTIONAL_SERVICE_CHECK_THRESHOLDS = [:ok, :warning].freeze
|
9
8
|
READONLY_ATTRIBUTES = superclass::READONLY_ATTRIBUTES + [
|
10
9
|
:multi, :matching_downtimes, :overall_state_modified, :overall_state, :restricted_roles
|
@@ -61,7 +60,8 @@ module Kennel
|
|
61
60
|
variables: -> { MONITOR_OPTION_DEFAULTS.fetch(:variables) },
|
62
61
|
on_missing_data: -> { MONITOR_OPTION_DEFAULTS.fetch(:on_missing_data) },
|
63
62
|
notification_preset_name: -> { MONITOR_OPTION_DEFAULTS.fetch(:notification_preset_name) },
|
64
|
-
notify_by: -> { MONITOR_OPTION_DEFAULTS.fetch(:notify_by) }
|
63
|
+
notify_by: -> { MONITOR_OPTION_DEFAULTS.fetch(:notify_by) },
|
64
|
+
require_full_window: -> { false }
|
65
65
|
)
|
66
66
|
|
67
67
|
def build_json
|
@@ -206,7 +206,7 @@ module Kennel
|
|
206
206
|
# fields are not returned when set to true
|
207
207
|
if ["service check", "event alert"].include?(actual[:type])
|
208
208
|
options[:include_tags] = true unless options.key?(:include_tags)
|
209
|
-
options[:require_full_window] =
|
209
|
+
options[:require_full_window] = false unless options.key?(:require_full_window)
|
210
210
|
end
|
211
211
|
|
212
212
|
case actual[:type]
|
@@ -219,6 +219,7 @@ module Kennel
|
|
219
219
|
OPTIONAL_SERVICE_CHECK_THRESHOLDS.each do |t|
|
220
220
|
options[:thresholds][t] ||= 1
|
221
221
|
end
|
222
|
+
else # do nothing
|
222
223
|
end
|
223
224
|
|
224
225
|
# nil / "" / 0 are not returned from the api when set via the UI
|
@@ -234,12 +235,6 @@ module Kennel
|
|
234
235
|
|
235
236
|
private
|
236
237
|
|
237
|
-
def require_full_window
|
238
|
-
# default 'on_average', 'at_all_times', 'in_total' aggregations to true, otherwise false
|
239
|
-
# https://docs.datadoghq.com/ap/#create-a-monitor
|
240
|
-
type != "query alert" || query.start_with?("avg", "min", "sum")
|
241
|
-
end
|
242
|
-
|
243
238
|
def validate_json(data)
|
244
239
|
super
|
245
240
|
|
@@ -261,11 +256,6 @@ module Kennel
|
|
261
256
|
end
|
262
257
|
end
|
263
258
|
|
264
|
-
# verify renotify interval is valid
|
265
|
-
unless RENOTIFY_INTERVALS.include? data.dig(:options, :renotify_interval)
|
266
|
-
invalid! :invalid_renotify_interval, "renotify_interval must be one of #{RENOTIFY_INTERVALS.join(", ")}"
|
267
|
-
end
|
268
|
-
|
269
259
|
if ["query alert", "service check"].include?(type) # TODO: most likely more types need this
|
270
260
|
validate_message_variables(data)
|
271
261
|
end
|
@@ -364,6 +354,7 @@ module Kennel
|
|
364
354
|
"Warning threshold (#{warning}) must be less than the alert threshold (#{critical}) with > comparison"
|
365
355
|
)
|
366
356
|
end
|
357
|
+
else # do nothing
|
367
358
|
end
|
368
359
|
end
|
369
360
|
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.145.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: 2023-
|
11
|
+
date: 2023-10-03 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: diff-lcs
|