mirror of
https://gitee.com/rainbond/Rainbond.git
synced 2024-12-02 11:47:36 +08:00
change grctl cluster command
This commit is contained in:
parent
7e876b223f
commit
2c48069187
@ -21,6 +21,7 @@ package cmd
|
||||
import (
|
||||
"fmt"
|
||||
"os"
|
||||
"os/exec"
|
||||
"strconv"
|
||||
"strings"
|
||||
|
||||
@ -88,22 +89,8 @@ func getClusterInfo(c *cli.Context) error {
|
||||
}())+"%")
|
||||
fmt.Println(table)
|
||||
|
||||
//show services health status
|
||||
allNodeHealth, err := clients.RegionClient.Nodes().GetAllNodeHealth()
|
||||
handleErr(err)
|
||||
serviceTable2 := termtables.CreateTable()
|
||||
serviceTable2.AddHeaders("Service", "HealthyQuantity/Total", "Message")
|
||||
serviceStatusInfo := allNodeHealth
|
||||
status, message := clusterStatus(serviceStatusInfo["Role"], serviceStatusInfo["Ready"])
|
||||
serviceTable2.AddRow("\033[0;33;33mClusterStatus\033[0m", status, message)
|
||||
for name, v := range serviceStatusInfo {
|
||||
if name == "Role" {
|
||||
continue
|
||||
}
|
||||
status, message := summaryResult(v)
|
||||
serviceTable2.AddRow(name, status, message)
|
||||
}
|
||||
fmt.Println(serviceTable2.Render())
|
||||
//show component health status
|
||||
printComponentStatus()
|
||||
//show node detail
|
||||
serviceTable := termtables.CreateTable()
|
||||
serviceTable.AddHeaders("Uid", "IP", "HostName", "NodeRole", "Status")
|
||||
@ -232,3 +219,7 @@ func clusterStatus(roleList []map[string]string, ReadyList []map[string]string)
|
||||
}
|
||||
return clusterStatus, errMessage
|
||||
}
|
||||
|
||||
func printComponentStatus() {
|
||||
exec.Command("kubectl", "get", "pod", "-n", "rbd-system", "-o", "wide").Run()
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user