Skip to content

Instantly share code, notes, and snippets.

@jrich523
Created June 12, 2018 18:03
Show Gist options
  • Save jrich523/3afa7a06f87da0e61f9e2f7102cfcc53 to your computer and use it in GitHub Desktop.
Save jrich523/3afa7a06f87da0e61f9e2f7102cfcc53 to your computer and use it in GitHub Desktop.
kvms ||= Array.new
nodes.each do |n|
kvms.push(
site: n.dig('facts', 'ss_site'),
hostname: n.dig('facts', 'hostname'),
guest_count: (n.dig('facts', 'kvm', 'guests') || []).count,
mem_used: n.dig('facts', 'memory', 'system', 'used'),
mem_total: n.dig('facts', 'memory', 'system', 'total'),
mem_per_used: n.dig('facts', 'memory', 'system', 'capacity'),
vcpu_used: n.dig('facts', 'kvm', 'usedvcpus'),
vcpu_max: n.dig('facts', 'kvm', 'maxvcpus'),
disk_used: n.dig('facts', 'kvm', 'pool', 'default', 'allocation'),
disk_total: n.dig('facts', 'kvm', 'pool', 'default', 'capacity')
)
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment