kennel 2.11.0 → 2.12.0
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/models/monitor.rb +20 -8
- data/lib/kennel/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
---
|
|
2
2
|
SHA256:
|
|
3
|
-
metadata.gz:
|
|
4
|
-
data.tar.gz:
|
|
3
|
+
metadata.gz: ef24e36c2feeba08b92edd003e6d11bfefaa31bd0839765393325b29e8132cb3
|
|
4
|
+
data.tar.gz: 54f97c79250c564d62f01837cc85badc4cdc3357860f40e0408d33640d1a94a8
|
|
5
5
|
SHA512:
|
|
6
|
-
metadata.gz:
|
|
7
|
-
data.tar.gz:
|
|
6
|
+
metadata.gz: '08b01acd5c750342d5134e6c2ca6d235bdb5cefc8f0b61b46e7b475ed7be6fd677772bab5a032d2a67685e02389d6741f05ef1e05a0758d3c6f6ff2fae68cb0d'
|
|
7
|
+
data.tar.gz: 79cc9956a1b1790c2e6bfb7f25c981542a2b21d96f8c3d1bdc5328d1e708c410372fa9405bf16a3fbaf7a27aaf1954ca71cb760ae4bfad82fa346b10635b0e8c
|
|
@@ -56,6 +56,7 @@ module Kennel
|
|
|
56
56
|
# datadog UI sets this to false by default, but true is safer
|
|
57
57
|
# except for log alerts which will always have "no error" gaps and should default to false
|
|
58
58
|
notify_no_data: -> { !SKIP_NOTIFY_NO_DATA_TYPES.include?(type) },
|
|
59
|
+
no_data_timeframe: -> { MONITOR_OPTION_DEFAULTS.fetch(:no_data_timeframe) },
|
|
59
60
|
notify_audit: -> { MONITOR_OPTION_DEFAULTS.fetch(:notify_audit) },
|
|
60
61
|
new_host_delay: -> { MONITOR_OPTION_DEFAULTS.fetch(:new_host_delay) },
|
|
61
62
|
new_group_delay: -> { nil },
|
|
@@ -149,16 +150,25 @@ module Kennel
|
|
|
149
150
|
# and enforce that it is not set at the same time as on_missing_data
|
|
150
151
|
def configure_no_data
|
|
151
152
|
notify = notify_no_data
|
|
153
|
+
timeframe = no_data_timeframe
|
|
152
154
|
action = on_missing_data
|
|
155
|
+
action ||= "default" if type == "event-v2 alert"
|
|
153
156
|
|
|
154
|
-
#
|
|
155
|
-
if
|
|
156
|
-
|
|
157
|
+
# TODO: mark setting action && !notify.nil? at all as invalid
|
|
158
|
+
if action && timeframe
|
|
159
|
+
invalid! :invalid_no_data_config, "set either no_data_timeframe or on_missing_data"
|
|
160
|
+
end
|
|
161
|
+
if type == "composite" && action
|
|
162
|
+
invalid! :invalid_no_data_config, "cannot use on_missing_data with composite monitor"
|
|
163
|
+
end
|
|
164
|
+
|
|
165
|
+
# on_missing_data cannot be used with notify_no_data + no_data_timeframe
|
|
166
|
+
if action
|
|
157
167
|
{ on_missing_data: action || "default" }
|
|
158
168
|
else
|
|
159
169
|
{
|
|
160
170
|
notify_no_data: notify,
|
|
161
|
-
no_data_timeframe: notify ? no_data_timeframe : nil
|
|
171
|
+
no_data_timeframe: notify ? no_data_timeframe || default_no_data_timeframe : nil
|
|
162
172
|
}
|
|
163
173
|
end
|
|
164
174
|
end
|
|
@@ -184,7 +194,7 @@ module Kennel
|
|
|
184
194
|
# deprecated this setting is no longer returned by dd for new monitors
|
|
185
195
|
# datadog UI warns when setting no data timeframe to less than 2x the query window
|
|
186
196
|
# limited to 24h because `no_data_timeframe must not exceed group retention` and max group retention is 24h
|
|
187
|
-
def
|
|
197
|
+
def default_no_data_timeframe
|
|
188
198
|
default = 60
|
|
189
199
|
if type == "query alert" && (minutes = query_window_minutes)
|
|
190
200
|
(minutes * 2).clamp(default, 24 * 60)
|
|
@@ -305,9 +315,11 @@ module Kennel
|
|
|
305
315
|
end
|
|
306
316
|
|
|
307
317
|
# verify query includes critical value
|
|
308
|
-
if (
|
|
309
|
-
if
|
|
310
|
-
|
|
318
|
+
if (critical = data.dig(:options, :thresholds, :critical))
|
|
319
|
+
if (query_value = data.fetch(:query)[/\s*[<>]=?\s*(\d+(\.\d+)?)\s*$/, 1])
|
|
320
|
+
if Float(query_value) != Float(critical)
|
|
321
|
+
invalid! :critical_does_not_match_query, "critical and value used in query must match"
|
|
322
|
+
end
|
|
311
323
|
end
|
|
312
324
|
end
|
|
313
325
|
|
data/lib/kennel/version.rb
CHANGED