Skip to content

Commit

Permalink
Extend storage info (#312)
Browse files Browse the repository at this point in the history
  • Loading branch information
znerol authored Jan 2, 2025
1 parent 53016ad commit 36db723
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
9 changes: 6 additions & 3 deletions README.rst
Original file line number Diff line number Diff line change
Expand Up @@ -126,6 +126,9 @@ Here's an example of the metrics exported.
# TYPE pve_up gauge
pve_up{id="node/proxmox"} 1.0
pve_up{id="qemu/100"} 1.0
pve_up{id="storage/proxmox/local"} 1.0
pve_up{id="storage/proxmox/local-lvm"} 1.0
pve_up{id="storage/proxmox/vms"} 1.0
# HELP pve_disk_size_bytes Storage size in bytes (for type 'storage'), root image size for VMs (for types 'qemu' and 'lxc').
# TYPE pve_disk_size_bytes gauge
pve_disk_size_bytes{id="qemu/100"} 6.8719476736e+010
Expand Down Expand Up @@ -211,9 +214,9 @@ Here's an example of the metrics exported.
pve_guest_info{id="qemu/100",name="samplevm1",node="proxmox",type="qemu",tags="tag1;tag2"} 1.0
# HELP pve_storage_info Storage info
# TYPE pve_storage_info gauge
pve_storage_info{id="storage/proxmox/local",node="proxmox",storage="local"} 1.0
pve_storage_info{id="storage/proxmox/local-lvm",node="proxmox",storage="local-lvm"} 1.0
pve_storage_info{id="storage/proxmox/vms",node="proxmox",storage="vms"} 1.0
pve_storage_info{content="iso,vztmpl,rootdir",id="storage/proxmox/local",node="proxmox",plugintype="dir",storage="local"} 1.0
pve_storage_info{content="backup",id="storage/proxmox/local-lvm",node="proxmox",plugintype="lvm",storage="local-lvm"} 1.0
pve_storage_info{content="images",id="storage/proxmox/vms",node="proxmox",plugintype="rbd",storage="vms"} 1.0
# HELP pve_node_info Node info
# TYPE pve_node_info gauge
pve_node_info{id="node/proxmox",level="",name="proxmox",nodeid="0"} 1.0
Expand Down
8 changes: 6 additions & 2 deletions src/pve_exporter/collector/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@ def collect(self): # pylint: disable=missing-docstring
label_values = [resource['id']]
status_metrics.add_metric(label_values, resource['status'] == 'running')

for resource in self._pve.cluster.resources.get(type='storage'):
label_values = [resource['id']]
status_metrics.add_metric(label_values, resource['status'] == 'available')

yield status_metrics


Expand Down Expand Up @@ -325,7 +329,7 @@ def collect(self): # pylint: disable=missing-docstring
'storage': GaugeMetricFamily(
'pve_storage_info',
'Storage info',
labels=['id', 'node', 'storage']),
labels=['id', 'node', 'storage', 'plugintype', 'content']),
}

info_lookup = {
Expand All @@ -338,7 +342,7 @@ def collect(self): # pylint: disable=missing-docstring
'gauge': info_metrics['guest'],
},
'storage': {
'labels': ['id', 'node', 'storage'],
'labels': ['id', 'node', 'storage', 'plugintype', 'content'],
'gauge': info_metrics['storage'],
},
}
Expand Down

0 comments on commit 36db723

Please sign in to comment.