feat(vmware-vsphere8): add the VCF Operations Real-Time Metrics source (--metrics-source=rtm) - #6428
Open
julienmathis wants to merge 1 commit into
Conversation
julienmathis
requested review from
jean-christophe81,
sdepassio and
sechkem
and removed request for
a team
September 9, 2026 08:22
Adds --metrics-source=rtm, reading performance counters from the Real-Time Metrics
API of VCF Operations. This is the replacement Broadcom officially offers for the
vStats API removed in vSphere 9.1, alongside the vim25 source already available.
The API is not served by vCenter. It belongs to VCF Operations, requires its
Real-Time Metrics component to be deployed and a collection profile to be enabled,
and authenticates with a JWT bearer token rather than a vCenter session. The source
therefore takes its own address and credentials through the --rtm-* options, and is
never selected by --metrics-source=auto: picking another appliance implicitly would
be surprising, and it is unavailable to standalone vCenter customers.
Authentication follows the documented three-step sequence, and the resulting JWT is
cached for its announced validity so the sequence is not replayed on every check:
POST /suite-api/api/auth/token/acquire -> OpsToken
GET /suite-api/api/integrations/services -> service key of the VCF_VODAP entry
POST /suite-api/api/auth/token/exchange -> JWT bearer token
Counters are then read with the Prometheus-compatible endpoints of the appliance,
GET <base path>/v1/query and GET <base path>/v1/metadata.
No mode is modified: counter ids keep their vStats naming and the mapping to PromQL
metric names lives in the new package. Every metric name is validated against the
/v1/metadata catalogue before being queried, so an unknown name is reported with the
option to correct it rather than silently collecting nothing. The label carrying the
managed object id is discovered from the series the appliance returns, and the value
to pin is printed in the long output.
Units follow the same rule as the vim25 source: a conversion between incompatible
dimensions is refused rather than reporting a wrong value.
An empty result is disambiguated with one selector-less query, so a wrong resource id
or a wrong label is reported explicitly instead of looking like an idle resource.
The two misconfigurations that would otherwise be silent, a missing VCF_VODAP service
and a disabled collection profile, each get their own actionable message.
No new packaging dependency: the source only needs JSON, already declared.
julienmathis
force-pushed
the
feat/vmware-vsphere8-realtime-metrics-api
branch
from
September 9, 2026 09:39
4d99276 to
298559c
Compare
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Centreon team (internal PR)
Description
#6425 restores metric collection on vSphere 9.1 through the vim25
PerformanceManager, which is the pragmatic answer: it works today, on any vCenter, with no extra infrastructure.This PR adds the other answer — the one Broadcom officially designates as the replacement for the removed vStats API: the VCF Operations Real-Time Metrics API. It is exposed as
--metrics-source=rtm.It is deliberately shipped as a second source rather than as the answer, because it carries constraints the vim25 source does not.
Why it is not, and cannot be, the default
Two consequences drive the design:
--metrics-source=autonever selectsrtm. Silently redirecting collection to a different appliance, with different credentials, would be surprising and would fail for everyone who does not run VCF. It must be asked for explicitly.Worth remembering, and it is why this PR exists now rather than later: the ESXi Top profile delivers 2-second granularity that neither vStats nor vim25 can reach. When the fleet moves to VCF 9.1+, this becomes the interesting source rather than the constrained one.
Type of change
What this PR adds
The documented API surface, implemented in full
Authentication is the three-step sequence from the Real-Time Metrics API reference:
The JWT is cached for its announced validity (with a 60 s safety margin), so the three calls are not replayed on every check — verified below. A
401/403on a query re-authenticates once, then gives up.Counters are read with the Prometheus-compatible endpoints, under a configurable base path defaulting to
/data-query-service:GET <base>/v1/queryGET <base>/v1/metadataPUT /v1/vcenters/{vcId}/metrics_configexists and toggles the STANDARD / VERBOSE profiles, but is deliberately not implemented: a monitoring plugin has no business mutating the collection configuration of the system it observes. Enabling the profile stays an explicit operator action, documented below.The same safety rules as #6425
No mode is modified. Counter ids keep their vStats naming (
cpu.capacity.usage.HOST); the mapping to PromQL metric names lives entirely in the new package, so the three sources are interchangeable behind one option.Every metric name is validated against
/v1/metadatabefore being queried. An unknown name produces an error naming the metric, the counter and the fix, instead of an empty result.The identifying label is discovered, not guessed. The plugin inspects the labels of the series the appliance actually returns to find which one carries the managed object id, then prints the value to pin:
Units are never converted across dimensions. Same rule as vim25: a conversion that would turn kilobytes into hertz is refused rather than reporting a wrong number.
Empty results are disambiguated. An empty PromQL result is ambiguous — an idle resource, or a selector matching nothing. One selector-less query tells them apart, so a wrong resource id or a wrong label is reported explicitly:
This matters: without it, the two most likely misconfigurations would look exactly like the silent failure #6425 was written to eliminate.
The two prerequisite failures get their own message. A missing component and a disabled profile are the two things a first-time user will hit:
New options
--rtm-metric-mapis the escape hatch: if the appliance publishes a metric under a name we do not know, the operator fixes it from the command line without waiting for a release. It is the direct answer to the main limitation below.How this pull request can be tested ?
Automated tests
63 assertions (38 in #6425, 25 added here):
--rtm-hostname/username/passwordrequired,--rtm-metric-mapparsed, malformed entry refused--rtm-metric-map; an override wins and does not leak into the package-level tableManual end-to-end verification
No VCF Operations appliance was available, so verification used a mock implementing the documented contract (source at the end). It honours PromQL label selectors, so a wrong selector genuinely returns an empty result as a real endpoint would.
OK: CPU average usage is 40.00 %, used frequency is 3200000 kHz--rtm-moid-label=moidVCF_VODAPservice absentUNKNOWN: No 'VCF_VODAP' service is registered ... (found: VCF_AUTOMATION)+ install pathUNKNOWN: ... advertises no metric+ policy pathUNKNOWN: Could not acquire a VCF Operations token ...--rtm-metric-mapto an unknown metricUNKNOWN: Metric 'does_not_exist' ... is not advertised--rtm-metric-mapUNKNOWN: Malformed --rtm-metric-map value 'pasdegal'--rtm-moid-labelUNKNOWN: ... has 1 series but none with vcenter="host-35"+ labels seenUNKNOWN: ... none with moid="host-999"+ values seen--rtm-hostnameThe value is identical across all three sources —
3200 MHzfrom RTM,3200000 kHzfrom vim25,3200000from vStats all render as40.00 %and3200000 kHz. That cross-source agreement is the point of keeping the conversion layer.JWT caching, verified
Three consecutive runs sharing a statefile directory, counting calls on
token/acquire:One authentication for three checks: the cache works and VCF Operations is not hammered.
Non-regression on #6425
Re-run after this PR's changes to
api.pm:autoOK ... 3200000 kHzauto/sdknever called--metrics-source=bogusUNKNOWN: Unsupported --metrics-source 'bogus'. Expected one of: auto, vstats, vim25, rtm.Command line
The vCenter options are still required: inventory (resolving
--esx-nameto an id, listing objects) keeps going to the vCenter REST API. Only the counters come from VCF Operations.Prerequisites on the appliance, for whoever tests this
vCenter / Standardand/orHost System / ESX Top. Essentials is always on and cannot be disabled; Standard and ESXi Top require the Real-Time Metrics component to be scaled from Small to Large.https://<vcf-instance-services-fqdn>/data-query-service/swagger-ui/index.html, also reachable from Build → Developer Center → APIs & SDKs.curl examples
Full authentication sequence and a first query:
The second command is the one to run first on a real appliance: it prints the real metric names, which is exactly what this PR needs validated.
Known limitations — please challenge these
%counter_mapfollow the VCF Operations vCenter-adapter convention but are not verified against a real appliance. The design contains that risk deliberately — every name is validated against/v1/metadatabefore use, a mismatch is a loud error naming the fix, and--rtm-metric-mapcorrects any of them without a release. But expect the first run against a real VCF Operations to need a handful of--rtm-metric-mapentries, and please send them back so the table can be corrected.unitfield that is empty in practice, so the unit is inferred from the metric name suffix as the convention dictates. If a name is corrected via--rtm-metric-mapand its unit differs, the value would be wrong — the dimension check only catches incompatible dimensions, not a kilobytes/megabytes mix-up. Documented in the module header; a--rtm-unit-mapcompanion option is the obvious follow-up if the field reports it is needed./v1/query) are used./v1/query_rangewould be needed for rate or average-over-window counters, which no current mode requires.PUT /v1/vcenters/{vcId}/metrics_configis not implemented, on purpose (see above).HostSystemandVirtualMachineresources, as in the other two sources.Checklist
Mock VCF Operations appliance used for the end-to-end verification (standalone, click to expand)
Implements the documented contract: three-step authentication,
/v1/metadata,/v1/querywith real PromQL label-selector filtering.MODEisok,nordm(VCF_VODAP not registered) ornoprofile(empty catalogue).Run it next to the vCenter 9.1 mock from #6425, then:
References