mirror of
https://github.com/recklessop/Zerto_Exporter.git
synced 2026-07-02 23:53:13 -04:00
Add VmSourceVRA label and resolve VRA names for VM metrics
- Add VmSourceVRA to _VM_LABELS, populated from vm['OwningHostName'] resolved to a VRA name via a host→VRA lookup built from zvm.vras() - VmRecoveryVRA now also resolves to the actual VRA name (e.g. Z-VRA-192.168.50.21) instead of the raw ESXi host IP - Cloud-target VPGs (Azure/AWS) correctly emit VmRecoveryVRA="" since there is no local VRA on the recovery side - Bump version to 3.1.0 Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -94,7 +94,7 @@ g_ds_zerto_appliances_used = Gauge('datastore_usage_zerto_appliances_used
|
|||||||
g_ds_zerto_appliances_provisioned = Gauge('datastore_usage_zerto_appliances_provisionedinbytes', 'Datastore Zerto Appliances Provisioned In Bytes', _DS_LABELS)
|
g_ds_zerto_appliances_provisioned = Gauge('datastore_usage_zerto_appliances_provisionedinbytes', 'Datastore Zerto Appliances Provisioned In Bytes', _DS_LABELS)
|
||||||
|
|
||||||
# VM metrics (GetDataFunc - VMs section)
|
# VM metrics (GetDataFunc - VMs section)
|
||||||
_VM_LABELS = ['VmIdentifier', 'VmName', 'VmRecoveryVRA', 'VmPriority', 'SiteIdentifier', 'VpgName', 'SiteName']
|
_VM_LABELS = ['VmIdentifier', 'VmName', 'VmSourceVRA', 'VmRecoveryVRA', 'VmPriority', 'SiteIdentifier', 'VpgName', 'SiteName']
|
||||||
g_vm_actualrpo = Gauge('vm_actualrpo', 'VM Actual RPO', _VM_LABELS)
|
g_vm_actualrpo = Gauge('vm_actualrpo', 'VM Actual RPO', _VM_LABELS)
|
||||||
g_vm_throughput = Gauge('vm_throughput_in_mb', 'VM Throughput In MB', _VM_LABELS)
|
g_vm_throughput = Gauge('vm_throughput_in_mb', 'VM Throughput In MB', _VM_LABELS)
|
||||||
g_vm_iops = Gauge('vm_iops', 'VM IOPs', _VM_LABELS)
|
g_vm_iops = Gauge('vm_iops', 'VM IOPs', _VM_LABELS)
|
||||||
@@ -337,6 +337,12 @@ def GetDataFunc(zvm_instance):
|
|||||||
else:
|
else:
|
||||||
log.debug("No Datastores Found")
|
log.debug("No Datastores Found")
|
||||||
|
|
||||||
|
## Build host → VRA name lookup for source/recovery VRA labels
|
||||||
|
host_to_vra = {}
|
||||||
|
vras_for_lookup = zvm.vras()
|
||||||
|
if vras_for_lookup:
|
||||||
|
host_to_vra = {v['HostDisplayName']: v['VraName'] for v in vras_for_lookup}
|
||||||
|
|
||||||
## VMs API
|
## VMs API
|
||||||
log.debug("Getting VMs API")
|
log.debug("Getting VMs API")
|
||||||
vms_json = zvm.vms()
|
vms_json = zvm.vms()
|
||||||
@@ -355,7 +361,8 @@ def GetDataFunc(zvm_instance):
|
|||||||
lbl = dict(
|
lbl = dict(
|
||||||
VmIdentifier=str(vm['VmIdentifier']),
|
VmIdentifier=str(vm['VmIdentifier']),
|
||||||
VmName=str(vm['VmName']),
|
VmName=str(vm['VmName']),
|
||||||
VmRecoveryVRA=str(vm["RecoveryHostName"]),
|
VmSourceVRA=host_to_vra.get(str(vm['OwningHostName']), ''),
|
||||||
|
VmRecoveryVRA=host_to_vra.get(str(vm['RecoveryHostName']), ''),
|
||||||
VmPriority=str(vm['Priority']),
|
VmPriority=str(vm['Priority']),
|
||||||
SiteIdentifier=str(siteId),
|
SiteIdentifier=str(siteId),
|
||||||
VpgName=str(vm['VpgName']),
|
VpgName=str(vm['VpgName']),
|
||||||
|
|||||||
+1
-1
@@ -1,5 +1,5 @@
|
|||||||
# version.py
|
# version.py
|
||||||
VERSION = "3.0.0"
|
VERSION = "3.1.0"
|
||||||
|
|
||||||
def main():
|
def main():
|
||||||
# Put your main program code here
|
# Put your main program code here
|
||||||
|
|||||||
Reference in New Issue
Block a user