cmd

package
v0.2.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 28, 2017 License: MIT Imports: 9 Imported by: 26

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "checkup",
	Short: "Perform checks on your services and sites",
	Long: `Checkup is distributed, lock-free, self-hosted health
checks and status pages.

Checkup will always look for a checkup.json file in
the current working directory by default and use it.
You can specify a different file location using the
--config/-c flag.

Running checkup without any arguments will invoke
a single checkup and print results to stdout. To
store the results of the check, use --store.`,

	Run: func(cmd *cobra.Command, args []string) {
		allHealthy := true
		c := loadCheckup()

		if storeResults {
			if c.Storage == nil {
				log.Fatal("no storage configured")
			}
		}

		results, err := c.Check()
		if err != nil {
			log.Fatal(err)
		}

		if storeResults {
			err := c.Storage.Store(results)
			if err != nil {
				log.Fatal(err)
			}
			return
		}

		for _, result := range results {
			fmt.Println(result)
			if !result.Healthy {
				allHealthy = false
			}
		}

		if !allHealthy {
			os.Exit(1)
		}
	},
}

RootCmd represents the base command when called without any subcommands

Functions

func Execute

func Execute()

Execute adds all child commands to the root command sets flags appropriately. This is called by main.main(). It only needs to happen once to the rootCmd.

Types

This section is empty.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL