dashdog 0.1.0 → 0.1.1
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/CHANGELOG.md +16 -0
- data/README.md +6 -0
- data/dashdog.gemspec +1 -0
- data/lib/dashdog/actions.rb +5 -3
- data/lib/dashdog/cli.rb +1 -0
- data/lib/dashdog/client.rb +3 -2
- data/lib/dashdog/converter.rb +1 -1
- data/lib/dashdog/utils.rb +6 -2
- data/lib/dashdog/version.rb +1 -1
- metadata +16 -2
- data/Boardfile +0 -117
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 5bd9f5b8483bb4fc4ab8b73b881f6dcb61e4044a
|
4
|
+
data.tar.gz: bbda047cb690cb840671b4a67f3609f7ebb49cab
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: ec7c47d5d7cee288898c25d011fe61a5dab41a21182693bef17bbf5fd229aab910b4833d056b182120044b49a1ba31a746a0c6ded30955d71615d04b043356a2
|
7
|
+
data.tar.gz: 5595e13d9e51c71daf046e80e26c22363a86516e193a62a13c67b29ab8f9d15d956d1d1c374c2ed445b008f8589c1389bc3937bdafbb83168cf6990f14a9bd84
|
data/CHANGELOG.md
ADDED
@@ -0,0 +1,16 @@
|
|
1
|
+
## 0.1.1
|
2
|
+
|
3
|
+
- Add color option / check stdout tty [#3][] ([@winebarrel][])
|
4
|
+
- Use parallel for speeding up [#2][] ([@winebarrel][])
|
5
|
+
- Bugfix: Error occurs when widgets is nil. [#1][] ([@winebarrel][])
|
6
|
+
- Fix strange diff colorize
|
7
|
+
|
8
|
+
## 0.1.0
|
9
|
+
|
10
|
+
- Initial release
|
11
|
+
|
12
|
+
<!--- The following link definition list is generated by PimpMyChangelog --->
|
13
|
+
[#1]: https://github.com/serverworks/dashdog/issues/1
|
14
|
+
[#2]: https://github.com/serverworks/dashdog/issues/2
|
15
|
+
[#3]: https://github.com/serverworks/dashdog/issues/3
|
16
|
+
[@winebarrel]: https://github.com/winebarrel
|
data/README.md
CHANGED
@@ -1,5 +1,7 @@
|
|
1
1
|
# Dashdog
|
2
2
|
|
3
|
+
[](https://badge.fury.io/rb/dashdog)
|
4
|
+
|
3
5
|
Datadog dashboards management tool with Ruby DSL.
|
4
6
|
|
5
7
|
## Installation
|
@@ -38,6 +40,8 @@ Commands:
|
|
38
40
|
Options:
|
39
41
|
-f, [--file=FILE] # Configuration file
|
40
42
|
# Default: Boardfile
|
43
|
+
[--color], [--no-color] # Disable colorize
|
44
|
+
# Default: true
|
41
45
|
```
|
42
46
|
|
43
47
|
## Commands
|
@@ -53,6 +57,8 @@ Options:
|
|
53
57
|
-w, [--write], [--no-write] # Write the configuration to the file
|
54
58
|
-f, [--file=FILE] # Configuration file
|
55
59
|
# Default: Boardfile
|
60
|
+
[--color], [--no-color] # Disable colorize
|
61
|
+
# Default: true
|
56
62
|
```
|
57
63
|
|
58
64
|
### apply
|
data/dashdog.gemspec
CHANGED
@@ -24,6 +24,7 @@ Gem::Specification.new do |spec|
|
|
24
24
|
spec.add_dependency "thor", "~> 0.19.1"
|
25
25
|
spec.add_dependency "coderay"
|
26
26
|
spec.add_dependency "diffy"
|
27
|
+
spec.add_dependency "parallel"
|
27
28
|
|
28
29
|
spec.add_development_dependency "bundler", "~> 1.12"
|
29
30
|
spec.add_development_dependency "rake", "~> 10.0"
|
data/lib/dashdog/actions.rb
CHANGED
@@ -13,7 +13,7 @@ module Dashdog
|
|
13
13
|
def export(options)
|
14
14
|
dsl = @converter.timeboards_to_dsl(@client.get_timeboards)
|
15
15
|
dsl << @converter.screenboards_to_dsl(@client.get_screenboards)
|
16
|
-
Dashdog::Utils.print_ruby(dsl)
|
16
|
+
Dashdog::Utils.print_ruby(dsl, color: options[:color])
|
17
17
|
File.write(options['file'], dsl) if options['write']
|
18
18
|
end
|
19
19
|
|
@@ -38,7 +38,8 @@ module Dashdog
|
|
38
38
|
if l == r
|
39
39
|
info("#{dry_run}No changes '#{l['title']}'")
|
40
40
|
else
|
41
|
-
warn("#{dry_run}Update the timeboard
|
41
|
+
warn("#{dry_run}Update the timeboard '#{l['title']}'")
|
42
|
+
STDERR.puts Dashdog::Utils.diff(r, l)
|
42
43
|
@client.update_timeboard(l) if dry_run.empty?
|
43
44
|
end
|
44
45
|
end
|
@@ -71,7 +72,8 @@ module Dashdog
|
|
71
72
|
if l == r
|
72
73
|
info("#{dry_run}No changes '#{l['board_title']}'")
|
73
74
|
else
|
74
|
-
warn("#{dry_run}Update the screenboard '#{l['board_title']}'
|
75
|
+
warn("#{dry_run}Update the screenboard '#{l['board_title']}'")
|
76
|
+
STDERR.puts Dashdog::Utils.diff(r, l)
|
75
77
|
@client.update_screenboard(l) if dry_run.empty?
|
76
78
|
end
|
77
79
|
end
|
data/lib/dashdog/cli.rb
CHANGED
@@ -3,6 +3,7 @@ require 'thor'
|
|
3
3
|
module Dashdog
|
4
4
|
class Cli < Thor
|
5
5
|
class_option :file, aliases: '-f', desc: 'Configuration file', type: :string, default: 'Boardfile'
|
6
|
+
class_option :color, desc: 'Disable colorize', type: :boolean, default: $stdout.tty?
|
6
7
|
|
7
8
|
def initialize(*args)
|
8
9
|
@actions = Dashdog::Actions.new
|
data/lib/dashdog/client.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'dogapi'
|
2
|
+
require 'parallel'
|
2
3
|
|
3
4
|
module Dashdog
|
4
5
|
class Client
|
@@ -9,7 +10,7 @@ module Dashdog
|
|
9
10
|
|
10
11
|
def get_timeboards
|
11
12
|
ret = []
|
12
|
-
@api.get_dashboards[1]['dashes']
|
13
|
+
Parallel.each(@api.get_dashboards[1]['dashes'], in_threads: 8) do |bd|
|
13
14
|
ret << @api.get_dashboard(bd['id'])[1]['dash']
|
14
15
|
end
|
15
16
|
return ret
|
@@ -17,7 +18,7 @@ module Dashdog
|
|
17
18
|
|
18
19
|
def get_screenboards
|
19
20
|
ret = []
|
20
|
-
@api.get_all_screenboards[1]['screenboards']
|
21
|
+
Parallel.each(@api.get_all_screenboards[1]['screenboards'], in_threads: 8) do |bd|
|
21
22
|
ret << @api.get_screenboard(bd['id'])[1]
|
22
23
|
end
|
23
24
|
return ret
|
data/lib/dashdog/converter.rb
CHANGED
data/lib/dashdog/utils.rb
CHANGED
@@ -20,8 +20,12 @@ module Dashdog
|
|
20
20
|
puts CodeRay.scan(yaml, :yaml).terminal
|
21
21
|
end
|
22
22
|
|
23
|
-
def self.print_ruby(ruby)
|
24
|
-
|
23
|
+
def self.print_ruby(ruby, options = {})
|
24
|
+
if options[:color]
|
25
|
+
puts CodeRay.scan(ruby, :ruby).terminal
|
26
|
+
else
|
27
|
+
puts ruby
|
28
|
+
end
|
25
29
|
end
|
26
30
|
|
27
31
|
def self.print_json(json)
|
data/lib/dashdog/version.rb
CHANGED
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: dashdog
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.1.
|
4
|
+
version: 0.1.1
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Serverworks Co.,Ltd.
|
@@ -80,6 +80,20 @@ dependencies:
|
|
80
80
|
- - ">="
|
81
81
|
- !ruby/object:Gem::Version
|
82
82
|
version: '0'
|
83
|
+
- !ruby/object:Gem::Dependency
|
84
|
+
name: parallel
|
85
|
+
requirement: !ruby/object:Gem::Requirement
|
86
|
+
requirements:
|
87
|
+
- - ">="
|
88
|
+
- !ruby/object:Gem::Version
|
89
|
+
version: '0'
|
90
|
+
type: :runtime
|
91
|
+
prerelease: false
|
92
|
+
version_requirements: !ruby/object:Gem::Requirement
|
93
|
+
requirements:
|
94
|
+
- - ">="
|
95
|
+
- !ruby/object:Gem::Version
|
96
|
+
version: '0'
|
83
97
|
- !ruby/object:Gem::Dependency
|
84
98
|
name: bundler
|
85
99
|
requirement: !ruby/object:Gem::Requirement
|
@@ -133,7 +147,7 @@ files:
|
|
133
147
|
- ".gitignore"
|
134
148
|
- ".rspec"
|
135
149
|
- ".travis.yml"
|
136
|
-
-
|
150
|
+
- CHANGELOG.md
|
137
151
|
- Gemfile
|
138
152
|
- LICENSE.txt
|
139
153
|
- README.md
|
data/Boardfile
DELETED
@@ -1,117 +0,0 @@
|
|
1
|
-
timeboard "terui's TimeBoard 5 Aug 2016 11:46" do
|
2
|
-
read_only false
|
3
|
-
description "created by terui@serverworks.co.jp"
|
4
|
-
title "terui's TimeBoard 5 Aug 2016 11:46"
|
5
|
-
graphs do |*|
|
6
|
-
definition do
|
7
|
-
viz "timeseries"
|
8
|
-
requests do |*|
|
9
|
-
q "avg:system.load.1{*}"
|
10
|
-
aggregator "avg"
|
11
|
-
conditional_formats []
|
12
|
-
type "line"
|
13
|
-
end
|
14
|
-
end
|
15
|
-
title "Avg of system.load.1 over *"
|
16
|
-
end
|
17
|
-
graphs do |*|
|
18
|
-
definition do
|
19
|
-
style do
|
20
|
-
palette "green_to_orange"
|
21
|
-
paletteFlip false
|
22
|
-
end
|
23
|
-
group nil
|
24
|
-
noMetricHosts true
|
25
|
-
viz "hostmap"
|
26
|
-
scope nil
|
27
|
-
requests do |*|
|
28
|
-
q "avg:collection_timestamp{*} by {host}"
|
29
|
-
type "fill"
|
30
|
-
end
|
31
|
-
noGroupHosts true
|
32
|
-
end
|
33
|
-
title "Avg of collection_timestamp over * by host"
|
34
|
-
end
|
35
|
-
graphs do |*|
|
36
|
-
definition do
|
37
|
-
viz "query_value"
|
38
|
-
requests do |*|
|
39
|
-
q "avg:system.cpu.user{*}"
|
40
|
-
conditional_formats do |*|
|
41
|
-
palette "white_on_green"
|
42
|
-
comparator "<="
|
43
|
-
value "50"
|
44
|
-
end
|
45
|
-
conditional_formats do |*|
|
46
|
-
palette "white_on_yellow"
|
47
|
-
comparator ">"
|
48
|
-
value "50"
|
49
|
-
end
|
50
|
-
conditional_formats do |*|
|
51
|
-
palette "white_on_red"
|
52
|
-
comparator ">"
|
53
|
-
value "80"
|
54
|
-
end
|
55
|
-
end
|
56
|
-
end
|
57
|
-
title "Avg of system.cpu.user over *"
|
58
|
-
end
|
59
|
-
graphs do |*|
|
60
|
-
definition do
|
61
|
-
viz "timeseries"
|
62
|
-
requests do |*|
|
63
|
-
q "avg:aws.ebs.volume_write_ops{host:default-amazon-linux}"
|
64
|
-
end
|
65
|
-
events []
|
66
|
-
end
|
67
|
-
title "aws.ebs.volume_write_ops"
|
68
|
-
end
|
69
|
-
end
|
70
|
-
|
71
|
-
screenboard "terui's ScreenBoard 15 Aug 2016 15:39 test" do
|
72
|
-
read_only false
|
73
|
-
board_bgtype "board_graph"
|
74
|
-
original_title ""
|
75
|
-
height 80
|
76
|
-
width "100%"
|
77
|
-
template_variables []
|
78
|
-
widgets do |*|
|
79
|
-
title_size 16
|
80
|
-
title true
|
81
|
-
color "#4d4d4d"
|
82
|
-
text "Text Widget 2"
|
83
|
-
title_align "left"
|
84
|
-
text_align "left"
|
85
|
-
title_text ""
|
86
|
-
height 6
|
87
|
-
width 24
|
88
|
-
y 4
|
89
|
-
x 8
|
90
|
-
font_size "auto"
|
91
|
-
type "free_text"
|
92
|
-
end
|
93
|
-
widgets do |*|
|
94
|
-
title_size 16
|
95
|
-
title true
|
96
|
-
title_align "left"
|
97
|
-
title_text ""
|
98
|
-
height 13
|
99
|
-
tile_def do
|
100
|
-
viz "timeseries"
|
101
|
-
requests do |*|
|
102
|
-
q "avg:system.cpu.user{*}"
|
103
|
-
conditional_formats []
|
104
|
-
type "line"
|
105
|
-
end
|
106
|
-
end
|
107
|
-
width 47
|
108
|
-
timeframe "1h"
|
109
|
-
y 4
|
110
|
-
x 52
|
111
|
-
legend_size "0"
|
112
|
-
type "timeseries"
|
113
|
-
legend false
|
114
|
-
end
|
115
|
-
shared false
|
116
|
-
title_edited false
|
117
|
-
end
|