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 +4 -4
- data/.travis.yml +6 -0
- data/CHANGELOG.md +5 -0
- data/README.md +8 -20
- data/examples/dash.png +0 -0
- data/examples/grafana.yml +3 -0
- data/examples/main.yml +82 -0
- data/lib/grafana-rb/cli.rb +2 -2
- data/lib/grafana-rb/version.rb +1 -1
- metadata +5 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: ed6f37739b1b549ed60776672d2bc2ec420c74c7
|
4
|
+
data.tar.gz: f50ab5d2667dfb7dc8e8c1f966e5734a74ffea49
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 6dcab643e6a69411fc8380b014634fc1325628ee37aa0c27ac28fdaba86cdd17613d4c14f4db0deee503abac2005098f895b6e8274d9fb94a443dbbec77ab48d
|
7
|
+
data.tar.gz: 42cd0ce220d5fc7a89d3945657f2bf25867273b613927bc89bd723afa5b8a9aa4d801dc5bf6ea5fa9609a206afe291ee0847d64628de41bf06d970af28a42768
|
data/.travis.yml
CHANGED
data/CHANGELOG.md
CHANGED
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://
|
6
|
-
[![Gem Version](https://
|
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
|
-
|
9
|
-
|
10
|
-
Add this line to your application's Gemfile:
|
8
|
+
**Note:** work only with prometheus datasource now!
|
11
9
|
|
12
|
-
|
13
|
-
gem 'grafana-rb'
|
14
|
-
```
|
10
|
+
Scripts from [examples](examples) directory generate such nice dashboard:
|
15
11
|
|
16
|
-
|
12
|
+
<img src="examples/dash.png">
|
17
13
|
|
18
|
-
|
14
|
+
## Installation
|
19
15
|
|
20
|
-
|
16
|
+
Install last gem version as:
|
21
17
|
|
22
18
|
$ gem install grafana-rb
|
23
19
|
|
24
20
|
## Usage
|
25
21
|
|
26
|
-
|
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
|
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'
|
data/lib/grafana-rb/cli.rb
CHANGED
@@ -11,7 +11,7 @@ module GrafanaRb
|
|
11
11
|
end
|
12
12
|
|
13
13
|
def run
|
14
|
-
if @argv[0] == "
|
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 "
|
331
|
+
puts " apply - update dashboards"
|
332
332
|
puts ""
|
333
333
|
end
|
334
334
|
end
|
data/lib/grafana-rb/version.rb
CHANGED
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.
|
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-
|
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
|