The OpenTelemetry vCenter receiver is the piece that turns vCenter into an OTel source, and it is also the piece most guides wave through with a five line config and insecure_skip_verify: true. That gets you graphs in a lab. In production it leaves real questions unanswered: which counters it actually reads, how often it samples them, how hard it leans on vpxd, what happens with three vCenters, and why half your VMs show no disk latency. This part takes the receiver apart using its own source, documentation and metadata for Collector Contrib 0.166.0, then builds a least privilege, production shaped pipeline from it.

Level: intermediate  ·  Stack: vCenter 7.0 or 8 (VCF 9 see notes), otelcol-contrib 0.166.0, VCF.PowerCLI, Prometheus or Mimir  ·  Build time: about 60 minutes


Contents

  1. What the receiver is, and its status
  2. How it collects: from hostd to your backend
  3. Configuration reference
  4. What it emits: metrics and resource attributes
  5. From esxtop and perf charts to receiver metrics
  6. A least privilege service account
  7. The full collector template
  8. Enabling optional metrics and trimming the rest
  9. Load on vCenter and tuning collection_interval
  10. Multi-vCenter layout
  11. Workflow: zero to verified metrics
  12. Troubleshooting
  13. What’s next

01. What the receiver is, and its status

The vcenter receiver lives in the opentelemetry-collector-contrib repository and ships only in the contrib distribution (otelcol-contrib). It logs into the vSphere Web Services API at <endpoint>/sdk using govmomi, walks the inventory of every datacenter it can see, and turns properties and performance counters into OTel metrics. It does not install anything on vCenter or on ESX hosts.

PropertyValue as of v0.166.0What it means
Stabilityalpha for metricsConfig and metric names may still change. Each individual metric is marked development in the generated documentation. Pin the collector version.
Distributioncontrib onlyThe core otelcol binary will not recognise vcenter.
Supported versionsvCenter and ESXi 7.0 and 8, per the READMEvSphere 9 (VCF 9) is not listed. The API surface it uses is long standing, but validate in a lab before you rely on it.
EndpointvCenter or a standalone ESX hostPoint it at vCenter. Cluster, datastore rollups and vSAN cluster data only make sense there.
Signalsmetrics onlyEvents, tasks and alarms as logs are not collected. Alarm counts are available as optional metrics.

Recent changes worth knowing about if you read older posts: max_query_metrics arrived in v0.153.0 to batch performance queries, and v0.166.0 added proxy_url and the optional state metrics for host power, host connection, host uptime, alarm counts, datastore maintenance mode and VM power state. The same release changed hosts in standby to report power_state=standby instead of unknown and made the receiver reuse its vSphere session where it previously logged in on every scrape.

02. How it collects: from hostd to your backend

Reading the receiver’s scraper code explains almost every behaviour you will see later, including the missing metrics and the gaps. There are three different data paths inside one scrape.

ESX hosts hostd samples counters every 20 s, keeps about 1 h vSAN perf stats kept by the vSAN perf service vCenter (vpxd) at https://<vcenter>/sdk PerformanceManager.QueryPerf: real-time interval, latest 20 s sample ContainerView + property retrieval: inventory, quickStats, capacity vSAN performance service: VsanPerfQueryPerf per cluster, 5 min Gateway collector (otelcol-contrib), pipeline metrics/vc01 vcenter/vc01 memory_limiter resource_detection/env transform/vc01 batch prometheus_remote_write adds site and vcenter.server labels, protects memory, batches, writes with retry and WAL SOAP over HTTPS 443, read-only session Prometheus / Mimir /api/v1/write or /api/v1/push Grafana dashboards and alert rules (part 4) PromQL Per scrape: inventory retrievals per datacenter, ceil(hosts/13) + ceil(VMs/12) QueryPerf calls, 3 vSAN queries per cluster
Figure 1. One scrape cycle. The collector pulls from vCenter (dashed), then pushes to the metrics store. Batch sizes assume the default max_query_metrics of 256.

Path 1: properties and quickStats

For each datacenter the receiver creates container views and retrieves datastores, compute resources (clusters), hosts, resource pools and VMs with a fixed list of properties. Everything about capacity and state comes from here: datastore capacity and free space, cluster effective CPU and memory, host summary.quickStats (CPU MHz used, memory consumed, uptime), VM summary.quickStats (CPU MHz, CPU readiness, guest memory, balloon, swap, granted) and VM committed and uncommitted storage. These are vCenter’s cached summary values, not historical rollups.

Path 2: real-time performance counters

Network, disk and a few CPU and memory metrics come from QueryPerf against the real-time interval (IntervalId: 20) asking for one sample (MaxSample: 1). In plain terms: on every scrape the receiver asks for the latest 20 second sample of a fixed list of counters for every host and every VM. The host list is 19 counters (net.*, disk.totalReadLatency.average, disk.totalWriteLatency.average, disk.maxTotalLatency.latest, disk.read.average, disk.write.average, cpu.reservedCapacity.average, cpu.totalCapacity.average, mem.granted.average, mem.active.average, mem.vmmemctl.average). The VM list is 21 counters (net.*, disk.maxTotalLatency.latest, virtualDisk.totalReadLatency.average, virtualDisk.totalWriteLatency.average, virtualDisk.read.average, virtualDisk.write.average, cpu.ready.summation, cpu.wait.summation, cpu.idle.summation and a few more). The list is compiled into the receiver. You cannot add counters to it from config.

Two consequences matter. First, there are no datastore, cluster or resource pool performance counters at all, so no datastore level latency. Second, it is point sampling: with the default 2 minute interval you see one 20 second window out of six. A 40 second latency spike between scrapes simply does not exist in your backend. That is the main argument for tuning the interval, covered in section 09.

Path 3: vSAN performance service

