kennel 1.27.3 → 1.28.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/Readme.md +1 -0
- data/lib/kennel/models/base.rb +16 -6
- data/lib/kennel/models/monitor.rb +0 -1
- data/lib/kennel/version.rb +1 -1
- data/template/Readme.md +1 -0
- 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: 839ed976a8811de64729eb9c011c7a52b6495aa229dc836da17927ea850c48ab
|
4
|
+
data.tar.gz: 85974f47c3060dd451d3e34c9c43392e49fcc5b553751f57549320dab77e8ae5
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: a8e84ef685a62a24528f52c29defe99c12ffe61770a3233bd03e43acbe0a7601b7ce3b123bb0b425d611f4d45f506d9086a5c4c64728698838b147f1f7cd89f0
|
7
|
+
data.tar.gz: 58a4a25124dbfc0e197cf3732672b991f7ea34370b99465e2ee18a063c5ab9c9006a3ff41ae74703575b82ce1bbf38c3fc8c785b4d1730ff9bbfa74a829eb663
|
data/Readme.md
CHANGED
@@ -198,6 +198,7 @@ module Monitors
|
|
198
198
|
defaults(
|
199
199
|
name: -> { "#{project.name} load too high" },
|
200
200
|
message: -> { "Shut it down!" },
|
201
|
+
type: -> { "query alert" },
|
201
202
|
query: -> { "avg(last_5m):avg:system.load.5{hostgroup:#{project.kennel_id}} by {pod} > #{critical}" }
|
202
203
|
)
|
203
204
|
end
|
data/lib/kennel/models/base.rb
CHANGED
@@ -31,7 +31,8 @@ module Kennel
|
|
31
31
|
names.each do |name|
|
32
32
|
next if method_defined?(name)
|
33
33
|
define_method name do
|
34
|
-
|
34
|
+
message = "Trying to call #{name} for #{self.class} but it was never set or passed as option"
|
35
|
+
raise_with_location ArgumentError, message
|
35
36
|
end
|
36
37
|
end
|
37
38
|
end
|
@@ -96,16 +97,18 @@ module Kennel
|
|
96
97
|
end
|
97
98
|
|
98
99
|
# need expand_path so it works wih rake and when run individually
|
99
|
-
|
100
|
+
pwd = /^#{Regexp.escape(Dir.pwd)}\//
|
101
|
+
@invocation_location = caller.detect do |l|
|
102
|
+
if found = File.expand_path(l).sub!(pwd, "")
|
103
|
+
break found
|
104
|
+
end
|
105
|
+
end
|
100
106
|
end
|
101
107
|
|
102
108
|
def kennel_id
|
103
109
|
name = self.class.name
|
104
110
|
if name.start_with?("Kennel::")
|
105
|
-
|
106
|
-
message << " for project #{project.kennel_id}" if defined?(project)
|
107
|
-
message << " on #{@invocation_location}" if @invocation_location
|
108
|
-
raise ArgumentError, message
|
111
|
+
raise_with_location ArgumentError, "Set :kennel_id"
|
109
112
|
end
|
110
113
|
@kennel_id ||= Utils.snake_case name
|
111
114
|
end
|
@@ -141,6 +144,13 @@ module Kennel
|
|
141
144
|
raise ValidationError, "#{tracking_id} #{message}"
|
142
145
|
end
|
143
146
|
|
147
|
+
def raise_with_location(error, message)
|
148
|
+
message = message.dup
|
149
|
+
message << " for project #{project.kennel_id}" if defined?(project)
|
150
|
+
message << " on #{@invocation_location}" if @invocation_location
|
151
|
+
raise error, message
|
152
|
+
end
|
153
|
+
|
144
154
|
def validate_options(options)
|
145
155
|
unless options.is_a?(Hash)
|
146
156
|
raise ArgumentError, "Expected #{self.class.name}.new options to be a Hash, got a #{options.class}"
|
data/lib/kennel/version.rb
CHANGED
data/template/Readme.md
CHANGED
@@ -180,6 +180,7 @@ module Monitors
|
|
180
180
|
defaults(
|
181
181
|
name: -> { "#{project.name} load too high" },
|
182
182
|
message: -> { "Shut it down!" },
|
183
|
+
type: -> { "query alert" },
|
183
184
|
query: -> { "avg(last_5m):avg:system.load.5{hostgroup:#{project.kennel_id}} by {pod} > #{critical}" }
|
184
185
|
)
|
185
186
|
end
|
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.28.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:
|
11
|
+
date: 2019-01-06 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: faraday
|