From 67edb782d37ce5195fb824d1f5bac3dd5f44ec33 Mon Sep 17 00:00:00 2001 From: spaceman83 <85797740+spaceman83@users.noreply.github.com> Date: Wed, 4 Jan 2023 14:55:35 +0100 Subject: [PATCH] Update vmware_exporter.py Add support for vm storage committed/uncommited metrics --- vmware_exporter/vmware_exporter.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/vmware_exporter/vmware_exporter.py b/vmware_exporter/vmware_exporter.py index e497fa2..c08512b 100755 --- a/vmware_exporter/vmware_exporter.py +++ b/vmware_exporter/vmware_exporter.py @@ -145,6 +145,16 @@ def _create_metric_containers(self): 'vmware_vm_template', 'VMWare VM Template (true / false)', labels=self._labelNames['vms']), + + 'vmware_vm_storage_committed': GaugeMetricFamily( + 'vmware_vm_storage_committed', + 'VMWare VM committed storage', + labels=self._labelNames['vms']), + + 'vmware_vm_storage_uncommitted': GaugeMetricFamily( + 'vmware_vm_storage_uncommitted', + 'VMWare VM uncommitted storage', + labels=self._labelNames['vms']), } metric_list['vmguests'] = { 'vmware_vm_guest_disk_free': GaugeMetricFamily( @@ -748,6 +758,8 @@ def vm_inventory(self): 'summary.config.memorySizeMB', 'runtime.maxCpuUsage', 'summary.config.template', + 'summary.storage.committed', + 'summary.storage.uncommitted', ]) if self.collect_only['vmguests'] is True: @@ -1584,6 +1596,12 @@ def _vmware_get_vms(self, metrics): if 'summary.config.template' in row: metrics['vmware_vm_template'].add_metric(labels, row['summary.config.template']) + if 'summary.storage.committed' in row: + metrics['vmware_vm_storage_committed'].add_metric(labels, row['summary.storage.committed']) + + if 'summary.storage.uncommitted' in row: + metrics['vmware_vm_storage_uncommitted'].add_metric(labels, row['summary.storage.uncommitted']) + if 'guest.disk' in row and len(row['guest.disk']) > 0: for disk in row['guest.disk']: metrics['vmware_vm_guest_disk_free'].add_metric(