If any vSAN metric is enabled, which by default they all are, the receiver calls VsanPerfQueryPerf once per cluster for each of three entity types: cluster DOM client, host DOM client and virtual machine. vSAN statistics have a 5 minute granularity. On a cluster without vSAN, or with the performance service off, the receiver treats NotSupported and NotFound faults as “no data” and only logs at debug level. Other vSAN errors surface as partial scrape errors.

03. Configuration reference

These are all the keys the receiver accepts in v0.166.0, taken from its config.go, the shared scraper controller config and the generated metrics builder config.

KeyDefaultNotes
endpointnone, requiredhttps://vcenter01.lab.local. Scheme must be http or https. Do not add /sdk, the receiver sets that path itself.
usernamenone, requiredUPN style works for SSO and AD accounts, for example svc-otel@vsphere.local. Use ${env:VCENTER_USERNAME}.
passwordnone, requiredStored as an opaque string so it is masked in logs. Always ${env:VCENTER_PASSWORD}.
tlsverification onStandard configtls client settings: ca_file, ca_pem, include_system_ca_certs_pool, server_name_override, insecure_skip_verify, min_version.
proxy_urlunsetAdded in v0.166.0. http, https, socks5 or socks5h. Scoped to one receiver instance. When set, HTTPS_PROXY and friends are ignored for that receiver.
collection_interval2mHow often a full scrape starts. See section 09.
initial_delay1sDelay before the first scrape after start.
timeoutunsetContext deadline for one scrape, from the shared scraper controller. Set it below collection_interval so a hung vCenter call cannot overlap the next cycle.
max_query_metrics256Metric IDs per QueryPerf call. Keep it at or below vCenter’s config.vpxd.stats.maxQueryMetrics. 0 disables batching. The README points to Broadcom KB 301449.
metrics.<name>.enabledper metricTurn individual metrics on or off.
resource_attributes.<name>.enabledall trueTurn individual resource attributes on or off.

One feature gate exists, receiver.vcenter.resourcePoolMemoryUsageAttribute, at beta and enabled by default since v0.105.0. It adds a type attribute (guest, host, overhead) to vcenter.resource_pool.memory.usage. Leave it on unless an old dashboard depends on the previous single series.

04. What it emits: metrics and resource attributes

This is the complete list from the receiver’s documentation.md at v0.166.0, grouped by the resource each metric is attached to. Anything not in this table is not emitted, whatever an older blog post says.

ResourceEnabled by defaultOptional (disabled by default)
Datacentervcenter.datacenter.cluster.count, .cpu.limit, .datastore.count, .disk.space, .host.count, .memory.limit, .vm.countnone
Clustervcenter.cluster.cpu.effective, .cpu.limit, .host.count, .memory.effective, .memory.limit, .vm.count, .vm_template.count, .vsan.congestions, .vsan.latency.avg, .vsan.operations, .vsan.throughputnone
Datastorevcenter.datastore.disk.usage, .disk.utilizationvcenter.datastore.alarm.count, .maintenance.status
Hostvcenter.host.cpu.capacity, .cpu.reserved, .cpu.usage, .cpu.utilization, .disk.latency.avg, .disk.latency.max, .disk.throughput, .memory.usage, .memory.utilization, .network.packet.drop.rate, .network.packet.error.rate, .network.packet.rate, .network.throughput, .network.usage, .vsan.cache.hit_rate, .vsan.congestions, .vsan.latency.avg, .vsan.operations, .vsan.throughputvcenter.host.alarm.count, .connection.status, .memory.active, .memory.ballooned, .memory.capacity, .memory.granted, .power.status, .uptime
Resource pool / vAppvcenter.resource_pool.cpu.shares, .cpu.usage, .memory.ballooned, .memory.granted, .memory.shares, .memory.swapped, .memory.usagenone
Virtual machinevcenter.vm.cpu.readiness, .cpu.usage, .cpu.utilization, .disk.latency.avg, .disk.latency.max, .disk.throughput, .disk.usage, .disk.utilization, .memory.ballooned, .memory.swapped, .memory.swapped_ssd, .memory.usage, .memory.utilization, .network.packet.drop.rate, .network.packet.rate, .network.throughput, .network.usage, .vsan.latency.avg, .vsan.operations, .vsan.throughputvcenter.vm.cpu.time, .memory.granted, .network.broadcast.packet.rate, .network.multicast.packet.rate, .power.status

Data point attributes you will filter on: direction (read/write for disk, transmitted/received for network), object (the instance: a device canonical name such as naa.…, a vmnic, a virtual disk such as scsi0:0, or a vCPU number), disk_state (used/available), disk_type (virtual/physical), power_state, cpu_state, vcenter.alarm.state and the vSAN type.

Resource attributes

AttributeContentAttached to
vcenter.datacenter.nameDatacenter nameEvery resource
vcenter.cluster.nameCluster nameClusters, and hosts, VMs and resource pools inside a cluster
vcenter.host.nameHost name as shown in inventoryHosts and VMs
vcenter.datastore.nameDatastore nameDatastores
vcenter.resource_pool.name, vcenter.resource_pool.inventory_pathPool name and full pathResource pools and VMs in them
vcenter.virtual_app.name, vcenter.virtual_app.inventory_pathvApp name and pathvApps and VMs in them
vcenter.vm.name, vcenter.vm.idVM name and instance UUIDVMs
vcenter.vm_template.name, vcenter.vm_template.idTemplate name and instance UUIDTemplates

Notice what is missing: there is no attribute naming the vCenter itself. With one vCenter that is fine. With two, two clusters called Cluster-01 collide. Section 07 adds a vcenter.server attribute with the transform processor, and you should do that even with one vCenter, because you will have two eventually. Note also that VM resources do not carry a datastore name, so “VMs on datastore X” needs inventory data from elsewhere.

What the names look like in Prometheus

With the default UnderscoreEscapingWithSuffixes translation, dots become underscores and the unit is appended using the Prometheus translator’s unit map. Units in curly braces such as {KiBy/s} are annotations and add no suffix. Units not in the map, such as MHz, are appended as written. A few examples you will type often:

