VMOMI Exporter
This repository provides Prometheus exporter for vSphere infrastructure.
It collects and exposes vSphere performance metrics for monitoring.
Features
- Collects vSphere performance counters
- Flexible configuration for target entities and metrics
- Exposes metrics at
/metrics for Prometheus scraping
- Includes exporter process and Go runtime metrics
Labels
Expose metrics with follow labels.
| Label |
Description |
| counter_id |
Internal identifier for counter |
| counter_stat |
Kind of statistics for counter |
| counter_unit |
Unit of value for counter |
| counter_interval |
Interval for counter |
| entity_id |
Internal identifier for entiry |
| entity_name |
Display name for entity |
| entity_type |
Kind for entity |
| entity_instance |
Instance of entity for counter |
Build
Build binary.
go build -o bin/vmomi-exporter ./cmd/vmomi-exporter
Or build container image.
docker build -t vmomi-exporter .
Add Z option at bind mount operation in Dockerfile if using podman with SELinux.
Usage
Run application.
$ ./bin/vmomi-exporter -h
VMOMI Exporter
Usage:
vmomi-exporter [flags]
vmomi-exporter [command]
Available Commands:
completion Generate the autocompletion script for the specified shell
config VMOMI Exporter Config
counter VMOMI Exporter Counter
entity VMOMI Exporter Entity
help Help about any command
instance VMOMI Exporter Instance
interval VMOMI Exporter Interval
perf VMOMI Exporter Performance
Flags:
--config string Config file path.
--entity-chunk-size int Entity chunk size. (default 10)
--exporter string Exporter URL. (default "127.0.0.1:9247")
-h, --help help for vmomi-exporter
--log-level string Log level. (default "INFO")
--max-concurrency int Max concurrency. (default 5)
--no-verify-ssl Skip SSL verification.
--password string vSphere server password.
--timeout int API call timeout seconds. (default 10)
--url string vSphere server URL. (default "https://127.0.0.1/sdk")
--user string vSphere server username.
-v, --version version for vmomi-exporter
Use "vmomi-exporter [command] --help" for more information about a command.
Set environment variable instead of arguments.
| Argument |
Environment Variable |
| --config |
VMOMI_EXPORTER_CONFIG |
| --entity-chunk-size |
VMOMI_EXPORTER_TARGET_ENTITY_CHUNK_SIZE |
| --exporter |
VMOMI_EXPORTER_URL |
| --log-level |
VMOMI_EXPORTER_LOG_LEVEL |
| --max-concurrency |
VMOMI_EXPORTER_TARGET_MAX_CONCURRENCY |
| --no-verify-ssl |
VMOMI_EXPORTER_TARGET_NO_VERIFY_SSL |
| --password |
VMOMI_EXPORTER_TARGET_PASSWORD |
| --timeout |
VMOMI_EXPORTER_TARGET_TIMEOUT |
| --url |
VMOMI_EXPORTER_TARGET_URL |
| --user |
VMOMI_EXPORTER_TARGET_USER |
Or run container.
docker run -d \
-e VMOMI_EXPORTER_TARGET_URL=<URL> \
-e VMOMI_EXPORTER_TARGET_USER=<USER> \
-e VMOMI_EXPORTER_TARGET_PASSWORD=<PASSWORD> \
-p 9247:9247 \
vmomi-exporter
Subcommands
config: Show current configuration
counter: List available performance counters
entity: List available entities
instance: List available performance instances
interval: List available performance counter interval
perf: Show performace value
Configuration
Configure the exporter using the --config option. See examples/all.yaml for a full example.
Default Configuration
The default configuration is to acquire CPU usage and memory usage of all host and virtual machine.
counters:
- group: cpu
name: usage
rollup: average
- group: cpu
name: usagemhz
rollup: average
- group: mem
name: usage
rollup: average
objects:
- type: HostSystem
- type: VirtualMachine
roots:
- type: Folder
name: ""
retrieve:
ignore_datastore_vm_relation: true
ignore_network_vm_relation: true
Definition
counters defines the counter described on PerformanceManager.
objects defined the type of ManagedEntity described on ManagedObjectReference.
| key |
valye |
| counters |
List counters. |
| counters.group |
groupInfo in PerfCounterInfo. |
| counters.name |
nameInfo in PerfCounterInfo. |
| counters.rollup |
rollupType in PerfCounterInfo. |
| objects |
List target objects. |
| objects.type |
type in ManagedObjectReference. |
| roots |
List root objects. |
| roots.type |
type in ManagedObjectReference. |
| roots.name |
name in ManagedEntity. |
| retrieve.ignore_datastore_vm_relation |
whether ignore datastore and virtual machine relation. |
| retrieve.ignore_network_vm_relation |
whether ignore network and virtual machine relation. |
vmomi-exporter counter command acquires all counters from target environment.
vmomi-exporter entity command acquires all entities from target environment.
The roots is to restrict target entity.
Acquires the performance values of entities under the specified roots entities.
Entity tree is here.

# Example: for all virtual machine on host 'host.domain'.
counters:
...
objects:
- type: VirtualMachine
roots:
- type: HostSystem
name: host.domain
Notes
- In large environment, occur error.