grafana-rb 0.8.0 → 0.9.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: 76ba0cc373c164181ad699023c7b2dc06ae8060b
4
- data.tar.gz: a34d6f198d4313d645394ac0cad4fd1fa8d5c1d0
3
+ metadata.gz: ed6f37739b1b549ed60776672d2bc2ec420c74c7
4
+ data.tar.gz: f50ab5d2667dfb7dc8e8c1f966e5734a74ffea49
5
5
  SHA512:
6
- metadata.gz: 165d7b33f2618dff662a774513fb95da721995ff1ecc1c39f544dcdeb43fb0bad55bc58c19372fe86ccebe2f00c54946d7b1ac9f093a2b2fbc70153889640f56
7
- data.tar.gz: 6ae2d9a3e5f6f51d2b434075a39151085f138f442130d53718386430cce6a951986199d763eddb667a37ca6c5a8f58d81c0f5678a7a13fa9c44d559efe4d3a21
6
+ metadata.gz: 6dcab643e6a69411fc8380b014634fc1325628ee37aa0c27ac28fdaba86cdd17613d4c14f4db0deee503abac2005098f895b6e8274d9fb94a443dbbec77ab48d
7
+ data.tar.gz: 42cd0ce220d5fc7a89d3945657f2bf25867273b613927bc89bd723afa5b8a9aa4d801dc5bf6ea5fa9609a206afe291ee0847d64628de41bf06d970af28a42768
data/.travis.yml CHANGED
@@ -3,3 +3,9 @@ language: ruby
3
3
  rvm:
4
4
  - 2.3.2
5
5
  before_install: gem install bundler -v 1.14.3
6
+ notifications:
7
+ email:
8
+ recipients:
9
+ - vakhov@gmail.com
10
+ on_success: never
11
+ on_failure: always
data/CHANGELOG.md CHANGED
@@ -1,3 +1,8 @@
1
+ ## Grafana-rb 0.9.0 (March 11, 2017) ##
2
+
3
+ * Rename `run` command into `apply`.
4
+ * Add examples.
5
+
1
6
  ## Grafana-rb 0.8.0 (March 6, 2017) ##
2
7
 
3
8
  * [defect] Fix cli running from gem (maybe).
data/README.md CHANGED
@@ -2,41 +2,29 @@
2
2
 
3
3
  Configure grafana dashboards using simple yml-notation.
4
4
 
