smartos-manager 1.1.2 → 1.2.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: 6039a738c88e81df62243f2bc64ced9b79eaba68
4
- data.tar.gz: c68aef35b68e775c0c7c9a78728cda095326c3e8
3
+ metadata.gz: b1280469db0b24e3d8a4bfd499879a1a14a3a5a8
4
+ data.tar.gz: 017242b188b773bceea49890884e2864586f1b50
5
5
  SHA512:
6
- metadata.gz: 35eef75a70808e18d6660b9015ea98e800c6bc8842623817781f0c1cd7a27ec2628beba25b29dd1f1c48fabb94d41e2ccd809b2a278147a3fca2794abc838e8c
7
- data.tar.gz: 1250e3a9bbdb5dcbae541f0d901fe15142d3a0de789af2b1c0a68b5c7a036b6d4d000f5239a8c5e87c81b9df96f4c22dfce376880934c0e55473d90ebe3f57ff
6
+ metadata.gz: fcebf46f92db08808503c3505aae8432ef60e5a140d095f562d4a550dabf974dbef8b0b00630b9e482973c079651c42e179a8e2601c76dce93cb5f7191ccfaf0
7
+ data.tar.gz: 66daaf93d2253616b4a659b041259d7cc44cf20df34c71ae04c7019742d3e4cc5150b63900b1df593bf29ebc3fea650e4c343afd9962d2efb3e95afe3a1195fa
@@ -33,13 +33,16 @@ class AppCLI < Thor
33
33
 
34
34
  ret.each do |host, vms|
35
35
  mem = sysinfos[host][:memory]
36
+ zfs_arc_reserved = sysinfos[host][:zfs_arc_reserved]
37
+ zfs_arc_current = sysinfos[host][:zfs_arc_current]
36
38
  vm_memory = 0
37
39
 
38
40
  vms.each{|vm| vm_memory += vm.memory }
39
- avail = (mem - vm_memory) - (20 * mem/100.0)
41
+ # avail = (mem - vm_memory) - (20 * mem/100.0)
42
+ avail = (mem - vm_memory) - zfs_arc_reserved
40
43
 
41
44
  rev = sysinfos[host][:smartos_version]
42
- puts "\n#{host.name} [SmartOS: #{rev.send(rev_colors.get(rev))}] (#{host.address}) (#{vms.size} vms) (Total RAM: #{mem.human_size(1).green}, Avail: #{avail.human_size(1).magenta})"
45
+ puts "\n#{host.name} [SmartOS: #{rev.send(rev_colors.get(rev))}] (#{host.address}) (#{vms.size} vms) (Total RAM: #{mem.human_size(1).green}, ZFS: #{format_size(zfs_arc_current)}G/#{format_size(zfs_arc_reserved)}G, Avail: #{avail.human_size(1).magenta})"
43
46
  vms.each do |vm|
44
47
  user_columns = registry.user_columns.values.map{|key| vm[key] }
45
48
  p_vm_list(vm.memory.human_size(1), vm.name, vm.type, vm.uuid, printable_state(vm.state), vm.admin_ip, *user_columns)
@@ -58,6 +61,10 @@ class AppCLI < Thor
58
61
 
59
62
  no_tasks do
60
63
 
64
+ def format_size(val, unit = 3)
65
+ format('%.1f', val / (1024.0**unit))
66
+ end
67
+
61
68
  def humanize(str)
62
69
  str.split("_").map(&:capitalize).join(' ')
63
70
  end
@@ -153,6 +153,28 @@ class HostRegistry
153
153
  ret[host] = {memory: mem.to_i.megabytes}
154
154
  end
155
155
 
156
+ # ARC Max Size
157
+ # zfs:0:arcstats:c:2850704524
158
+ # zfs:0:arcstats:size:1261112216
159
+ run_on_all("kstat -C zfs:0:arcstats:c zfs:0:arcstats:size").each do |host, data|
160
+ zfs_arc_current = nil
161
+ zfs_arc_reserved = nil
162
+
163
+ data.split("\n").each do |line|
164
+ value = line.split(':').last.to_i
165
+ if line.start_with?('zfs:0:arcstats:size:')
166
+ zfs_arc_current = value
167
+ else
168
+ zfs_arc_reserved = value
169
+ end
170
+ end
171
+
172
+ ret[host].merge!(
173
+ zfs_arc_current: zfs_arc_current,
174
+ zfs_arc_reserved: zfs_arc_reserved
175
+ )
176
+ end
177
+
156
178
  # joyent_20140207T053435Z
157
179
  run_on_all("uname -a | cut -d ' ' -f 4").each do |host, data|
158
180
  _, rev = data.strip().split('_')
@@ -1,3 +1,3 @@
1
1
  module SmartosManager
2
- VERSION = "1.1.2"
2
+ VERSION = "1.2.0"
3
3
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: smartos-manager
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.1.2
4
+ version: 1.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Julien Ammous