Skip to content

Commit

Permalink
Adding template label (#208)
Browse files Browse the repository at this point in the history
  • Loading branch information
spearcrow authored Jan 3, 2024
1 parent e364c5d commit 816b6e2
Showing 1 changed file with 4 additions and 4 deletions.
8 changes: 4 additions & 4 deletions src/pve_exporter/collector/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,7 +209,7 @@ def collect(self): # pylint: disable=missing-docstring
'guest': GaugeMetricFamily(
'pve_guest_info',
'VM/CT info',
labels=['id', 'node', 'name', 'type']),
labels=['id', 'node', 'name', 'type', 'template']),
'storage': GaugeMetricFamily(
'pve_storage_info',
'Storage info',
Expand All @@ -218,11 +218,11 @@ def collect(self): # pylint: disable=missing-docstring

info_lookup = {
'lxc': {
'labels': ['id', 'node', 'name', 'type'],
'labels': ['id', 'node', 'name', 'type', 'template'],
'gauge': info_metrics['guest'],
},
'qemu': {
'labels': ['id', 'node', 'name', 'type'],
'labels': ['id', 'node', 'name', 'type', 'template'],
'gauge': info_metrics['guest'],
},
'storage': {
Expand All @@ -235,7 +235,7 @@ def collect(self): # pylint: disable=missing-docstring
restype = resource['type']

if restype in info_lookup:
label_values = [resource.get(key, '') for key in info_lookup[restype]['labels']]
label_values = [str(resource.get(key, '')) for key in info_lookup[restype]['labels']]
info_lookup[restype]['gauge'].add_metric(label_values, 1)

label_values = [resource['id']]
Expand Down

0 comments on commit 816b6e2

Please sign in to comment.