mirror of
https://github.com/recklessop/Zerto_Exporter.git
synced 2026-07-07 01:33:14 -04:00
Update python-node-exporter.py
removing data from the VM api for VMs recovering to a site
This commit is contained in:
@@ -173,8 +173,8 @@ def GetStatsFunc():
|
||||
statsapi = requests.get(url=uri, timeout=3, headers=h2, verify=verifySSL)
|
||||
statsapi_json = statsapi.json()
|
||||
#log.debug(statsapi_json)
|
||||
|
||||
for vm in statsapi_json:
|
||||
#log.debug(vm)
|
||||
oldvmdata = dict()
|
||||
|
||||
CurrentIops = 0
|
||||
@@ -352,7 +352,11 @@ def GetDataFunc():
|
||||
log.debug(vmapi_json)
|
||||
for vm in vmapi_json :
|
||||
log.debug("Processing VM: " + str(vm['VmName']))
|
||||
log.debug(vm)
|
||||
log.debug("Checking VM " + vm['VmIdentifier'] + " on Protected Site " + vm['ProtectedSite']['identifier'] + " against " + siteId)
|
||||
|
||||
if siteId == vm['ProtectedSite']['identifier']:
|
||||
log.debug("Found VM " + vm['VmIdentifier'] + " on Protected Site")
|
||||
|
||||
if not isinstance(vm["ActualRPO"], int):
|
||||
vm["ActualRPO"] = -1
|
||||
metricsDictionary["vm_actualrpo{VmIdentifier=\"" + str(vm['VmIdentifier']) + "\",VmName=\"" + str(vm['VmName']) + "\",VmRecoveryVRA=\"" + str(vm["RecoveryHostName"]) + "\",VmPriority=\"" + str(vm['Priority']) + "\",SiteIdentifier=\"" + str(siteId) + "\",SiteName=\"" + str(siteName) + "\"}"] = vm["ActualRPO"]
|
||||
@@ -368,6 +372,10 @@ def GetDataFunc():
|
||||
metricsDictionary["vm_substatus{VmIdentifier=\"" + vm['VmIdentifier'] + "\",VmName=\"" + str(vm['VmName']) + "\",VmRecoveryVRA=\"" + str(vm["RecoveryHostName"]) + "\",VmPriority=\"" + str(vm['Priority']) + "\",SiteIdentifier=\"" + siteId + "\",SiteName=\"" + siteName + "\"}"] = vm["SubStatus"]
|
||||
log.debug("Processed VM: " + str(vm['VmName']))
|
||||
|
||||
else:
|
||||
log.debug("VM " + vm['VmIdentifier'] + " is protected to this site")
|
||||
|
||||
|
||||
## Volumes API for Scratch Volumes
|
||||
log.debug("Getting Scratch Volumes")
|
||||
uri = "https://" + zvm_url + ":" + zvm_port + "/v1/volumes?volumeType=scratch"
|
||||
@@ -412,7 +420,7 @@ def GetDataFunc():
|
||||
if(bool(volapi_json)):
|
||||
log.debug("Journal Volumes Exist")
|
||||
for volume in volapi_json :
|
||||
log.debug("Journal Volume: " + volume['ProtectedVm']['Name'] + "Calculating total size")
|
||||
log.debug("Journal Volume: " + volume['ProtectedVm']['Name'] + " Calculating total size...")
|
||||
#metricsDictionary["scratch_volume_provisioned_size_in_bytes{ProtectedVm=\"" + volume['ProtectedVm']['Name'] + "\", ProtectedVmIdentifier=\"" + volume['ProtectedVm']['Identifier'] + "\", OwningVRA=\"" + volume['OwningVm']['Name'] + "\"}"] = volume["Size"]["ProvisionedInBytes"]
|
||||
# Determine the key for a given VM, then see if the key is already in the dictionary, if it is add the next disk to the total. If not, create a new key.
|
||||
metrickey = "vm_journal_volume_size_in_bytes{ProtectedVm=\"" + volume['ProtectedVm']['Name'] + "\", ProtectedVmIdentifier=\"" + volume['ProtectedVm']['Identifier'] + "\", OwningVRA=\"" + volume['OwningVm']['Name'] + "\",SiteIdentifier=\"" + siteId + "\",SiteName=\"" + siteName + "\"}"
|
||||
|
||||
Reference in New Issue
Block a user