Skip to content

Instantly share code, notes, and snippets.

@toobulkeh
toobulkeh / performance_data.rb
Last active January 3, 2024 09:08
rbvmomi performance manager usage
vim = RbVmomi::VIM.connect host: vcenter.hostname, user: vcenter.username, password: vcenter.password, insecure: true
pm = vim.serviceInstance.content.perfManager
# this is for a single cluster with hosts directly in one cluster. 'first' returns the cluster object.
hosts = vim.serviceInstance.find_datacenter.hostFolder.children.first.host
pm.retrieve_stats([hosts[0]], ['cpu.usagemhz'], {interval: '300', start_time: (Time.now - 6.hours)}).first[1][:metrics]['cpu.usagemhz']
# This above query queries for the 'cpu.usagemhz' counter, which by default matches the (none) rollup counter (NOT THE AVERAGE) in vSphere API.
# This is a problem with the RbVmomi gem helper function "retrieve_stats" only. To override this, use the following manual counter selection:
@caseywdunn
caseywdunn / docker.md
Last active August 10, 2023 18:13
Docker cheat sheet

Docker cheat sheet

Introduction

Docker is a tool for bundling together applications and their dependencies into images that can than be run as containers on many different types of computers.

Docker and other containerization tools are useful to scientists because:

  • It greatly simplifies distribution and installation of complex work flows that