OTel metric (unit)Prometheus name
vcenter.vm.cpu.readiness (%)vcenter_vm_cpu_readiness_percent
vcenter.vm.cpu.usage (MHz)vcenter_vm_cpu_usage_MHz
vcenter.vm.memory.usage (MiBy)vcenter_vm_memory_usage_mebibytes
vcenter.vm.disk.latency.avg (ms)vcenter_vm_disk_latency_avg_milliseconds
vcenter.host.disk.throughput ({KiBy/s})vcenter_host_disk_throughput
vcenter.host.vsan.latency.avg (us)vcenter_host_vsan_latency_avg_microseconds
vcenter.datastore.disk.utilization (%)vcenter_datastore_disk_utilization_percent

Resource attributes become labels such as vcenter_vm_name only if the exporter promotes them. Otherwise they live in a separate target_info series and every query needs a join. The template in section 07 promotes the vcenter.* attributes explicitly. Translation details shift between releases, so confirm with a {__name__=~"vcenter_.*"} query after your first write rather than trusting any table, including this one.

05. From esxtop and perf charts to receiver metrics

This is the table I wanted when I started. The middle column is the underlying vSphere property or counter, taken from the receiver’s source, so you can check the perf chart that shows the same thing.

What you look at todayvSphere source the receiver readsReceiver metricNotes
esxtop %RDY, perf chart CPU ReadyVM quickStats.overallCpuReadinessvcenter.vm.cpu.readiness (%)Whole VM, as a percentage. No per vCPU breakdown.
Per vCPU ready, wait, idlecpu.ready.summation, cpu.wait.summation, cpu.idle.summationvcenter.vm.cpu.time with cpu_state (optional)Converted to a percentage per object. Cross check against the perf chart on one VM before alerting on it.
VM CPU usage MHz and %quickStats.overallCpuUsagevcenter.vm.cpu.usage, vcenter.vm.cpu.utilizationUtilisation is usage over vCPUs times host MHz, or over the CPU limit if one is set.
esxtop MCTLSZ, VM BalloonquickStats.balloonedMemoryvcenter.vm.memory.balloonedAny non zero value on a production VM deserves a look.
esxtop SWCUR, VM SwappedquickStats.swappedMemoryvcenter.vm.memory.swapped, vcenter.vm.memory.swapped_ssdSame rule as balloon.
VM Active memoryquickStats.guestMemoryUsagevcenter.vm.memory.usage, vcenter.vm.memory.utilizationThis is active guest memory, not consumed. It will look low compared with the guest OS view. Do not use it for rightsizing alone.
esxtop v view LAT/rd, LAT/wr; perf chart Virtual disk latencyvirtualDisk.totalReadLatency.average, virtualDisk.totalWriteLatency.averagevcenter.vm.disk.latency.avg with disk_type=virtualPer virtual disk via object. The upstream docs note it needs statistics level 2.
Highest disk latencydisk.maxTotalLatency.latestvcenter.vm.disk.latency.max, vcenter.host.disk.latency.maxOnly the latest 20 s window.
esxtop u view GAVG/rd, GAVG/wr; perf chart Disk read/write latencyHost disk.totalReadLatency.average, disk.totalWriteLatency.averagevcenter.host.disk.latency.avgPer device in object. Per the receiver docs this is device plus kernel latency, which is what GAVG represents. DAVG and KAVG are not split out.
esxtop MBREAD/s, MBWRTN/sdisk.read.average, disk.write.averagevcenter.host.disk.throughputKiB/s, per device.
esxtop %DRPTX, %DRPRXnet.droppedTx.summation, net.droppedRx.summationvcenter.host.network.packet.drop.rate, vcenter.vm.network.packet.drop.ratePackets per second, not a percentage.
Host CPU usageHost quickStats.overallCpuUsagevcenter.host.cpu.usage, vcenter.host.cpu.utilizationCapacity is cores times MHz, without hyperthreads.
Host memory ConsumedHost quickStats.overallMemoryUsagevcenter.host.memory.usage, vcenter.host.memory.utilizationActive, granted and balloon at host level are optional metrics.
Datastore capacity and free spacesummary.capacity, summary.freeSpacevcenter.datastore.disk.usage, vcenter.datastore.disk.utilizationWorks for every datastore type, including NFS.
vSAN latency, IOPS, congestionvSAN performance servicevcenter.*.vsan.*5 minute granularity.

What is not available

  • Datastore performance counters. No datastore.totalReadLatency, no datastore IOPS. On NFS datastores, host disk.* counters do not describe the NFS path, so NFS latency is invisible to this receiver. NFS datastore latency with OpenTelemetry covers ways around that.
  • Co-stop, memory limit wait, swap wait (%CSTP, %MLMTD, %SWPWT).
  • Disk command counts and queue depth (IOPS, QAVG, ACTV, QUED) and storage adapter or path level data.
  • Events, tasks and alarm details. Only alarm counts by colour.

If any of these drive your current alerts, keep the existing collector for them. Telegraf’s vsphere input can sit next to the OTel collector, or feed it, while you migrate the rest.

06. A least privilege service account

The README asks for a “Read Only” user with permissions on vCenter, the cluster and everything below. Everything the receiver does (container views, property retrieval, QueryPerf, vSAN performance queries) is a read. The cleanest implementation is a dedicated role that contains only the three system privileges every role gets anyway (System.Anonymous, System.View, System.Read), assigned at the root folder with propagation. That is functionally the built in Read-only role, but a named role makes audits and later changes obvious.

Why the root with propagation: objects without a permission are not denied to a vSphere session, they are invisible. A role assigned only on one cluster gives you a scrape that succeeds with a partial inventory and no error. That is much harder to notice than a login failure.

Prefer an Active Directory or LDAP service account so that password policy and rotation follow your existing process. If you need a local vsphere.local account, the second script creates one with the community VMware.vSphere.SsoAdmin module. Remember that local SSO passwords follow the vsphere.local password policy, which includes a maximum lifetime, so check it with Get-SsoPasswordPolicy and put the rotation date in your calendar.

