cv4pve-metrics-exporter is a Prometheus metrics exporter designed to provide comprehensive monitoring data for Proxmox VE virtualization infrastructure.
Key Features:
Exports detailed Prometheus metrics for monitoring and alerting.
Monitors node health, VM/container resource usage, storage capacity, replication status, and High Availability (HA) resources.
Offers customizable endpoints and supports API token authentication for secure access.
Audience & Benefit:
Ideal for Proxmox VE administrators seeking to enhance infrastructure monitoring. This tool enables proactive management of virtualized environments by providing actionable insights into resource utilization, system health, and HA configurations.
The software is available via winget for Windows users.
# Check available releases and get the specific version number
# Visit: https://github.com/Corsinvest/cv4pve-metrics-exporter/releases
# Download specific version (replace VERSION with actual version like v1.5.0)
wget https://github.com/Corsinvest/cv4pve-metrics-exporter/releases/download/VERSION/cv4pve-metrics-exporter-linux-x64.zip
# Alternative: Get latest release URL programmatically
LATEST_URL=$(curl -s https://api.github.com/repos/Corsinvest/cv4pve-metrics-exporter/releases/latest | grep browser_download_url | grep linux-x64 | cut -d '"' -f 4)
wget "$LATEST_URL"
# Extract and make executable
unzip cv4pve-metrics-exporter-linux-x64.zip
chmod +x cv4pve-metrics-exporter
# Optional: Move to system path
sudo mv cv4pve-metrics-exporter /usr/local/bin/
Windows Installation
Option 1: Winget (Recommended)
# Install using Windows Package Manager
winget install Corsinvest.cv4pve.metrics-exporter
Option 2: Manual Installation
# Check available releases at: https://github.com/Corsinvest/cv4pve-metrics-exporter/releases
# Download specific version (replace VERSION with actual version)
Invoke-WebRequest -Uri "https://github.com/Corsinvest/cv4pve-metrics-exporter/releases/download/VERSION/cv4pve-metrics-exporter.exe-win-x64.zip" -OutFile "cv4pve-metrics-exporter.zip"
# Extract
Expand-Archive cv4pve-metrics-exporter.zip -DestinationPath "C:\Tools\cv4pve-metrics-exporter"
# Add to PATH (optional)
$env:PATH += ";C:\Tools\cv4pve-metrics-exporter"
macOS Installation
# Check available releases at: https://github.com/Corsinvest/cv4pve-metrics-exporter/releases
# Download specific version (replace VERSION with actual version)
wget https://github.com/Corsinvest/cv4pve-metrics-exporter/releases/download/VERSION/cv4pve-metrics-exporter-osx-x64.zip
unzip cv4pve-metrics-exporter-osx-x64.zip
chmod +x cv4pve-metrics-exporter
# Move to applications
sudo mv cv4pve-metrics-exporter /usr/local/bin/
Configuration
Command Line Options
Usage:
cv4pve-metrics-exporter [options] [command]
Options:
--host (REQUIRED) The host name host[:port],host1[:port],host2[:port]
--username User name @
--password The password. Specify 'file:path_file' to store password in file.
--api-token Api token format 'USER@REALM!TOKENID=UUID'. Require Proxmox VE 6.2 or later
--validate-certificate Validate SSL Certificate Proxmox VE node.
--service-mode Run as background service (runs until stopped, no Enter key)
--version Show version information
-?, -h, --help Show help and usage information
Commands:
prometheus Export for Prometheus
# Basic usage with username/password
cv4pve-metrics-exporter --host=192.168.0.100 --username=root@pam --password=YOUR_PASSWORD prometheus
# Using API token (recommended)
cv4pve-metrics-exporter --host=192.168.0.100 --api-token=metrics-user@pve!metrics=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx prometheus
# Multiple hosts for HA
cv4pve-metrics-exporter --host=pve1.local:8006,pve2.local:8006,pve3.local:8006 --username=root@pam --password=YOUR_PASSWORD prometheus
# Custom Prometheus endpoint
cv4pve-metrics-exporter --host=192.168.0.100 --username=root@pam --password=YOUR_PASSWORD prometheus --http-host=0.0.0.0 --http-port=9090 --http-url=pve-metrics/
# Using password from file
echo "YOUR_PASSWORD" > /etc/cv4pve/password
cv4pve-metrics-exporter --host=192.168.0.100 --username=root@pam --password=file:/etc/cv4pve/password prometheus
# With SSL certificate validation
cv4pve-metrics-exporter --host=192.168.0.100 --username=root@pam --password=YOUR_PASSWORD --validate-certificate prometheus
Deployment Options
Console Mode (Default)
Run the exporter in interactive mode. The exporter will wait for you to press Enter to stop.
./cv4pve-metrics-exporter --host=pve.local --username=root@pam --password=YOUR_PASSWORD prometheus
# Metrics exporter is running. Press Enter to stop...
Best for: Development, testing, and debugging.
Service Mode
Run the exporter as a background service without console interaction. The exporter will continue running until stopped with Ctrl+C.
./cv4pve-metrics-exporter --host=pve.local --username=root@pam --password=YOUR_PASSWORD --service-mode prometheus
# Exporter is running in background. Press Ctrl+C to stop.
Best for: Production environments where you want the exporter to run continuously.
Windows Service with NSSM
For Windows systems, use NSSM (Non-Sucking Service Manager) to run the exporter as a proper Windows service.
# Download NSSM: https://nssm.cc/download
# Install the service
nssm install cv4pve-metrics-exporter "C:\Tools\cv4pve-metrics-exporter\cv4pve-metrics-exporter.exe" `
--host=pve.local `
--api-token=metrics@pve!metrics=xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx `
--service-mode `
prometheus `
--http-host=0.0.0.0
# Start the service
nssm start cv4pve-metrics-exporter
# View logs
nssm tail cv4pve-metrics-exporter
# Stop the service
nssm stop cv4pve-metrics-exporter
# Uninstall the service
nssm remove cv4pve-metrics-exporter confirm
Linux Systemd Service
For Linux systems, create a systemd service file.
# Create service file
sudo nano /etc/systemd/system/cv4pve-metrics-exporter.service
Note: The lock label shows why a VM/CT is locked (backup in progress, snapshot being created, etc.). This enhanced visibility is unique to cv4pve-metrics-exporter.
CPU Metrics
cv4pve_cpu_usage_ratio - CPU usage ratio (0.0 to 1.0)
cv4pve_cpu_usage_limit - CPU limit (number of cores)
Labels:
id - VM/CT ID
Memory Metrics
cv4pve_memory_size_bytes - Configured memory size
cv4pve_memory_usage_bytes - Current memory usage
Labels:
id - VM/CT ID
Disk Metrics
cv4pve_disk_size_bytes - Total disk size
cv4pve_disk_usage_bytes - Current disk usage
cv4pve_disk_read_bytes - Total bytes read
cv4pve_disk_write_bytes - Total bytes written
Labels:
id - VM/CT ID
Network Metrics
cv4pve_network_transmit_bytes - Total bytes transmitted
cv4pve_network_receive_bytes - Total bytes received
Labels:
id - VM/CT ID
cv4pve_uptime_seconds
Guest uptime in seconds.
Labels:
id - VM/CT ID
Balloon Memory Metrics (QEMU VMs only)
cv4pve_balloon_actual_bytes - Actual balloon memory
cv4pve_balloon_max_mem_bytes - Maximum balloon memory
cv4pve_balloon_last_update_bytes - Last balloon update value
Labels:
id - VM ID
Note: Balloon memory allows dynamic memory management for QEMU VMs.
cv4pve_host_memory_usage_bytes
Host memory usage for guest.
Labels:
id - VM/CT ID
cv4pve_onboot_status
Guest auto-start configuration. Value is 1 when onboot is enabled, 0 otherwise.
Labels:
id - VM/CT ID
Storage Metrics
cv4pve_storage_info
Storage information. Value is always 1.
Labels:
id - Storage identifier
node - Node name (for local storage) or empty for shared storage
shared - Is shared storage (true/false)
enabled - Is storage enabled (true/false)
active - Is storage active (true/false)
disk_size - Total disk size in bytes (e.g., "1099511627776" for 1TB)
Note: Including disk size and usage in labels (rather than separate metrics) allows for better grouping and filtering in Prometheus queries. This is an enhanced feature of cv4pve-metrics-exporter.
High Availability (HA) Metrics
cv4pve_ha_resource_info
High Availability resource information. Value is 1 when resource is started, 0 otherwise.
Labels:
sid - Service ID (format: vm:ID or ct:ID)
state - HA state (e.g., "started", "stopped", "disabled")
cv4pve-metrics-exporter provides several enhancements over the standard prometheus-pve-exporter:
Lock Status Visibility: The lock label in cv4pve_guest_info shows why a VM/CT is locked (backup, snapshot, migrate, etc.)
Subscription Monitoring: cv4pve_node_subscription_info tracks subscription status and support level for each node
Storage in Labels: Disk size and usage are included as labels in cv4pve_storage_info for better query flexibility
HA Resource Monitoring: cv4pve_ha_resource_info provides visibility into High Availability configurations
SMART Disk Health: Comprehensive disk health metrics including wearout indicators
Native C# Implementation: Better performance and cross-platform support
Service Mode: Built-in support for running as a system service with proper lifecycle management
Flexible Deployment: Single binary with no runtime dependencies
API Token Setup
For Proxmox VE 6.2 and later, using API tokens is recommended:
Create API Token
Log into Proxmox VE web interface
Go to Datacenter → Permissions → API Tokens
Click Add
Fill in the details:
User: root@pam (or create dedicated user)
Token ID: metrics
Privilege Separation: Uncheck for full permissions (or configure specific permissions)
Click Add
Save the token secret - it will only be shown once!
Required Permissions
If using privilege separation, the token needs:
Path: /
Role: PVEAuditor (read-only access)
# Create dedicated user for metrics (optional)
pveum user add metrics-user@pve
# Create API token
pveum user token add metrics-user@pve metrics --privsep 0
# Or with privilege separation (more secure)
pveum user token add metrics-user@pve metrics --privsep 1
pveum aclmod / -user metrics-user@pve -role PVEAuditor
Troubleshooting
Connection Issues
# Test connection to Proxmox VE API
curl -k https://YOUR_HOST:8006/api2/json/version
# Check if exporter is running
curl http://localhost:9221/metrics/
# Verify API token
pveum user token list
Common Issues
Issue: Connection refused
Check firewall rules on Proxmox VE host (port 8006)
Verify network connectivity: ping YOUR_HOST
Issue: SSL certificate validation failed
Use --validate-certificate only with valid SSL certificates
For self-signed certificates, omit this flag
Issue: Permission denied
Verify API token or user has sufficient permissions