grafana-rb 0.11.0 → 0.12.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/CHANGELOG.md +4 -0
- data/lib/grafana-rb/cli.rb +10 -4
- data/lib/grafana-rb/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: 8d628d0e4ba67c8c1bb2242a292953d6edf67107
|
4
|
+
data.tar.gz: d646b0be5c8373b9b76b9d52bdab9bed79ea27f7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b4a13c8f56a580b0337d8407b48e3d68773a22972639f5c1683ed4ad676ec050c22cc0b46807e18ba16839a1bbbf0bac73b6975ce1d0effce64b5ec1c3d3785e
|
7
|
+
data.tar.gz: 4f7aea50f71487907cb68cc801e0b5e3770c8c2ef9ff7b746c32dcf67edb40f6954368cbd195bc78d93c95343cd1ee4b06849aa25cde9f5e5222a764b570fbf8
|
data/CHANGELOG.md
CHANGED
data/lib/grafana-rb/cli.rb
CHANGED
@@ -54,7 +54,12 @@ module GrafanaRb
|
|
54
54
|
req.body = params.to_json
|
55
55
|
end
|
56
56
|
req.basic_auth grafana_user, grafana_password
|
57
|
-
|
57
|
+
body = http.request(req).body
|
58
|
+
begin
|
59
|
+
JSON.load(body)
|
60
|
+
rescue
|
61
|
+
body
|
62
|
+
end
|
58
63
|
end
|
59
64
|
|
60
65
|
def die(msg = nil)
|
@@ -68,7 +73,7 @@ module GrafanaRb
|
|
68
73
|
|
69
74
|
def check_config_existance
|
70
75
|
unless File.exists?(config_file)
|
71
|
-
puts "FATAL: missed #{config_file} in
|
76
|
+
puts "FATAL: missed #{config_file} in working directory"
|
72
77
|
puts "#{config_file} example:"
|
73
78
|
puts ""
|
74
79
|
puts "---"
|
@@ -276,6 +281,7 @@ module GrafanaRb
|
|
276
281
|
def create_or_update_dashboard(config)
|
277
282
|
editable = config.delete("editable") { true }
|
278
283
|
duration = config.delete("duration") { "30m" }
|
284
|
+
refresh = config.delete("refresh") { "10s" }
|
279
285
|
name = config.delete("name")
|
280
286
|
puts "create/update dashboard '#{name}'"
|
281
287
|
|
@@ -295,7 +301,7 @@ module GrafanaRb
|
|
295
301
|
tags: [TAG],
|
296
302
|
editable: editable,
|
297
303
|
time: {from: "now-#{duration}", to: "now"},
|
298
|
-
refresh:
|
304
|
+
refresh: refresh,
|
299
305
|
rows: rows
|
300
306
|
},
|
301
307
|
overwrite: true
|
@@ -321,7 +327,7 @@ module GrafanaRb
|
|
321
327
|
die("missed grafana_url variable") unless config["grafana_url"]
|
322
328
|
die("missed prometheus_url variable") unless config["prometheus_url"]
|
323
329
|
|
324
|
-
tool_version = config["
|
330
|
+
tool_version = config["tool_version"] || GrafanaRb::VERSION
|
325
331
|
if compare_versions(tool_version, GrafanaRb::VERSION) > 0
|
326
332
|
puts "FATAL: need at least '#{tool_version}' tool version but current version is '#{GrafanaRb::VERSION}'"
|
327
333
|
exit -1
|
data/lib/grafana-rb/version.rb
CHANGED