aws_pocketknife 0.1.18 → 0.1.19

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: 5a4c631cb94a1279f461aa8b7fc88c3092e30ca9
4
- data.tar.gz: 5b170d817d57cfe74cb5ae3baa69d14c3a0bb2d1
3
+ metadata.gz: c79fc407b1a9fbbf0e56bdbc063e87f8d91fd5fb
4
+ data.tar.gz: 367f66795712d62ededad96028a7cc4c25e951d1
5
5
  SHA512:
6
- metadata.gz: 9e95ef7d8673448e0bf2bb59f04031dc9815de3b6d38a60a32fdcfc534fd0d0ab62a002c4af538d5b8700e88655a25813d00ba1f63f2ec617534e19ef32fb86c
7
- data.tar.gz: 3b47a545cb7f56ff2d3c38619cebcf48fc117605588908791f9250b297181c671a1fe1b5a8b43456090c00aa6dec33cbd9084eea5ceceb40d0087b885f13ea61
6
+ metadata.gz: 23bc162301d9d3bf8b62009cfbaf582da30915d4fcb6225c1fde01092152f955db4035deb5e770a5420caac0c78e2dedc792ef8c9900f09e1670523813aff1d2
7
+ data.tar.gz: e1d3d8736766c830cca8783f030a2ef338a2cdd6a565e6577e7537a716ec36b1234ee0dc5fb968392e6060b40225b4d02a6ea15bfa615ee172742c78ccd66543
@@ -119,15 +119,17 @@ module AwsPocketknife
119
119
  if instances.nil?
120
120
  puts "No instances found"
121
121
  else
122
+ count = 0
123
+ mem_cluster_total = 0.0
124
+ mem_cluster_res_total = 0.0
125
+ mem_percentage = 0.0
126
+ cpu_cluster_total = 0.0
127
+ cpu_cluster_res_total = 0.0
128
+ cpu_percentage = 0.0
129
+ pending_tasks_count_total = 0
130
+ running_tasks_count_total = 0
122
131
  instances.each do |instance|
123
132
  info = instance[:info]
124
- # tasks = instance[:tasks]
125
- # task_list = []
126
- # unless tasks.empty?
127
- # tasks.tasks.each do |t|
128
- # task_list << t.task_definition_arn.split('/')[1]
129
- # end
130
- # end
131
133
  cpu_total = info.registered_resources[0].integer_value
132
134
  mem_total = info.registered_resources[1].integer_value
133
135
  cpu_available = info.remaining_resources[0].integer_value
@@ -136,8 +138,21 @@ module AwsPocketknife
136
138
  data << [instance[:name], info.ec2_instance_id, connected,
137
139
  info.pending_tasks_count, info.running_tasks_count, info.status,
138
140
  "#{cpu_available} / #{cpu_total}", "#{mem_available} / #{mem_total}"
139
- ]
141
+ ]
142
+ pending_tasks_count_total = pending_tasks_count_total + info.pending_tasks_count
143
+ running_tasks_count_total = running_tasks_count_total + info.running_tasks_count
144
+ mem_cluster_total = mem_cluster_total + mem_total
145
+ mem_cluster_res_total = mem_cluster_res_total + mem_available
146
+ mem_percentage = (((mem_cluster_total - mem_cluster_res_total)/mem_cluster_total) * 100).round(2)
147
+ cpu_cluster_total = cpu_cluster_total + cpu_total
148
+ cpu_cluster_res_total = cpu_cluster_res_total + cpu_available
149
+ cpu_percentage = (((cpu_cluster_total - cpu_cluster_res_total)/cpu_cluster_total) * 100).round(2)
150
+ count = count + 1
140
151
  end
152
+ data << ["TOTAL (#{count})", "-", "-",
153
+ pending_tasks_count_total, running_tasks_count_total, "-",
154
+ "#{cpu_cluster_res_total.round(0)} / #{cpu_cluster_total.round(0)} (#{cpu_percentage} %)", "#{mem_cluster_res_total.round(0)} / #{mem_cluster_total.round(0)} (#{mem_percentage} %)"
155
+ ]
141
156
  AwsPocketknife::Ecs.pretty_table(headers: headers, data: data)
142
157
  end
143
158
  end
@@ -1,3 +1,3 @@
1
1
  module AwsPocketknife
2
- VERSION = "0.1.18"
2
+ VERSION = "0.1.19"
3
3
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: aws_pocketknife
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.18
4
+ version: 0.1.19
5
5
  platform: ruby
6
6
  authors:
7
7
  - Gustavo Soares Souza
8
8
  autorequire:
9
9
  bindir: exe
10
10
  cert_chain: []
11
- date: 2017-07-05 00:00:00.000000000 Z
11
+ date: 2017-07-09 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: aws-sdk-core