Glance ESXi Stats Widget
March 3, 2026 · View on GitHub
This widget is a custom widget for Glance that displays statistics from a Vmware ESXi host.

Features
- Displays connection status of the ESXi host.
- Visualizes CPU and RAM usage with progress bars.
- Shows total uptime.
- Lists active VMs with their individual CPU and memory usage.
Prerequisites
- A running Vmware ESXi host.
- Glance installed and running.
Installation
Method 1: Docker Compose (Recommended)
Add the following service to your docker-compose.yml file:
glance-esxi-bridge:
image: ghcr.io/lumitesi/glance-esxi-stats:latest
container_name: glance-esxi-bridge
restart: unless-stopped
environment:
- ESXI_HOST=192.168.1.1
- ESXI_USER=root
- ESXI_PASSWORD=password
ports:
- 8080:8080
Method 2: Manual / Local Python
If you prefer to run the script directly on your host machine:
- Clone this repository:
git clone https://github.com/lumitesi/glance-esxi-stats.git cd glance-esxi-stats - Install dependencies:
pip install pyvmomi - Run the script:
export ESXI_HOST=192.168.1.1 export ESXI_USER=root export ESXI_PASSWORD=password python3 esxi-bridge.py
Configuration
Environment Variables
| Variable | Description | Default |
|---|---|---|
ESXI_HOST | IP address or hostname of your ESXi server. | 192.168.1.1 |
ESXI_USER | Username for ESXi authentication. | root |
ESXI_PASSWORD | Password for ESXi authentication. | password |
PORT | Port for the bridge service to listen on. | 8080 |
Glance Configuration
Add the following widget configuration to your glance.yml:
- type: custom-api
title: Virtualization Hosts
cache: 1m
url: http://glance-esxi-bridge:8080/stats
method: GET
template: |
{{ $host := index .JSON.Value.hosts 0 }}
<div class="server">
<div class="server-info">
<div class="server-details">
<div class="server-name color-highlight size-h3 text-truncate">
{{ $host.name }}
</div>
<div>
{{ if eq $host.connection_state "connected" }}
<span class="color-success">● Connected</span>
{{ else }}
<span class="color-danger">● {{ $host.connection_state }}</span>
{{ end }}
</div>
</div>
</div>
<div class="server-stats">
<div class="flex-1">
<div class="flex items-end size-h5">
<div>CPU</div>
{{ $cpuPerc := mul (div $host.cpu_usage_mhz $host.cpu_total_mhz) 100 }}
<div class="color-highlight margin-left-auto text-very-compact">
<span>{{ printf "%.0f" $cpuPerc }}</span> <span class="color-base">%</span>
</div>
</div>
<div class="progress-bar progress-bar-combined">
<div class="progress-value{{ if ge $cpuPerc 80.0 }} progress-value-notice{{ end }}" style="width: {{ printf "%.0f" $cpuPerc }}%"></div>
</div>
<div class="text-right size-caption text-secondary">
{{ printf "%.1f" (div $host.cpu_usage_mhz 1000.0) }} / {{ printf "%.1f" (div $host.cpu_total_mhz 1000.0) }} GHz
</div>
</div>
<div class="flex-1">
<div class="flex justify-between items-end size-h5">
<div>RAM</div>
{{ $memPerc := mul (div $host.memory_usage_mb $host.memory_total_mb) 100 }}
<div class="color-highlight text-very-compact">
<span>{{ printf "%.0f" $memPerc }}</span> <span class="color-base">%</span>
</div>
</div>
<div class="progress-bar progress-bar-combined">
<div class="progress-value{{ if ge $memPerc 80.0 }} progress-value-notice{{ end }}" style="width: {{ printf "%.0f" $memPerc }}%"></div>
</div>
<div class="text-right size-caption text-secondary">
{{ printf "%.1f" (div $host.memory_usage_mb 1024.0) }} / {{ printf "%.1f" (div $host.memory_total_mb 1024.0) }} GB
</div>
</div>
</div>
<div class="flex justify-between margin-top-2">
<span class="text-secondary">Uptime</span>
<span>{{ div $host.uptime 86400.0 | printf "%.1f" }} days</span>
</div>
<hr />
<div class="flex flex-column gap-2 margin-top-2">
<span class="text-secondary size-caption">Active VMs</span>
{{ range .JSON.Value.vms }}
<div class="flex justify-between size-caption gap-2">
<span class="color-highlight text-truncate" style="min-width: 0;">{{ .name }}</span>
<span class="text-secondary" style="white-space: nowrap;">{{ div .cpu_usage_mhz 1000.0 | printf "%.2f" }} GHz / {{ div .memory_usage_mb 1024.0 | printf "%.1f" }} GB</span>
</div>
{{ else }}
<div class="text-secondary size-caption">No active VMs</div>
{{ end }}
</div>
</div>