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 +4 -4
- data/lib/smartos-manager/cli.rb +9 -2
- data/lib/smartos-manager/core.rb +22 -0
- data/lib/smartos-manager/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: b1280469db0b24e3d8a4bfd499879a1a14a3a5a8
|
4
|
+
data.tar.gz: 017242b188b773bceea49890884e2864586f1b50
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: fcebf46f92db08808503c3505aae8432ef60e5a140d095f562d4a550dabf974dbef8b0b00630b9e482973c079651c42e179a8e2601c76dce93cb5f7191ccfaf0
|
7
|
+
data.tar.gz: 66daaf93d2253616b4a659b041259d7cc44cf20df34c71ae04c7019742d3e4cc5150b63900b1df593bf29ebc3fea650e4c343afd9962d2efb3e95afe3a1195fa
|
data/lib/smartos-manager/cli.rb
CHANGED
@@ -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
|
data/lib/smartos-manager/core.rb
CHANGED
@@ -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('_')
|