Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 5 additions & 1 deletion prometheus-pacemaker-exporter.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,8 @@ def collect(self):
value=p_time(summary.find('last_change').attrib['time']))
yield GaugeMetricFamily('pacemaker_dc_present', 'Whether the cluster has an active DC',
value=p_bool(summary.find('current_dc').attrib['present']))
yield GaugeMetricFamily('pacemaker_dc_with_quorum', 'Whether the cluster has quorum',
if summary.find('current_dc').attrib['present'] == 'true':
yield GaugeMetricFamily('pacemaker_dc_with_quorum', 'Whether the cluster has quorum',
value=p_bool(summary.find('current_dc').attrib['with_quorum']))
yield GaugeMetricFamily('pacemaker_nodes_configured', 'Number of configured nodes',
value=int(summary.find('nodes_configured').attrib['number']))
Expand Down Expand Up @@ -109,6 +110,9 @@ def collect(self):
elif node.tag == 'clone':
for i, resource in enumerate(node.findall('resource')):
resource_elements.append((p_bool(node.attrib['unique']), str(i), resource))
elif node.tag == 'group':
for i, resource in enumerate(node.findall('resource')):
resource_elements.append((True, str(i), resource))

resource_metrics = {
'active': (p_bool, RGauge('resource_active', 'Resource is active')),
Expand Down