# New-OtelVcenterRole.ps1
# Creates a read-only role for the OpenTelemetry vcenter receiver and grants it
# to a service principal at the vCenter root folder, propagating to all children.
# Requires: VCF.PowerCLI (formerly VMware.PowerCLI). Run once per vCenter.
#
# Example:
#   ./New-OtelVcenterRole.ps1 -VCenter <VCENTER_FQDN> -Principal '<DOMAIN>\<SVC_ACCOUNT>'

#Requires -Modules VCF.PowerCLI
[CmdletBinding()]
param(
    [Parameter(Mandatory)] [string] $VCenter,
    [Parameter(Mandatory)] [string] $Principal,
    [string] $RoleName = 'OTel-Collector-ReadOnly'
)
$ErrorActionPreference = 'Stop'

$admin = Get-Credential -Message "vCenter administrator for $VCenter"
$vi = Connect-VIServer -Server $VCenter -Credential $admin

try {
    # Only the system privileges. vCenter adds these to every role anyway.
    $privs = Get-VIPrivilege -Server $vi -Id 'System.Anonymous', 'System.View', 'System.Read'

    $role = Get-VIRole -Server $vi -Name $RoleName -ErrorAction SilentlyContinue
    if (-not $role) {
        $role = New-VIRole -Server $vi -Name $RoleName -Privilege $privs
        Write-Host "Created role $RoleName"
    } else {
        Write-Host "Role $RoleName already exists, reusing it"
    }

    $root = Get-Folder -Server $vi -NoRecursion
    $existing = Get-VIPermission -Server $vi -Entity $root -Principal $Principal -ErrorAction SilentlyContinue
    if (-not $existing) {
        New-VIPermission -Server $vi -Entity $root -Principal $Principal -Role $role -Propagate:$true | Out-Null
        Write-Host "Granted $RoleName to $Principal on $($root.Name) with propagation"
    } else {
        Write-Host "Permission for $Principal already present on $($root.Name): role $($existing.Role)"
    }

    # Verification output
    Get-VIRole -Server $vi -Name $RoleName | Select-Object -ExpandProperty PrivilegeList
    Get-VIPermission -Server $vi -Entity $root -Principal $Principal |
        Select-Object Entity, Principal, Role, Propagate | Format-Table -AutoSize
}
finally {
    Disconnect-VIServer -Server $vi -Confirm:$false
}

Expected output: the three privilege IDs System.Anonymous, System.Read, System.View, followed by one row showing the root folder (named Datacenters), your principal, OTel-Collector-ReadOnly and Propagate = True.

# New-OtelSsoUser.ps1 (optional: only if you cannot use an AD/LDAP account)
# Creates a local vsphere.local user for the collector.
# Requires: Install-Module VMware.vSphere.SsoAdmin -Scope CurrentUser

#Requires -Modules VMware.vSphere.SsoAdmin
[CmdletBinding()]
param(
    [Parameter(Mandatory)] [string] $VCenter,
    [string] $UserName = 'svc-otel'
)
$ErrorActionPreference = 'Stop'

$ssoAdmin = Get-Credential -Message "SSO administrator (for example administrator@vsphere.local)"
$conn = Connect-SsoAdminServer -Server $VCenter -Credential $ssoAdmin

