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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 8cda7076e55a2d8b8d90e6112bed1573db8074c4dd85bf1ca4df4c409e9b6718
4
- data.tar.gz: 2e081e9e843bd0c352d1e81dde8feb380d9866d8cf0a80f025f2432b656e844b
3
+ metadata.gz: 203db588fb0b4a3297898e2e86fc2905ffcdb787b653a95b7a4c4ed81bfed6c2
4
+ data.tar.gz: '082e2d0d9e73c6753ecdae3fa2d81c0938afb0884ac82ebd1a6365d2a4166f42'
5
5
  SHA512:
6
- metadata.gz: ed7068f93ca8dc3ec3a9c6138710324032c70dae4e27cdd260f3976b6181c7d4ea281c105cacc18211b2d69feccc0461b76180d3503fc9a60aa92883f8b9a07c
7
- data.tar.gz: a23491d09e81ff7ce8cb82d01522fe46a55bb851cd9300c8a6facbc788658d641cae1c8f678a80783f0f186a9ed0422b1f07c4958a2d61e317342245bbb809d0
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: 0,
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 { |g| puts "#{g[:status]}\t#{g[:name]}" }
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
- code = { red: 31, green: 32, yellow: 33 }.fetch(color)
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)
@@ -1,4 +1,4 @@
1
1
  # frozen_string_literal: true
2
2
  module Kennel
3
- VERSION = "1.14.0"
3
+ VERSION = "1.15.0"
4
4
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: kennel
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.14.0
4
+ version: 1.15.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Michael Grosser