func Health(loggerName config.LoggerName, confPath *string, flagNoColor *bool) *cobra.Command {
	return &cobra.Command{
		Use:          "health",
		Short:        "Print the current agent health",
		Long:         ``,
		SilenceUsage: true,
		RunE: func(cmd *cobra.Command, args []string) error {

			if *flagNoColor {
				color.NoColor = true
			}

			if flavor.GetFlavor() == flavor.ClusterAgent {
				config.Datadog.SetConfigName("datadog-cluster")
			}

			// Set up config without secrets so that running the health command (e.g. from container
			// liveness probe script) does not trigger a secret backend command call.
			err := common.SetupConfigWithoutSecrets(*confPath, "")
			if err != nil {
				return fmt.Errorf("unable to set up global agent configuration: %v", err)
			}

			err = config.SetupLogger(loggerName, config.GetEnvDefault("DD_LOG_LEVEL", "off"), "", "", false, true, false)
			if err != nil {
				fmt.Printf("Cannot setup logger, exiting: %v\n", err)
				return err
			}

			return requestHealth()
		},
	}
}
// Health returns a cobra command to report on the agent's health
Health returns a cobra command to report on the agent's health
// Health returns a cobra command to report on the agent ' s health
func Health(loggerName config.LoggerName, confPath *string, flagNoColor *bool) *cobra.Command {
	return &cobra.Command{
		Use:          "health",
		Short:        "Print the current agent health",
		Long:         ``,
		SilenceUsage: true,
		RunE: func(cmd *cobra.Command, args []string) error {
			if *flagNoColor {
				color.NoColor = true
			}
			if flavor.GetFlavor() == flavor.ClusterAgent {
				config.Datadog.SetConfigName("datadog-cluster")
			}
			err := common.SetupConfigWithoutSecrets(*confPath, "")
			if err != nil {
				return fmt.Errorf("unable to set up global agent configuration: %v", err)
			}
			err = config.SetupLogger(loggerName, config.GetEnvDefault("DD_LOG_LEVEL", "off"), "", "", false, true, false)
			if err != nil {
				fmt.Printf("Cannot setup logger, exiting: %v\n", err)
				return err
			}
			return requestHealth()
		},
	}
}
func Health ( loggerName config . LoggerName , confPath * string , flagNoColor * bool ) * cobra . Command { return & cobra . Command { Use : " " , Short : " " , Long : `` , SilenceUsage : true , RunE : func ( cmd * cobra . Command , args [ ] string ) error { if * flagNoColor { color . NoColor = true } if flavor . GetFlavor ( ) == flavor . ClusterAgent { config . Datadog . SetConfigName ( " " ) } err := common . SetupConfigWithoutSecrets ( * confPath , " " ) if err != nil { return fmt . Errorf ( " " , err ) } err = config . SetupLogger ( loggerName , config . GetEnvDefault ( " " , " " ) , " " , " " , false , true , false ) if err != nil { fmt . Printf ( " \n " , err ) return err } return requestHealth ( ) } , } }
Health returns a cobra command to report on the agent's health
Health returns a cobra command to report on the agent ' s health
// Set up config without secrets so that running the health command (e.g. from container // liveness probe script) does not trigger a secret backend command call.