lbrt 0.1.5 → 0.1.6
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/README.md +25 -0
- data/lib/lbrt/utils.rb +4 -1
- data/lib/lbrt/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 4d03d5b56552be94562b237b4fa6b3b7bf728752
|
4
|
+
data.tar.gz: 42d9b29379fa6c2c417f2586129d3cef61255dcf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 4d7673a015e2f65b429bf6b212a0ea4dec840b5d36daf86f00f8e7fd61860c1a4877f661036aeae7472529261bf503e771bec0fc86b00126f079fd22b8fa1dab
|
7
|
+
data.tar.gz: aaba95b5b57a80243342ae91d31dce8d9da6137b44a02bf85a7e04a1997e25ff3d6af681e0f0610618e1062006562dd801f84b484aa6c672f237c416bdc2450f
|
data/README.md
CHANGED
@@ -233,6 +233,31 @@ end
|
|
233
233
|
|
234
234
|
You can use the template in the `alert` and `service`.
|
235
235
|
|
236
|
+
```ruby
|
237
|
+
template "my alert" do
|
238
|
+
alert context.metric_name do
|
239
|
+
description "desc"
|
240
|
+
attributes "runbook_url"=>"http://url.com"
|
241
|
+
active true
|
242
|
+
rearm_seconds 600
|
243
|
+
rearm_per_signal false
|
244
|
+
|
245
|
+
condition do
|
246
|
+
type "below"
|
247
|
+
metric_name context.metric_name
|
248
|
+
source nil
|
249
|
+
threshold 4.0
|
250
|
+
summary_function "sum"
|
251
|
+
end
|
252
|
+
|
253
|
+
service "mail", "my email"
|
254
|
+
end
|
255
|
+
end
|
256
|
+
|
257
|
+
include_template "my alert", metric_name: 'login-delay'
|
258
|
+
include_template "my alert", metric_name: 'login-delay2'
|
259
|
+
```
|
260
|
+
|
236
261
|
## Show resource by [peco](https://github.com/peco/peco)
|
237
262
|
|
238
263
|
```sh
|
data/lib/lbrt/utils.rb
CHANGED
@@ -40,14 +40,17 @@ class Lbrt::Utils
|
|
40
40
|
end
|
41
41
|
|
42
42
|
module TemplateHelper
|
43
|
-
def include_template(template_name)
|
43
|
+
def include_template(template_name, context = {})
|
44
44
|
tmplt = @context.templates[template_name.to_s]
|
45
45
|
|
46
46
|
unless tmplt
|
47
47
|
raise "Template `#{template_name}` is not defined"
|
48
48
|
end
|
49
49
|
|
50
|
+
context_orig = @context
|
51
|
+
@context = @context.merge(context)
|
50
52
|
instance_eval(&tmplt)
|
53
|
+
@context = context_orig
|
51
54
|
end
|
52
55
|
end
|
53
56
|
|
data/lib/lbrt/version.rb
CHANGED