<commit_before>#!/usr/bin/env ruby
require 'rbvmomi'


test = RbVmomi::VIM.connect :host => 'localhost', :port => '14443', :user => '***REMOVED***', :password => '***<PASSWORD>***', :insecure => true
rootFolder = test.serviceInstance.content.rootFolder
dc = rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).find { |x| x.name == "TEST" } or fail "datacenter not found"

def list_folders(df)
	vms = []
      	df.childEntity.each do |object|
        	if object.class.to_s == 'Folder'
          		vms += list_folders(object)
        	else
          		vms << object
        	end
      	end      	
	vms
end

vm = {}
rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|
	foldlist = list_folders(dc.vmFolder)
	foldlist.each do |vmlist|
		puts "#{vmlist.name} up for " + "#{vmlist.summary.quickStats.uptimeSeconds} seconds"
	end
	break if [:datastore]
end
vm

#dc = test.serviceInstance.find_datacenter("TEST") or fail "datacenter not found"
#host = dc.hostFolder.children.first.host.first
#folder1 = dc.hostFolder.children.name

host = dc.hostFolder.children.first.host.first
puts host.hardware.memorySize
puts host.hardware.cpuInfo.numCpuCores
puts host.summary.runtime.powerState
puts host.summary.quickStats.overallMemoryUsage
puts host.summary.quickStats.overallCpuUsage
puts host.summary.config.name

puts host.summary.config.product.fullName
puts host.summary.config.product.apiType
puts host.summary.config.product.apiVersion
puts host.summary.config.product.osType
puts host.summary.config.product.productLineId
puts host.summary.config.product.vendor
puts host.summary.config.product.version

#sleep 3

<commit_msg>Cleaning up and prep'ing for increased functionality<commit_after>#!/usr/bin/env ruby
require 'rbvmomi'
require 'redis'

test = RbVmomi::VIM.connect :host => 'localhost', :port => '14443', :user => '***REMOVED***', :password => '***<PASSWORD>***', :insecure => true
rootFolder = test.serviceInstance.content.rootFolder
dc = rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).find { |x| x.name == "TEST" } or fail "datacenter not found"
host = dc.hostFolder.children.first.host.first

# ---------------------------------
# Collects data from Vcenter server
# ---------------------------------


puts host.hardware.memorySize
puts host.hardware.cpuInfo.numCpuCores
puts host.summary.runtime.powerState
puts host.summary.quickStats.overallMemoryUsage
puts host.summary.quickStats.overallCpuUsage
puts host.summary.config.name

puts host.summary.config.product.fullName
puts host.summary.config.product.apiType
puts host.summary.config.product.apiVersion
puts host.summary.config.product.osType
puts host.summary.config.product.productLineId
puts host.summary.config.product.vendor
puts host.summary.config.product.version

# ---------------------------------
# Collects data from individual VMs 
# ---------------------------------
def list_folders(df)
	vms = []
      	df.childEntity.each do |object|
        	if object.class.to_s == 'Folder'
          		vms += list_folders(object)
        	else
          		vms << object
        	end
      	end      	
	vms
end

vm = {}
rootFolder.childEntity.grep(RbVmomi::VIM::Datacenter).each do |dc|
	foldlist = list_folders(dc.vmFolder)
	foldlist.each do |vmlist|
		puts "#{vmlist.name} up for " + "#{vmlist.summary.quickStats.uptimeSeconds} seconds"
	end
	break if [:datastore]
end
vm

{'fraction_non_alphanumeric': 0.16240333135038668, 'fraction_numerical': 0.003569303985722784, 'mean_word_length': 3.508042895442359, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 15, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3461384', 'n_tokens_mistral': 1157, 'n_tokens_neox': 1137, 'n_words': 221}