kumome 0.0.1 → 0.0.2
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/.rubocop.yml +3 -0
- data/README.md +22 -1
- data/lib/kumome/cli.rb +15 -9
- data/lib/kumome/config.rb +5 -5
- data/lib/kumome/ext/thor.rb +15 -0
- data/lib/kumome/option.rb +5 -0
- data/lib/kumome/version.rb +1 -1
- metadata +3 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 0d19fed3e49c4cb68d55f9fa5bb5976ea2335fa9
|
4
|
+
data.tar.gz: 219dc319da11e3f505db7c0491e6875493fc5e77
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 0bc743522c27a6f97c49227f0c6c904f0d6596ce357e3f3e7c3cccfcce6c04cf25fa787ed4cb74e434c832f4cc2a229928426334eee9b7fa2bb45755636db13a
|
7
|
+
data.tar.gz: 6d20b87efba92f0b5244c1fdb6274bb4150f0834d0e6d2ef4bd959847dd8a941746395d815eb97e6b2d79b88eff1af1677828ff042ede698976c0c0919d0936c
|
data/.rubocop.yml
CHANGED
data/README.md
CHANGED
@@ -1,7 +1,9 @@
|
|
1
|
-
# Kumome
|
1
|
+
# Kumome [![Gem](https://img.shields.io/gem/v/kumome.svg)](https://rubygems.org/gems/kumome)
|
2
2
|
|
3
3
|
Resource statistics tool via AWS CloudWatch.
|
4
4
|
|
5
|
+
[![asciicast](https://asciinema.org/a/35035.png)](https://asciinema.org/a/35035?speed=5&autoplay=1)
|
6
|
+
|
5
7
|
## Installation
|
6
8
|
|
7
9
|
Add this line to your application's Gemfile:
|
@@ -46,6 +48,25 @@ EOF
|
|
46
48
|
$ kumome --ec2=i-123ab45c,i-890ed12c --rds=my-rds --elb=my-elb --profile mycreds
|
47
49
|
```
|
48
50
|
|
51
|
+
## (Default) Command options
|
52
|
+
|
53
|
+
```sh
|
54
|
+
$ kumome
|
55
|
+
Usage:
|
56
|
+
kumome # OR: `kumome stat`
|
57
|
+
|
58
|
+
Options:
|
59
|
+
[--ec2=InstanceId,..]
|
60
|
+
[--rds=DBInstanceIdentifier,..]
|
61
|
+
[--elb=LoadBalancerName,..]
|
62
|
+
[--profile=PROFILE]
|
63
|
+
[--period=N]
|
64
|
+
# Default: 300
|
65
|
+
[--config=CONFIG]
|
66
|
+
|
67
|
+
Show AWS resource statistics
|
68
|
+
```
|
69
|
+
|
49
70
|
## TODO
|
50
71
|
|
51
72
|
- `tailf` option
|
data/lib/kumome/cli.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
1
|
require 'thor'
|
2
|
+
require 'kumome/ext/thor'
|
2
3
|
require 'terminal-table/import'
|
3
4
|
require 'term/ansicolor'
|
4
5
|
include Term::ANSIColor
|
@@ -7,19 +8,23 @@ module Kumome
|
|
7
8
|
include Term::ANSIColor
|
8
9
|
|
9
10
|
class CLI < Thor
|
10
|
-
class_option :profile
|
11
|
-
class_option :period, type: :numeric, default: 300
|
12
11
|
class_option :config, type: :string
|
13
12
|
default_command :stat
|
14
13
|
|
15
14
|
Kumome::Config.load
|
16
15
|
|
17
16
|
desc 'stat', 'Show AWS resource statistics'
|
18
|
-
Kumome::Config.config['resources'].
|
19
|
-
option r, type: :string
|
17
|
+
Kumome::Config.config['resources'].each do |r, config|
|
18
|
+
option r, type: :string, banner: config['dimensions_name'] + ',..'
|
20
19
|
end
|
20
|
+
option :profile
|
21
|
+
option :period, type: :numeric, default: 300
|
21
22
|
def stat
|
22
23
|
Kumome::Option.load(options)
|
24
|
+
unless Kumome::Option.selected_resource_options?
|
25
|
+
help('stat')
|
26
|
+
return
|
27
|
+
end
|
23
28
|
data = Kumome::Stat.data
|
24
29
|
out_table(data)
|
25
30
|
# @TODO tailf stat
|
@@ -56,11 +61,12 @@ module Kumome
|
|
56
61
|
data.sort_by { |k, _| k.to_i }.each do |timestamp, d|
|
57
62
|
line = [timestamp]
|
58
63
|
metrics_header.each_key do |h|
|
59
|
-
if d.key?(h)
|
60
|
-
|
61
|
-
|
62
|
-
|
63
|
-
|
64
|
+
l = if d.key?(h)
|
65
|
+
d[h]
|
66
|
+
else
|
67
|
+
''
|
68
|
+
end
|
69
|
+
line << l
|
64
70
|
end
|
65
71
|
t << line
|
66
72
|
end
|
data/lib/kumome/config.rb
CHANGED
@@ -12,11 +12,11 @@ module Kumome
|
|
12
12
|
arg =~ /\A(--config=?|-c=?).*\z/
|
13
13
|
end
|
14
14
|
if config_option
|
15
|
-
if config_option =~ /=/
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
|
15
|
+
config_path = if config_option =~ /=/
|
16
|
+
config_option.gsub(/\A(--config=?|-c=?)/, '')
|
17
|
+
else
|
18
|
+
argv[argv.index(config_option) + 1]
|
19
|
+
end
|
20
20
|
end
|
21
21
|
config_path = default_config_path if config_path.nil?
|
22
22
|
config_path
|
@@ -0,0 +1,15 @@
|
|
1
|
+
class Thor
|
2
|
+
class << self
|
3
|
+
protected
|
4
|
+
|
5
|
+
def banner(command, _namespace = nil, subcommand = false)
|
6
|
+
if command.name == 'stat'
|
7
|
+
'kumome # OR: `kumome stat`'
|
8
|
+
else
|
9
|
+
# rubocop:disable Style/GlobalVars
|
10
|
+
"#{basename} #{command.formatted_usage(self, $thor_runner, subcommand)}"
|
11
|
+
# rubocop:enable Style/GlobalVars
|
12
|
+
end
|
13
|
+
end
|
14
|
+
end
|
15
|
+
end
|
data/lib/kumome/option.rb
CHANGED
data/lib/kumome/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: kumome
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.2
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- k1LoW
|
8
8
|
autorequire:
|
9
9
|
bindir: exe
|
10
10
|
cert_chain: []
|
11
|
-
date: 2016-01-
|
11
|
+
date: 2016-01-29 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: aws-sdk
|
@@ -201,6 +201,7 @@ files:
|
|
201
201
|
- lib/kumome/cli.rb
|
202
202
|
- lib/kumome/config.rb
|
203
203
|
- lib/kumome/default.yml
|
204
|
+
- lib/kumome/ext/thor.rb
|
204
205
|
- lib/kumome/option.rb
|
205
206
|
- lib/kumome/stat.rb
|
206
207
|
- lib/kumome/version.rb
|