Variables.ps1
|
# # Logging # New-Variable -Name 'IN_MEMORY_LOGS' -Value ([System.Collections.ArrayList]::new()) -Option ReadOnly -Scope Script -Force # # Spools # New-Variable -Name 'SPOOL_FOLDER_NAME' -Value 'Spool' -Option ReadOnly -Scope Script -Force New-Variable -Name "SPOOL_MAX_FILE_COUNT" -Value 100 -Option ReadOnly -Scope Script -Force # # Time window constants # New-Variable -Name 'MAX_MINUTES_READ' -Value 7 -Option ReadOnly -Scope Script -Force New-Variable -Name 'METRICS_INTERVAL_SECONDS' -Value 20 -Option ReadOnly -Scope Script -Force # # Performance tuning # New-Variable -Name 'PERF_QUERY_BATCH_SIZE' -Value 40 -Option ReadOnly -Scope Script -Force # # vSphere Hypervisor metric IDs (single source of truth) # Reference: VMware vSphere PerformanceManager API documentation # https://developer.broadcom.com/xapis/vsphere-web-services-api/latest/ # # Metrics that provide host-level aggregates (Instance = "") New-Variable -Name 'VSPHERE_HYPERVISOR_METRICS_AGGREGATED' -Value ([ordered]@{ # CPU Metrics # ----------- # cpu.ready.summation: Time the vCPU was ready to run but waiting for physical CPU scheduling. # Unit: millisecond | Rollup: summation CpuReadySummation = 'cpu.ready.summation' # cpu.usage.average: CPU usage as a percentage of total available CPU capacity. # Unit: percent (%) | Rollup: average CpuUsageAverage = 'cpu.usage.average' # cpu.used.summation: Total CPU time consumed. # Unit: millisecond | Rollup: summation CpuUsedSummation = 'cpu.used.summation' # Disk Metrics # ------------ # disk.read.average: Average data read rate from all disks. # Unit: KBps | Rollup: average DiskReadAverage = 'disk.read.average' # disk.write.average: Average data write rate to all disks. # Unit: KBps | Rollup: average DiskWriteAverage = 'disk.write.average' # disk.maxTotalLatency.latest: Highest latency value across all disks. # Unit: millisecond | Rollup: latest DiskMaxTotalLatencyLatest = 'disk.maxTotalLatency.latest' # Memory Metrics # -------------- # mem.swapinRate.average: Rate at which memory is being swapped in from disk. # Unit: KBps | Rollup: average MemSwapInRateAverage = 'mem.swapinRate.average' # mem.swapoutRate.average: Rate at which memory is being swapped out to disk. # Unit: KBps | Rollup: average MemSwapOutRateAverage = 'mem.swapoutRate.average' # mem.swapused.average: Amount of swap space currently in use. # Unit: KB | Rollup: average MemSwapUsedAverage = 'mem.swapused.average' # mem.state.latest: Host memory availability state. 0=High (>=6% free), 1=Soft (~4%), 2=Hard (~2%), 3=Low (~1%). # Determines which reclamation techniques ESXi uses (ballooning vs swapping). # Unit: number | Rollup: latest MemStateLatest = 'mem.state.latest' # mem.vmmemctl.average: Amount of memory reclaimed via the VMware balloon driver (vmmemctl). # Unit: KB | Rollup: average MemVmmemctlAverage = 'mem.vmmemctl.average' # mem.usage.average: Memory usage as a percentage of configured or available memory. # Unit: percent (%) | Rollup: average MemUsageAverage = 'mem.usage.average' }) -Option ReadOnly -Scope Script -Force # Combined lookup for all metrics (for property mapping) New-Variable -Name 'VSPHERE_HYPERVISOR_METRICS' -Value ([ordered]@{} + $script:VSPHERE_HYPERVISOR_METRICS_AGGREGATED) -Option ReadOnly -Scope Script -Force # Fetch all metrics New-Variable -Name 'VSPHERE_HYPERVISOR_METRIC_IDS' -Value ([string[]]@($script:VSPHERE_HYPERVISOR_METRICS.Values)) -Option ReadOnly -Scope Script -Force |