try {
    $secure = Read-Host -AsSecureString -Prompt "Password for $UserName"
    $plain  = [System.Net.NetworkCredential]::new('', $secure).Password

    New-SsoPersonUser -Server $conn -UserName $UserName -Password $plain `
        -Description 'OpenTelemetry vcenter receiver, read-only' | Out-Null

    Get-SsoPersonUser -Server $conn -Name $UserName -Domain 'vsphere.local'
    Get-SsoPasswordPolicy -Server $conn | Select-Object PasswordLifetimeDays
}
finally {
    Remove-Variable plain -ErrorAction SilentlyContinue
    Disconnect-SsoAdminServer -Server $conn
}
# Then run New-OtelVcenterRole.ps1 with -Principal 'VSPHERE.LOCAL\svc-otel'

07. The full collector template

This is the gateway config for one vCenter, built on the VM from part 1. It uses the snake_case component names from current releases. Design notes follow the YAML.

# /etc/otelcol-contrib/config.yaml
# vCenter gateway, one vCenter. otelcol-contrib 0.166.0.
# Secrets and site attributes come from /etc/otelcol-contrib/secrets.env:
#   VCENTER_USERNAME=<SVC_ACCOUNT>@<DOMAIN>
#   VCENTER_PASSWORD=<PASSWORD>
#   OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=<ENV>,site=<SITE>

extensions:
  health_check:
    endpoint: 127.0.0.1:13133

receivers:
  vcenter/vc01:
    endpoint: https://<VCENTER_FQDN>
    username: ${env:VCENTER_USERNAME}
    password: ${env:VCENTER_PASSWORD}
    collection_interval: 2m          # see section 09 before lowering
    initial_delay: 15s
    timeout: 100s                    # must stay below collection_interval
    max_query_metrics: 256           # at or below config.vpxd.stats.maxQueryMetrics
    tls:
      ca_file: /etc/otelcol-contrib/certs/vcenter-ca.pem
      # server_name_override: <VCENTER_FQDN>   # only if endpoint uses an IP address
    metrics:
      # Optional metrics worth turning on (state metrics need v0.166.0+)
      vcenter.host.connection.status:
        enabled: true
      vcenter.host.power.status:
        enabled: true
      vcenter.host.uptime:
        enabled: true
      vcenter.host.alarm.count:
        enabled: true
      vcenter.host.memory.ballooned:
        enabled: true
      vcenter.datastore.alarm.count:
        enabled: true
      vcenter.datastore.maintenance.status:
        enabled: true
      vcenter.vm.power.status:
        enabled: true
      # Per vCPU ready/wait/idle. Multiplies series by vCPU count; enable deliberately.
      # vcenter.vm.cpu.time:
      #   enabled: true
    resource_attributes:
      vcenter.vm_template.id:
        enabled: true                # example of the syntax; all are on by default

processors:
  memory_limiter:
    check_interval: 1s
    limit_percentage: 75
    spike_limit_percentage: 15

  resource_detection/env:            # site-wide labels from OTEL_RESOURCE_ATTRIBUTES
    detectors: [env]
    timeout: 2s
    override: false

  transform/vc01:                    # the receiver does not name its vCenter; we do
    metric_statements:
      - set(resource.attributes["vcenter.server"], "<VCENTER_FQDN>")

  batch:
    send_batch_size: 8192
    send_batch_max_size: 10000
    timeout: 5s

exporters:
  prometheus_remote_write:           # was "prometheusremotewrite" before v0.154.0
    http:
      # Prometheus: http(s)://<PROM_HOST>:9090/api/v1/write (needs --web.enable-remote-write-receiver)
      # Mimir:      https://<MIMIR_HOST>/api/v1/push
      endpoint: https://<METRICS_BACKEND>/api/v1/push
      tls:
        ca_file: /etc/otelcol-contrib/certs/backend-ca.pem
      # headers:
      #   X-Scope-OrgID: <TENANT_ID>   # Mimir multi-tenancy only
    resource_constant_labels:        # promote these resource attributes to labels
      included:
        - "vcenter.*"
        - "site"
        - "deployment.environment.name"
    remote_write_queue:
      enabled: true
      queue_size: 10000
      num_consumers: 5
    wal:
      directory: /var/lib/otelcol-contrib/prw-wal
    retry_on_failure:
      enabled: true
      max_elapsed_time: 15m

  debug:
    verbosity: basic

service:
  extensions: [health_check]
  telemetry:
    logs:
      level: info
  pipelines:
    metrics/vc01:
      receivers: [vcenter/vc01]
      processors: [memory_limiter, resource_detection/env, transform/vc01, batch]
      exporters: [prometheus_remote_write]

Why it looks like this

  • Named receiver and pipeline (vc01). Costs nothing now and makes the multi-vCenter layout in section 10 a copy and paste.
  • resource_detection/env, not system. The system detector would stamp the gateway VM’s own host.name on every vCenter metric. Someone will eventually confuse that with an ESX host. Reading OTEL_RESOURCE_ATTRIBUTES lets each gateway declare its site and environment from the same environment file that holds the credentials, with an identical YAML everywhere.
  • transform rather than resource. The resource processor still works, but its README now says it has been superseded by transform. The OTTL statement infers its context from the resource. prefix.
  • resource_constant_labels. Without it, the vcenter.* attributes only land in target_info. This option replaces the older resource_to_telemetry_conversion, which still exists but is marked deprecated. On older collectors use resource_to_telemetry_conversion: {enabled: true} instead.
  • WAL and a long retry window. The remote write queue is in memory by default and lost on restart. The WAL keeps samples across a collector restart. A 15 minute retry window covers a typical backend maintenance restart. The default is 5 minutes.
  • No debug exporter in the pipeline. It is declared so you can add it during troubleshooting with a one word change.

If your backend speaks OTLP, the alternative exporter is otlp_http. For Prometheus 3 started with --web.enable-otlp-receiver, set endpoint: http(s)://<PROM_HOST>:9090/api/v1/otlp. The exporter appends /v1/metrics, which gives the documented /api/v1/otlp/v1/metrics path. In that case label promotion is configured on the Prometheus side with otlp.promote_resource_attributes in prometheus.yml.

08. Enabling optional metrics and trimming the rest

Every metric is toggled the same way, under metrics in the receiver. The template already enables the state metrics that are cheap and useful. Two trims are worth making on most estates:

# Add under receivers.vcenter/vc01.metrics when the vCenter has NO vSAN clusters.
# With every vSAN metric disabled the receiver skips the vSAN queries entirely.
      vcenter.cluster.vsan.congestions:
        enabled: false
      vcenter.cluster.vsan.latency.avg:
        enabled: false
      vcenter.cluster.vsan.operations:
        enabled: false
      vcenter.cluster.vsan.throughput:
        enabled: false
      vcenter.host.vsan.cache.hit_rate:
        enabled: false
      vcenter.host.vsan.congestions:
        enabled: false
      vcenter.host.vsan.latency.avg:
        enabled: false
      vcenter.host.vsan.operations:
        enabled: false
      vcenter.host.vsan.throughput:
        enabled: false
      vcenter.vm.vsan.latency.avg:
        enabled: false
      vcenter.vm.vsan.operations:
        enabled: false
      vcenter.vm.vsan.throughput:
        enabled: false

# High cardinality on large estates: per vNIC packet rates for every VM.
# Keep throughput, drop the packet-rate breakdowns if nobody graphs them.
      vcenter.vm.network.packet.rate:
        enabled: false

The first block matters for load, not just storage. The receiver checks whether any vSAN metric is enabled before it issues vSAN queries, so leaving even one on keeps the queries running. The second is about series count. Every VM metric with an object attribute multiplies by the number of vNICs or virtual disks.

A word on statistics levels. The receiver’s documentation says host disk latency needs statistics level 2, host disk latency max level 3, host disk throughput level 4 and VM disk throughput level 2. Those levels are set per historical interval in vCenter, while the receiver queries the real-time interval. If one of these metrics is missing on your system, check the level first, but do not raise levels globally on a guess. The vCenter database growth is real.

09. Load on vCenter and tuning collection_interval

From the code, one scrape of one vCenter costs roughly:

  • A datacenter listing, then for each datacenter five container views with property retrieval (datastores, clusters, hosts, resource pools, VMs) plus resource pool and vApp inventory listing.
  • QueryPerf for hosts in batches of floor(max_query_metrics / 19) hosts, which is 13 per call at the default 256.
  • QueryPerf for VMs in batches of floor(max_query_metrics / 21) VMs, which is 12 per call at the default.
  • If vSAN metrics are enabled, three VsanPerfQueryPerf calls per cluster.
EstateHost QueryPerf callsVM QueryPerf callsvSAN callsCalls per hour at 2mat 1m
8 hosts, 200 VMs, 1 vSAN cluster1173about 630 plus inventoryabout 1,260
64 hosts, 2,000 VMs, 4 vSAN clusters516712about 5,500 plus inventoryabout 11,000
200 hosts, 6,000 VMs, no vSAN (disabled)165000about 15,500 plus inventoryabout 31,000

These are small calls against data vCenter already holds in memory for the real-time interval, so the numbers look worse than they feel on a healthy appliance. The cost that actually hurts is the property retrieval of every VM on every cycle, which scales with inventory size regardless of interval. Measure rather than guess: watch vCenter appliance CPU and memory in the VAMI or VCF Operations for an hour before and after you enable the receiver.

Choosing the interval

collection_intervalShare of real-time data you seeWhen to use it
60s1 in 3 samplesProduction clusters where you alert on latency or ready time and the vCenter has headroom
2m (default)1 in 6Reasonable general default up to a few thousand VMs
5m1 in 15Very large inventories or capacity trending only. Matches vSAN granularity. Watch Prometheus staleness (below).
Below 60sApproaches every sample at 20sRarely worth it. A scrape of a large vCenter can take longer than the interval, and the next sample does not exist until 20 s later anyway.

Three rules keep this sane. Keep timeout below the interval, so a stuck call fails one cycle instead of stacking cycles. If scrapes start failing with context deadline exceeded, the cycle no longer fits: split the work (section 10) before you lower the interval any further. And remember that Prometheus treats a series as stale after its default 5 minute lookback. At a 5 minute interval any single failed scrape produces a visible gap. Use last_over_time(...[10m]) in panels for slow interval data, or stay at 2 minutes.

10. Multi-vCenter layout

Each vCenter is polled separately, including vCenters in Enhanced Linked Mode. A session on one vCenter’s /sdk only sees that vCenter’s inventory. The design question is how to place receivers.

Site A Site B vcenter01 (mgmt) 40 hosts, 600 VMs vcenter02 (workload) 120 hosts, 3,500 VMs otel-gw-a1 (active) vcenter/vc01 + pipeline metrics/vc01 vcenter/vc02 + pipeline metrics/vc02 site=a from OTEL_RESOURCE_ATTRIBUTES vcenter.server set per pipeline otel-gw-a2 standby: same config, service stopped start only if a1 is down, never both poll 443 vcenter03 60 hosts, 1,500 VMs, vSAN otel-gw-b1 vcenter/vc03 + metrics/vc03 site=b local to its vCenter Central Mimir / Prometheus series keyed by vcenter_server, site, cluster, host, vm remote write + WAL remote write + WAL Dashed: API polling from gateway to vCenter. Solid: metrics pushed to the backend. Amber: standby, not running.
Figure 2. Pollers sit next to the vCenters they poll, one active poller per vCenter, and every series carries vcenter.server and site so clusters with the same name never collide.
LayoutProsConsUse when
One gateway, one receiver and pipeline per vCenterOne VM to run, simpleShared failure domain and memory budget. One slow vCenter does not block others (receivers scrape independently), but a collector restart stops all of them.Up to a handful of vCenters in one site
One gateway per sitePolls stay on the LAN, which matters because each scrape is hundreds of SOAP round tripsMore VMs to patchMultiple sites, which is most estates
One gateway per vCenterFull isolation, easy sizingMost VMsVery large vCenters, or when teams own different vCenters

Whatever you choose, run exactly one active poller per vCenter. Two collectors polling the same vCenter produce identical series from two writers, which shows up as duplicate or out of order sample errors at the backend and doubled load on vpxd. For availability, keep a cold standby with the same config and the service disabled, and start it from your runbook or automation. The gap during failover is a few scrape intervals, which is acceptable for infrastructure metrics.

Adding a second vCenter to the template is three blocks: a receiver, a transform and a pipeline. Credentials can be shared or per vCenter, and the per vCenter form is shown because a different SSO domain per site is common.

# Additions to the section 07 template for a second vCenter.
# secrets.env gains: VCENTER02_USERNAME=... and VCENTER02_PASSWORD=...

receivers:
  vcenter/vc02:
    endpoint: https://<VCENTER02_FQDN>
    username: ${env:VCENTER02_USERNAME}
    password: ${env:VCENTER02_PASSWORD}
    collection_interval: 2m
    initial_delay: 45s               # stagger start so both scrapes do not align
    timeout: 100s
    max_query_metrics: 256
    tls:
      ca_file: /etc/otelcol-contrib/certs/vcenter-ca.pem   # bundle may hold several roots
    # proxy_url: socks5://<PROXY_HOST>:1080            # per-receiver proxy, v0.166.0+

processors:
  transform/vc02:
    metric_statements:
      - set(resource.attributes["vcenter.server"], "<VCENTER02_FQDN>")

service:
  pipelines:
    metrics/vc02:
      receivers: [vcenter/vc02]
      processors: [memory_limiter, resource_detection/env, transform/vc02, batch]
      exporters: [prometheus_remote_write]

Separate pipelines are what make the per vCenter transform possible: a processor in a shared pipeline cannot tell which receiver a batch came from. If you manage more than three or four vCenters, generate this file rather than editing it by hand. Generating OTel Collector configs with PowerCLI does exactly that from your vCenter list.

11. Workflow: zero to verified metrics

Starting point: the collector VM from part 1, with otelcol-contrib 0.166.0 installed and the secrets.env drop-in in place.

Step 1. Network and DNS from the collector VM

getent hosts <VCENTER_FQDN>
curl -sk -o /dev/null -w "%{http_code}\n" https://<VCENTER_FQDN>/sdk/vimServiceVersions.xml

Expected: the vCenter IP, then 200. A timeout means a firewall between the gateway and vCenter on 443. The -k is only for this reachability test, step 3 fixes trust properly.

Step 2. Create the role and permission

Run New-OtelVcenterRole.ps1 from section 06 on an admin workstation. Verify: the script prints the three system privileges and a permission row with Propagate True on the root folder. Then log into the vSphere Client once as the service account and confirm you can see every cluster you expect. This is the cheapest test of propagation you will ever run.

Step 3. Trust the vCenter CA

sudo install -d -m 0755 /etc/otelcol-contrib/certs
cd "$(mktemp -d)"
# vCenter publishes its trusted root CAs here. Compare the fingerprint below with
# the one shown in vSphere Client > Administration > Certificates before trusting it.
curl -sk -o download.zip https://<VCENTER_FQDN>/certs/download.zip
unzip -q download.zip
cat certs/lin/*.0 | sudo tee /etc/otelcol-contrib/certs/vcenter-ca.pem > /dev/null
openssl x509 -in /etc/otelcol-contrib/certs/vcenter-ca.pem -noout -subject -fingerprint -sha256

openssl s_client -connect <VCENTER_FQDN>:443 -servername <VCENTER_FQDN> \
  -CAfile /etc/otelcol-contrib/certs/vcenter-ca.pem </dev/null 2>/dev/null | grep "Verify return code"

Expected: Verify return code: 0 (ok). If your vCenter machine certificate is issued by an enterprise CA instead of VMCA, put that CA chain in the file instead. A code of 20 or 21 means the file does not contain the CA that issued the vCenter certificate.

Step 4. Secrets and site attributes

sudoedit /etc/otelcol-contrib/secrets.env
# VCENTER_USERNAME=<SVC_ACCOUNT>@<DOMAIN>
# VCENTER_PASSWORD=<PASSWORD>
# OTEL_RESOURCE_ATTRIBUTES=deployment.environment.name=<ENV>,site=<SITE>

sudo install -d -m 0750 -o otelcol-contrib -g otelcol-contrib /var/lib/otelcol-contrib/prw-wal
ls -l /etc/otelcol-contrib/secrets.env

Expected: -rw-r----- root otelcol-contrib on the secrets file and a WAL directory owned by the service user.

Step 5. First run to the console only

Write the section 07 template to /etc/otelcol-contrib/config.yaml, but set the pipeline’s exporters to [debug] for this first run. Isolating the vCenter side first halves the troubleshooting space.

# Validate as the service user, with the same environment file the service loads,
# so ${env:...} placeholders resolve exactly as they will at runtime.
sudo systemd-run --quiet --pipe --wait \
  -p User=otelcol-contrib -p EnvironmentFile=/etc/otelcol-contrib/secrets.env \
  /usr/bin/otelcol-contrib validate --config=/etc/otelcol-contrib/config.yaml && echo CONFIG_OK
sudo systemctl restart otelcol-contrib
sleep 60
sudo journalctl -u otelcol-contrib --since "3 min ago" --no-pager | grep -E 'Everything is ready|vcenter|"data points"|error'

Expected: CONFIG_OK, the Everything is ready line, and after the initial delay a debug line with large "metrics" and "data points" counts. Validating through systemd-run matters here: a plain validate in your shell does not have secrets.env loaded, so it reports username not provided and is required even when the service would start fine. Errors containing unable to login to vcenter sdk or x509 go to the troubleshooting table.

Step 6. Confirm scrape health from internal metrics

curl -s http://127.0.0.1:8888/metrics | grep -E '^otelcol_scraper_(scraped|errored)_metric_points' | grep vcenter

Expected: an otelcol_scraper_scraped_metric_points line for vcenter/vc01 that grows every cycle, and either no errored line or one that stays flat. A growing errored counter means partial scrapes, usually vSAN or a permission gap. These two lines are what your collector health alert should watch.

Step 7. Switch to the real exporter

Set the pipeline’s exporters back to [prometheus_remote_write], validate, restart, and wait two cycles. Then query the backend from any machine that can reach it.

PROM=https://<PROMETHEUS_OR_MIMIR_QUERY_HOST>   # Mimir query path is usually /prometheus
curl -sG "$PROM/api/v1/query" \
  --data-urlencode 'query=count by (__name__) ({__name__=~"vcenter_.*", vcenter_server="<VCENTER_FQDN>"})' \
  | jq -r '.data.result[] | "\(.metric.__name__) \(.value[1])"' | sort

curl -sG "$PROM/api/v1/query" \
  --data-urlencode 'query=count(count by (vcenter_vm_name) (vcenter_vm_cpu_usage_MHz))' | jq -r '.data.result[0].value[1]'

Expected: one line per metric name, including vcenter_host_cpu_usage_MHz, vcenter_vm_cpu_readiness_percent and vcenter_datastore_disk_utilization_percent, each with a series count. The second query should return close to the number of powered on VMs, because CPU usage is only recorded for powered on VMs. If the names have no unit suffixes, your backend or exporter is using a different translation strategy. Adjust queries rather than fighting it.

Step 8. Cross-check one VM against the perf chart

Pick a busy VM. Open its real-time Performance chart in the vSphere Client and compare with:

vcenter_vm_cpu_usage_MHz{vcenter_vm_name="<VM_NAME>"}
vcenter_vm_disk_latency_avg_milliseconds{vcenter_vm_name="<VM_NAME>", direction="read"}
vcenter_vm_memory_usage_mebibytes{vcenter_vm_name="<VM_NAME>"}

Expected: CPU MHz and virtual disk latency land on values you can see in the perf chart at the scrape timestamps. Memory matches Active, not Consumed. If memory looks “too low”, that is the reason. Write the result in the change record. It is your evidence the pipeline is trustworthy.

Step 9. Alert on the collector itself

# Grafana or Prometheus alert expression: fires if a vCenter stops producing data.
absent_over_time(vcenter_host_cpu_usage_MHz{vcenter_server="<VCENTER_FQDN>"}[10m])

Expected: no result while data flows. Stop the collector for 10 minutes in a maintenance window to prove the rule fires, then start it again. Part 4 builds the full alert set.

12. Troubleshooting

SymptomLikely causeCheckFix
x509: certificate signed by unknown authorityCollector does not trust the VMCA or enterprise CAopenssl s_client ... -CAfile vcenter-ca.pem as in step 3Populate tls.ca_file with the correct root chain. Do not reach for insecure_skip_verify outside a lab.
x509: certificate is valid for ..., not ...Endpoint uses an IP or alias not in the certificate SANopenssl x509 -noout -ext subjectAltName on the served certificateUse the FQDN in endpoint, or set tls.server_name_override to the certificate name.
unable to login to vcenter sdkWrong username format, wrong password, locked or expired account, or env var not loadedLog into the vSphere Client as the account. systemctl show otelcol-contrib -p EnvironmentFilesUse user@domain form, fix the secret, unlock the account, check SSO password lifetime.
unable to connect to vSphere SDKDNS, routing, firewall or proxyStep 1 commands from the collector VMOpen 443 to vCenter. If a proxy is required, set proxy_url on the receiver.
Whole clusters or datacenters missing, no errorsPermission not at root, or propagation offGet-VIPermission -Principal for the service account. Log in to the vSphere Client as it.Grant the role at the root folder with propagation. “Permission denied” in vSphere usually looks like “object does not exist”.
Fault mentioning vpxd.stats.maxQueryMetricsmax_query_metrics above the vCenter limitvCenter advanced setting config.vpxd.stats.maxQueryMetricsSet max_query_metrics at or below that value. Raise the vCenter setting only following Broadcom KB 301449.
Host or VM disk latency or throughput missingStatistics level below the documented requirement, or NFS datastorevCenter > Configure > Settings > General > Statistics. Check datastore type.Raise the level for the 5 minute interval only if justified. For NFS see the NFS latency post.
No vSAN metricsNo vSAN, vSAN performance service off, or all vSAN metrics disabledCluster > Configure > vSAN > Services > Performance service. Set collector log level to debug for one cycle.Enable the performance service, or disable vSAN metrics to skip the queries.
failed to retrieve vSAN metrics for ... every cyclevSAN query failing for a reason other than NotSupported or NotFoundFull error in journalctlFix the vSAN side, or disable vSAN metrics for that vCenter receiver.
Sawtooth gaps in graphsScrape takes longer than the interval, or interval near Prometheus 5 minute stalenessLook for context deadline exceeded in the collector log. Check otelcol_scraper_errored_metric_points.Raise timeout and the interval, split vCenters across pipelines or gateways, use last_over_time for slow data.
Remote write out of order or duplicate sample errorsTwo collectors polling the same vCenter, or parallel requests to a backend without out of order supportCheck every gateway’s config for the same endpointOne active poller per vCenter. If the backend lacks out of order support, set max_batch_request_parallelism: 1.
Queries return metrics without vcenter_vm_name labelsResource attributes not promotedQuery target_info for the same jobAdd resource_constant_labels (or the older resource_to_telemetry_conversion) to the exporter.
Two clusters’ data mergedSame cluster name in two vCenters, no vCenter labelcount by (vcenter_server) (vcenter_cluster_host_count)Add the transform that sets vcenter.server per pipeline.
Warning: deprecated component typeOld names like prometheusremotewrite or resourcedetectionjournalctl -u otelcol-contrib | grep -i deprecatRename to the snake_case form.

13. What’s next

You now have vCenter metrics flowing through an OTel pipeline with a least privilege account, proper TLS and labels that survive a second vCenter. Metrics only tell half the story on ESX, though. Part 3 brings ESX syslog into the same gateway and parses vmkernel, hostd and vobd messages into attributes, so an all paths down event lands next to the latency graph that preceded it. Part 4 then builds the Prometheus or Mimir, Loki and Tempo backends and the Grafana dashboards on top of these metric names. If you are planning a large estate, read sizing the OTel Collector for vSphere before you commit to a layout, and NFS datastore latency with OpenTelemetry if your datastores are NFS, because this receiver cannot see that path. For the statistics model underneath all of this, my earlier post on wiring Grafana into vCenter still applies, and NFSv3 and NFSv4.1 in vSphere covers the storage side.

Verified against the vcenter receiver README, metadata.yaml, documentation.md, config.go and scraper source at opentelemetry-collector-contrib v0.166.0, the prometheus_remote_write, transform and resource_detection READMEs at the same tag, and the opentelemetry-collector-releases packaging. The receiver is alpha: metric names and defaults can change, so re-check documentation.md before each upgrade. Load figures are derived from the receiver’s batching logic, not measured on a specific vCenter. Validate collection load against your own appliance before production.

3 responses

  1. […] validated config per vCenter, including the calculator inputs. The receiver itself is covered in Part 2, the syslog pipeline and its parsing cost in Part 3, and the Prometheus, Loki and Tempo side in […]

  2. […] vCenter tells you a datastore went inaccessible. It rarely tells you that the host logged its first NFS timeout four minutes earlier, that two other hosts on the same array saw the same thing, or that a SCSI sense code from the array was the real cause. That detail lives in vmkernel.log, vobd.log and hostd.log on every host, and most teams only read it after the incident, over SSH, one host at a time. This part of the series streams those logs off every ESXi host into an OpenTelemetry Collector, turns the lines that matter into structured events (APD, PDL, SCSI sense codes, vMotion failures, hostd crashes, VOB problems), stamps each one with the host name, and lands it in Loki where it can sit on the same Grafana screen as the vCenter metrics from part 2. […]

  3. […] series so far built one collector by hand: the vcenter receiver in part 2, the ESXi syslog pipeline in part 3, and the exporters to Prometheus, Mimir and Loki in part 4. […]

Leave a Reply