From c3ae9ee11e746b162ac067459560dd688d803135 Mon Sep 17 00:00:00 2001 From: Dirk Mueller Date: Tue, 20 Apr 2021 08:55:57 +0200 Subject: [PATCH] cib: expose crm_config as well This allows, amongst other things, to access the cib-bootstrap-options-cluster-name and stonith-enabled parameters --- collector/pacemaker/cib/data.go | 3 +++ collector/pacemaker/cib/parser_test.go | 2 ++ 2 files changed, 5 insertions(+) diff --git a/collector/pacemaker/cib/data.go b/collector/pacemaker/cib/data.go index 799b7e3..690d6fd 100644 --- a/collector/pacemaker/cib/data.go +++ b/collector/pacemaker/cib/data.go @@ -10,6 +10,9 @@ https://clusterlabs.org/pacemaker/doc/en-US/Pacemaker/2.0/html-single/Pacemaker_ type Root struct { Configuration struct { + CrmConfig struct { + ClusterProperties []Attribute `xml:"cluster_property_set>nvpair"` + } `xml:"crm_config"` Nodes []struct { Id string `xml:"id,attr"` Uname string `xml:"uname,attr"` diff --git a/collector/pacemaker/cib/parser_test.go b/collector/pacemaker/cib/parser_test.go index 1fec2fd..2a2fcf6 100644 --- a/collector/pacemaker/cib/parser_test.go +++ b/collector/pacemaker/cib/parser_test.go @@ -16,6 +16,8 @@ func TestParse(t *testing.T) { data, err := p.Parse() assert.NoError(t, err) assert.Equal(t, 2, len(data.Configuration.Nodes)) + assert.Equal(t, "cib-bootstrap-options-cluster-name", data.Configuration.CrmConfig.ClusterProperties[3].Id) + assert.Equal(t, "hana_cluster", data.Configuration.CrmConfig.ClusterProperties[3].Value) assert.Equal(t, "node01", data.Configuration.Nodes[0].Uname) assert.Equal(t, "node02", data.Configuration.Nodes[1].Uname) assert.Equal(t, 4, len(data.Configuration.Resources.Primitives))