diff --git a/collector/client.go b/collector/client.go index 60ccd24..68aff45 100644 --- a/collector/client.go +++ b/collector/client.go @@ -143,7 +143,7 @@ func (c *Client) GetClusterSettings() (map[string]interface{}, error) { c.logger.Debug("Getting cluster settings") resp, err := c.es.Cluster.GetSettings( c.es.Cluster.GetSettings.WithIncludeDefaults(true), - c.es.Cluster.GetSettings.WithFilterPath("persistent.cluster.routing.allocation.exclude"), + c.es.Cluster.GetSettings.WithFilterPath("*.cluster.routing.allocation.exclude"), ) if err != nil { return nil, fmt.Errorf("error getting response: %s", err) diff --git a/collector/cluster-settings.go b/collector/cluster-settings.go index c161c03..6ab69f4 100644 --- a/collector/cluster-settings.go +++ b/collector/cluster-settings.go @@ -37,7 +37,17 @@ func (c *ClusterSettingsCollector) Collect(ch chan<- prometheus.Metric) { if len(settings) == 0 { ch <- prometheus.MustNewConstMetric(c.excludeExists, prometheus.CounterValue, 0, "persistent") + ch <- prometheus.MustNewConstMetric(c.excludeExists, prometheus.CounterValue, 0, "transient") } else { - ch <- prometheus.MustNewConstMetric(c.excludeExists, prometheus.CounterValue, 1, "persistent") + if settings["persistent"] == nil { + ch <- prometheus.MustNewConstMetric(c.excludeExists, prometheus.CounterValue, 0, "persistent") + } else { + ch <- prometheus.MustNewConstMetric(c.excludeExists, prometheus.CounterValue, 1, "persistent") + } + if settings["transient"] == nil { + ch <- prometheus.MustNewConstMetric(c.excludeExists, prometheus.CounterValue, 0, "transient") + } else { + ch <- prometheus.MustNewConstMetric(c.excludeExists, prometheus.CounterValue, 1, "transient") + } } }