Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var Command = &cobra.Command{ Use: "health", Short: "Check health of wfx", Long: "Check health wfx", TraverseChildren: true, Run: func(cmd *cobra.Command, _ []string) { tty := isatty.IsTerminal(os.Stdout.Fd()) colorMode := flags.Koanf.String(colorFlag) var useColor bool switch colorMode { case colorAlways: useColor = true case colorAuto: useColor = tty case colorNever: useColor = false default: log.Warn().Str("color", colorMode).Msg("Unsupported color mode") } allEndpoints := []endpoint{ { Name: "northbound", URL: fmt.Sprintf("http://%s:%d/health", flags.Koanf.String(flags.MgmtHostFlag), flags.Koanf.Int(flags.MgmtPortFlag)), Status: health.StatusUnknown, }, { Name: "southbound", URL: fmt.Sprintf("http://%s:%d/health", flags.Koanf.String(flags.ClientHostFlag), flags.Koanf.Int(flags.ClientPortFlag)), Status: health.StatusUnknown, }, { Name: "northbound_tls", URL: fmt.Sprintf("https://%s:%d/health", flags.Koanf.String(flags.MgmtTLSHostFlag), flags.Koanf.Int(flags.MgmtTLSPortFlag)), Status: health.StatusUnknown, }, { Name: "southbound_tls", URL: fmt.Sprintf("https://%s:%d/health", flags.Koanf.String(flags.ClientTLSHostFlag), flags.Koanf.Int(flags.ClientTLSPortFlag)), Status: health.StatusUnknown, }, } client := http.Client{ Transport: &http.Transport{ TLSClientConfig: &tls.Config{ InsecureSkipVerify: true, }, TLSHandshakeTimeout: time.Second * 10, }, Timeout: time.Second * 10, } for i := range allEndpoints { updateStatus(&allEndpoints[i], &client) } filter, rawOutput := flags.Koanf.String(flags.FilterFlag), flags.Koanf.Bool(flags.RawFlag) if tty && filter == "" && !rawOutput { prettyReport(cmd.OutOrStderr(), useColor, allEndpoints) } else { baseCmd := flags.NewBaseCmd() _ = baseCmd.DumpResponse(cmd.OutOrStdout(), allEndpoints) } }, }
Functions ¶
This section is empty.
Types ¶
This section is empty.
Click to show internal directories.
Click to hide internal directories.