From 54abee373d2dad796f45b87211defee6c22830f4 Mon Sep 17 00:00:00 2001 From: jacky-xbb Date: Tue, 8 Aug 2023 17:23:54 +0800 Subject: [PATCH] feat: modify the condition for cluster health --- client/client_4.x.go | 6 +++--- client/client_5.x.go | 6 +++--- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/client/client_4.x.go b/client/client_4.x.go index 2098310..0a85880 100644 --- a/client/client_4.x.go +++ b/client/client_4.x.go @@ -89,14 +89,14 @@ func (n *cluster4x) getClusterStatus() (cluster collector.ClusterStatus, err err return } - cluster.Status = healthy + cluster.Status = unhealthy cluster.NodeUptime = make(map[string]int64) cluster.NodeMaxFDs = make(map[string]int) cluster.CPULoads = make(map[string]collector.CPULoad) for _, data := range resp.Data { - if data.NodeStatus != "Running" { - cluster.Status = unhealthy + if data.NodeStatus == "Running" { + cluster.Status = healthy } nodeName := cutNodeName(data.Node) cluster.NodeUptime[nodeName] = parseUptimeFor4x(data.Uptime) diff --git a/client/client_5.x.go b/client/client_5.x.go index 2da0527..57cca97 100644 --- a/client/client_5.x.go +++ b/client/client_5.x.go @@ -65,14 +65,14 @@ func (n *cluster5x) getClusterStatus() (cluster collector.ClusterStatus, err err return } - cluster.Status = healthy + cluster.Status = unhealthy cluster.NodeUptime = make(map[string]int64) cluster.NodeMaxFDs = make(map[string]int) cluster.CPULoads = make(map[string]collector.CPULoad) for _, data := range resp { - if data.NodeStatus != "running" { - cluster.Status = unhealthy + if data.NodeStatus == "running" { + cluster.Status = healthy } nodeName := cutNodeName(data.Node) cluster.NodeUptime[nodeName] = data.Uptime / 1000