5
- [![Build Status](https://travis-ci.org/uchiru/grafana-rb.svg?branch=master)](https://travis-ci.org/uchiru/grafana-rb)
6
- [![Gem Version](https://badge.fury.io/rb/grafana-rb.svg)](https://badge.fury.io/rb/grafana-rb)
5
+ [![Build Status](https://img.shields.io/travis/uchiru/grafana-rb/master.svg)]()
6
+ [![Gem Version](https://img.shields.io/gem/v/grafana-rb.svg)]()
7
7
 
8
- ## Installation
9
-
10
- Add this line to your application's Gemfile:
8
+ **Note:** work only with prometheus datasource now!
11
9
 
12
- ```ruby
13
- gem 'grafana-rb'
14
- ```
10
+ Scripts from [examples](examples) directory generate such nice dashboard:
15
11
 
16
- And then execute:
12
+ <img src="examples/dash.png">
17
13
 
18
- $ bundle
14
+ ## Installation
19
15
 
20
- Or install it yourself as:
16
+ Install last gem version as:
21
17
 
22
18
  $ gem install grafana-rb
23
19
 
24
20
  ## Usage
25
21
 
26
- TODO: Write usage instructions here
27
-
28
- ## Development
29
-
30
- After checking out the repo, run `bin/setup` to install dependencies. Then, run `rake spec` to run the tests. You can also run `bin/console` for an interactive prompt that will allow you to experiment.
31
-
32
- To install this gem onto your local machine, run `bundle exec rake install`. To release a new version, update the version number in `version.rb`, and then run `bundle exec rake release`, which will create a git tag for the version, push git commits and tags, and push the `.gem` file to [rubygems.org](https://rubygems.org).
22
+ Fire `grafana-rb run` to create/upload grafana dashboards.
33
23
 
34
24
  ## Contributing
35
25
 
36
26
  Bug reports and pull requests are welcome on GitHub at https://github.com/uchiru/grafana-rb.
37
27
 
38
-
39
28
  ## License
40
29
 
41
30
  The gem is available as open source under the terms of the [MIT License](http://opensource.org/licenses/MIT).
42
-
data/examples/dash.png ADDED
Binary file
@@ -0,0 +1,3 @@
1
+ ---
2
+ grafana_url: monitoring.my-company.com:3000
3
+ prometheus_url: monitoring.my-company.com:9090
data/examples/main.yml ADDED
@@ -0,0 +1,82 @@
1
+ ---
2
+ editable: false
3
+
4
+ alerts:
5
+ height: 100
6
+ panels:
7
+ - type: alert
8
+ title: "Root disk used %"
9
+ max: 100
10
+ expr: '(node_filesystem_size{mountpoint="/"} - node_filesystem_avail{mountpoint="/"})/node_filesystem_size{mountpoint="/"}*100 > 90)'
11
+ - type: alert
12
+ title: "Availability"
13
+ max: 2
14
+ expr: 'up < 0.5'
15
+ - type: alert
16
+ title: "CPU"
17
+ max: 100
18
+ expr: '100 - (avg by (instance)(rate(node_cpu{mode="idle"}[5m]))*100) > 85'
19
+ - type: alert
20
+ title: "Used Memory, %"
21
+ max: 100
22
+ expr: '(node_memory_MemTotal - node_memory_Cached - node_memory_Buffers - node_memory_MemFree)/node_memory_MemTotal*100 > 80'
23
+
24
+ balancer:
25
+ height: 150
26
+ panels:
27
+ - type: custom
28
+ title: "Out (eth1)"
29
+ format: "Bps"
30
+ expr: 'rate(node_network_transmit_bytes{device="eth1",job="balancer"}[1m])'
31
+ - type: custom
32
+ title: "In (eth1)"
33
+ format: "Bps"
34
+ expr: 'rate(node_network_receive_bytes{device="eth1",job="balancer"}[1m])'
35
+ - type: custom
36
+ title: "eth1"
37
+ format: "Bps"
38
+ fill: 8
39
+ stack: true
40
+ exprs:
41
+ - {expr: 'sum(rate(node_network_transmit_bytes{device="eth1",job="balancer"}[1m]))', title: "Out"}
42
+ - {expr: 'sum(rate(node_network_receive_bytes{device="eth1",job="balancer"}[1m]))', title: "In"}
43
+ - type: custom
44
+ title: "Requests"
45
+ format: "ops"
46
+ expr: 'sum by (instance)(rate(http_requests_total{job="balancer"}[1m]))'
47
+ - type: custom
48
+ title: "Requests"
49
+ format: "ops"
50
+ fill: 8
51
+ stack: true
52
+ exprs:
53
+ - {expr: 'sum(rate(http_requests_total{code="500",job="balancer"}[1m]))', title: "500", color: red}
54
+ - {expr: 'sum(rate(http_requests_total{code="404",job="balancer"}[1m]))', title: "404"}
55
+ - {expr: 'sum(rate(http_requests_total{code="302",job="balancer"}[1m]))', title: "302"}
56
+ - {expr: 'sum(rate(http_requests_total{code="200",job="balancer"}[1m]))', title: "200"}
57
+
58
+ front:
59
+ height: 150
60
+ panels:
61
+ - type: custom
62
+ title: "Requests"
63
+ format: "ops"
64
+ expr: 'sum by (instance)(rate(http_requests_total{job="front"}[1m]))'
65
+ - type: custom
66
+ title: "Requests"
67
+ format: "ops"
68
+ fill: 8
69
+ stack: true
70
+ exprs:
71
+ - {expr: 'sum(rate(http_requests_total{code="500",job="front"}[1m]))', title: "500", color: red}
72
+ - {expr: 'sum(rate(http_requests_total{code="404",job="front"}[1m]))', title: "404"}
73
+ - {expr: 'sum(rate(http_requests_total{code="302",job="front"}[1m]))', title: "302"}
74
+ - {expr: 'sum(rate(http_requests_total{code="200",job="front"}[1m]))', title: "200"}
75
+ - type: custom
76
+ title: "CPU"
77
+ max: 100
78
+ expr: '100 - (avg by (instance)(rate(node_cpu{mode="idle",job="front"}[5m]))*100)'
79
+ - type: custom
80
+ title: "Used Memory, %"
81
+ max: 100
82
+ expr: '(node_memory_MemTotal{job="front"} - node_memory_Cached{job="front"} - node_memory_Buffers{job="front"} - node_memory_MemFree{job="front"})/node_memory_MemTotal{job="front"}*100'
@@ -11,7 +11,7 @@ module GrafanaRb
11
11
  end
12
12
 
13
13
  def run
14
- if @argv[0] == "run" || @argv[0] == "r" || @argv[0] == "q"
14
+ if @argv[0] == "apply" || @argv[0] == "a" || @argv[0] == "q"
15
15
  apply
16
16
  else
17
17
  usage
@@ -328,7 +328,7 @@ module GrafanaRb
328
328
  puts " grafana-rb <cmd>"
329
329
  puts ""
330
330
  puts "Commands:"
331
- puts " run - update dashboards"
331
+ puts " apply - update dashboards"
332
332
  puts ""
333
333
  end
334
334
  end
@@ -1,3 +1,3 @@
1
1
  module GrafanaRb
2
- VERSION = "0.8.0"
2
+ VERSION = "0.9.0"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: grafana-rb
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.8.0
4
+ version: 0.9.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Alexey Vakhov
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-03-06 00:00:00.000000000 Z
11
+ date: 2017-03-10 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: bundler
@@ -69,6 +69,9 @@ files:
69
69
  - README.md
70
70
  - Rakefile
71
71
  - bin/release
72
+ - examples/dash.png
73
+ - examples/grafana.yml
74
+ - examples/main.yml
72
75
  - exe/grafana-rb
73
76
  - grafana-rb.gemspec
74
77
  - lib/grafana-rb.rb