[FIX] fix bug

This commit is contained in:
zhoujunhao 2018-07-30 16:54:03 +08:00
parent a6e771eacb
commit 0930968492
4 changed files with 9 additions and 11 deletions

View File

@ -59,7 +59,7 @@ func getClusterInfo(c *cli.Context) error {
list, err := clients.RegionClient.Nodes().List()
handleErr(err)
serviceTable2 := termtables.CreateTable()
serviceTable2.AddHeaders("Service", "Status", "Message")
serviceTable2.AddHeaders("Service", "HealthyQuantity/Total", "Message")
serviceStatusInfo := getServicesHealthy(list)
for name, v := range serviceStatusInfo {
if name == string(client.NodeReady){

View File

@ -26,7 +26,6 @@ import (
"io/ioutil"
"os"
"strings"
"github.com/Sirupsen/logrus"
"github.com/apcera/termtables"
"github.com/goodrain/rainbond/api/util"
@ -113,12 +112,6 @@ func handleStatus(serviceTable *termtables.Table, ready bool, v *client.HostNode
}
func handleResult(table *uitable.Table, v *client.HostNode) {
table.AddRow("Title", "Result", "Message")
table.AddRow("Uid:", v.ID)
table.AddRow("IP:", v.InternalIP)
table.AddRow("HostName:", v.HostName)
extractReady(table, v, "Ready")
fmt.Printf("------------------------%s----------------------------\n", "Service Health")
for _, v := range v.NodeStatus.Conditions {
if v.Type == client.NodeReady{
@ -231,6 +224,12 @@ func NewCmdNode() cli.Command {
table := uitable.New()
table.Wrap = true // wrap columns
fmt.Printf("------------------------%s----------------------------\n", v.HostName)
table.AddRow("Title", "Result", "Message")
table.AddRow("Uid:", v.ID)
table.AddRow("IP:", v.InternalIP)
table.AddRow("HostName:", v.HostName)
extractReady(table, v, "Ready")
fmt.Printf("------------------------%s----------------------------\n", "Service Health")
handleResult(table, v)
fmt.Println(table)

View File

@ -34,7 +34,6 @@ type Config struct {
RemoteWriteConfigs []*RemoteWriteConfig `yaml:"remote_write,omitempty"`
RemoteReadConfigs []*RemoteReadConfig `yaml:"remote_read,omitempty"`
Templates []string `yaml:"templates,omitempty"`
// original is the input from which the config was parsed.
original string

View File

@ -73,7 +73,7 @@ func NewManager(config *option.Config) *Manager {
ScrapeInterval: model.Duration(time.Second * 5),
EvaluationInterval: model.Duration(time.Second * 30),
},
Templates: []string{"/etc/prometheus/alerting/default_rules.yml"},
RuleFiles:[]string{"/etc/prometheus/default_rules.yml"},
},
Registry: reg,
httpClient: client,
@ -238,7 +238,7 @@ func SaveAlertingRulesConfig() error {
return err
}
err = ioutil.WriteFile("/etc/prometheus/alerting/default_rules.yml", data, 0644)
err = ioutil.WriteFile("/etc/prometheus/default_rules.yml", data, 0644)
if err != nil {
logrus.Error("Write alerting rules config file error.", err.Error())
return err