1
0
mirror of https://github.com/prometheus-pve/prometheus-pve-exporter.git synced 2025-04-18 19:04:06 +03:00

Extend storage info (#312)

This commit is contained in:
znerol 2025-01-02 17:04:36 +01:00 committed by GitHub
parent 53016ad3d0
commit 36db723d73
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
2 changed files with 12 additions and 5 deletions

View File

@ -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
@ -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

View File

@ -43,6 +43,10 @@ class StatusCollector:
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
@ -325,7 +329,7 @@ class ClusterResourcesCollector:
'storage': GaugeMetricFamily(
'pve_storage_info',
'Storage info',
labels=['id', 'node', 'storage']),
labels=['id', 'node', 'storage', 'plugintype', 'content']),
}
info_lookup = {
@ -338,7 +342,7 @@ class ClusterResourcesCollector:
'gauge': info_metrics['guest'],
},
'storage': {
'labels': ['id', 'node', 'storage'],
'labels': ['id', 'node', 'storage', 'plugintype', 'content'],
'gauge': info_metrics['storage'],
},
}