Add tags collector exposing vSphere tag assignments for VMs - #47
Open
poulpreben wants to merge 2 commits into
Open
Add tags collector exposing vSphere tag assignments for VMs#47poulpreben wants to merge 2 commits into
poulpreben wants to merge 2 commits into
Conversation
Logs into the vAPI REST endpoint alongside the existing SOAP session
(only when the tags collector is enabled) and emits
vmware_vm_tag{vmmo,vm,category,tag,vcenter} = 1 for every tag attached
to a virtual machine, ready to join onto other VM metrics via vmmo.
Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
poulpreben
marked this pull request as ready for review
July 6, 2026 11:26
Emits one gauge per virtual disk with the configured capacity in bytes, labelled with a stable 0-based disk index (ordered by controller bus, then unit number, then device key) and the vSphere device label. Requires fetching config.hardware.device in the VM property collector. Also fixes the copy-pasted description on vmware_vm_datastore_capacity_used. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com>
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.
What
Adds a new
tagscollector that exposes vSphere tag assignments for virtual machines, so tag/category metadata can be joined onto the existing VM metrics in PromQL.For every tag attached to a VM it emits:
which joins onto any other VM metric via the
vmmolabel, e.g.:How
vmware/collectors/tags.go(new): registers atagscollector (flag-collector.tags, enabled by default, honors-disable.default.collectors). It fetches all VM refs/names through the property collector (nameonly, so the property fetch stays cheap), resolves tag categories once per scrape, then callsGetAttachedTagsOnObjectsin batches of 500 VMs per vAPI request.vmware/api/vmware.go: tags live behind the vAPI REST endpoint, which needs its own session on top of the SOAP one.Loginnow also creates the REST session and stores atags.ManagerinloginData- but only when the tags collector is enabled, so nothing changes for users who disable it.Logouttears the REST session down.README.md: documents the new flag and metric.No new dependencies - only the
vapi/restandvapi/tagspackages from the already-vendored govmomi version.Testing
go build ./...,go vet ./...and the existing test suite pass.vmware_scrape_collector_success{collector="tags"} 1, and the collector completed in ~0.35s for an inventory of several hundred VMs - comparable to thevmcollector on the same scrape.🤖 Generated with Claude Code