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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 3156ec2300608d7d5823033df58876cdf87ed54e
4
- data.tar.gz: b4a2f11146e868cb6499d7ae954ae05f2ba0c9d7
3
+ metadata.gz: 8d628d0e4ba67c8c1bb2242a292953d6edf67107
4
+ data.tar.gz: d646b0be5c8373b9b76b9d52bdab9bed79ea27f7
5
5
  SHA512:
6
- metadata.gz: a640c8ebbf28899e98017853f94168deaaaf9890d4267344b8cdd06043c38b8bda991ecc9ff9267742fb7be2d8ebfbeacc8a2babdd773299c8c16d941a196ffc
7
- data.tar.gz: 5486cd0110270a11c408f6a1b26f8805b9ee1181f9f0c2a88ddf030ed6a4a949436e5fd3aec13eb352464110c4e8f36d825833183639501b9162248036eef740
6
+ metadata.gz: b4a13c8f56a580b0337d8407b48e3d68773a22972639f5c1683ed4ad676ec050c22cc0b46807e18ba16839a1bbbf0bac73b6975ce1d0effce64b5ec1c3d3785e
7
+ data.tar.gz: 4f7aea50f71487907cb68cc801e0b5e3770c8c2ef9ff7b746c32dcf67edb40f6954368cbd195bc78d93c95343cd1ee4b06849aa25cde9f5e5222a764b570fbf8
data/CHANGELOG.md CHANGED
@@ -1,3 +1,7 @@
1
+ ## Grafana-rb 0.12.0 (April 6, 2017) ##
2
+
3
+ * Add optional `refresh` param.
4
+
1
5
  ## Grafana-rb 0.11.0 (April 6, 2017) ##
2
6
 
3
7
  * Add `tool_version` param to check minimum version
@@ -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
- JSON.load(http.request(req).body)
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 current directory"
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: "10s",
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["version"] || GrafanaRb::VERSION
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
@@ -1,3 +1,3 @@
1
1
  module GrafanaRb
2
- VERSION = "0.11.0"
2
+ VERSION = "0.12.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grafana-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.11.0
4
+ version: 0.12.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Vakhov