diff --git a/prometheus-pacemaker-exporter.py b/prometheus-pacemaker-exporter.py index d563988..fc976c4 100755 --- a/prometheus-pacemaker-exporter.py +++ b/prometheus-pacemaker-exporter.py @@ -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'])) @@ -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')),