kennel 1.14.0 → 1.15.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 +3 -2
- data/lib/kennel/unmuted_alerts.rb +10 -1
- data/lib/kennel/utils.rb +3 -2
- 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: 203db588fb0b4a3297898e2e86fc2905ffcdb787b653a95b7a4c4ed81bfed6c2
|
4
|
+
data.tar.gz: '082e2d0d9e73c6753ecdae3fa2d81c0938afb0884ac82ebd1a6365d2a4166f42'
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 582eb3d3391750263d0fb595778a72f17e626bee11c720b7ee13303be7f197e03a0bd1d0e5b93ab2dbb48074017f460518ba58278131a5136a77ecf4ec72f157
|
7
|
+
data.tar.gz: d2dfbfd993fc9b44349f88a095967eaa8ae299b7ccd6498e8c5488947477845faecbea82a25c5cd797d38be1af88ad48d8b8faa28ee8b3df962d18045480fbcf
|
@@ -11,7 +11,7 @@ module Kennel
|
|
11
11
|
NON_MULTI_TYPES = ["query alert", "log alert"].freeze # NOTE: event alerts don't seem to return their multi setting
|
12
12
|
|
13
13
|
settings(
|
14
|
-
:query, :name, :message, :escalation_message, :critical, :kennel_id, :type, :renotify_interval, :warning,
|
14
|
+
:query, :name, :message, :escalation_message, :critical, :kennel_id, :type, :renotify_interval, :warning, :timeout_h,
|
15
15
|
:ok, :id, :no_data_timeframe, :notify_no_data, :notify_audit, :tags, :multi, :critical_recovery, :warning_recovery, :require_full_window
|
16
16
|
)
|
17
17
|
defaults(
|
@@ -26,6 +26,7 @@ module Kennel
|
|
26
26
|
no_data_timeframe: -> { notify_no_data ? 60 : nil },
|
27
27
|
notify_audit: -> { true },
|
28
28
|
tags: -> { @project.tags },
|
29
|
+
timeout_h: -> { 0 },
|
29
30
|
multi: -> { !NON_MULTI_TYPES.include?(type) || query.include?(" by ") },
|
30
31
|
critical_recovery: -> { nil },
|
31
32
|
warning_recovery: -> { nil }
|
@@ -48,7 +49,7 @@ module Kennel
|
|
48
49
|
tags: tags,
|
49
50
|
multi: multi,
|
50
51
|
options: {
|
51
|
-
timeout_h:
|
52
|
+
timeout_h: timeout_h,
|
52
53
|
notify_no_data: notify_no_data,
|
53
54
|
no_data_timeframe: no_data_timeframe,
|
54
55
|
notify_audit: notify_audit,
|
@@ -4,6 +4,12 @@ require "kennel"
|
|
4
4
|
# Show Alerts that are not muted and their alerting scopes
|
5
5
|
module Kennel
|
6
6
|
class UnmutedAlerts
|
7
|
+
COLORS = {
|
8
|
+
"Alert" => :red,
|
9
|
+
"Warn" => :yellow,
|
10
|
+
"No Data" => :cyan
|
11
|
+
}.freeze
|
12
|
+
|
7
13
|
class << self
|
8
14
|
def print(api, tag)
|
9
15
|
monitors = filtered_monitors(api, tag)
|
@@ -13,7 +19,10 @@ module Kennel
|
|
13
19
|
monitors.each do |m|
|
14
20
|
puts m[:name]
|
15
21
|
puts Utils.path_to_url("/monitors/#{m[:id]}")
|
16
|
-
m[:state][:groups].each
|
22
|
+
m[:state][:groups].each do |g|
|
23
|
+
color = COLORS[g[:status]] || :default
|
24
|
+
puts "#{Kennel::Utils.color(color, g[:status])}\t#{g[:name]}"
|
25
|
+
end
|
17
26
|
puts
|
18
27
|
end
|
19
28
|
end
|
data/lib/kennel/utils.rb
CHANGED
@@ -1,6 +1,8 @@
|
|
1
1
|
# frozen_string_literal: true
|
2
2
|
module Kennel
|
3
3
|
module Utils
|
4
|
+
COLORS = { red: 31, green: 32, yellow: 33, cyan: 36, default: 0 }.freeze
|
5
|
+
|
4
6
|
class TeeIO < IO
|
5
7
|
def initialize(ios)
|
6
8
|
@ios = ios
|
@@ -34,8 +36,7 @@ module Kennel
|
|
34
36
|
end
|
35
37
|
|
36
38
|
def color(color, text)
|
37
|
-
|
38
|
-
"\e[#{code}m#{text}\e[0m"
|
39
|
+
"\e[#{COLORS.fetch(color)}m#{text}\e[0m"
|
39
40
|
end
|
40
41
|
|
41
42
|
def strip_shell_control(text)
|
data/lib/kennel/version.rb
CHANGED