cli

package
v0.9.1 Latest Latest
Warning

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

Go to latest
Published: Sep 29, 2017 License: Apache-2.0 Imports: 22 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var RootCmd = &cobra.Command{
	Use:   "amtool",
	Short: "Alertmanager CLI",
	Long: `View and modify the current Alertmanager state.

[Config File]

The alertmanager tool will read a config file from the --config cli argument, AMTOOL_CONFIG environment variable or
from one of two default config locations. Valid config file formats are JSON, TOML, YAML, HCL and Java Properties, use
whatever makes sense for your project.

The default config file paths are $HOME/.config/amtool/config.yml or /etc/amtool/config.yml

The accepted config options are as follows:

	alertmanager.url
		Set a default alertmanager url for each request

	author
		Set a default author value for new silences. If this argument is not specified then the username will be used

	comment_required
		Require a comment on silence creation

	output
		Set a default output type. Options are (simple, extended, json)
	`,
}

RootCmd represents the base command when called without any subcommands

Functions

func CheckConfig added in v0.9.0

func CheckConfig(args []string) error

func CommandWrapper

func CommandWrapper(command func(*cobra.Command, []string) error) func(*cobra.Command, []string)

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.

func GetAlertmanagerURL

func GetAlertmanagerURL() (*url.URL, error)

func TypeMatcher

func TypeMatcher(matcher labels.Matcher) (types.Matcher, error)

Only valid for when you are going to add a silence Doesn't allow negative operators

func TypeMatchers

func TypeMatchers(matchers []labels.Matcher) (types.Matchers, error)

Only valid for when you are going to add a silence

Types

type ByAlphabetical

type ByAlphabetical []labels.Matcher

func (ByAlphabetical) Len

func (s ByAlphabetical) Len() int

func (ByAlphabetical) Less

func (s ByAlphabetical) Less(i, j int) bool

func (ByAlphabetical) Swap

func (s ByAlphabetical) Swap(i, j int)

type Config

type Config struct {
	ConfigYAML  string                 `json:"configYAML"`
	ConfigJSON  config.Config          `json:"configJSON"`
	MeshStatus  map[string]interface{} `json:"meshStatus"`
	VersionInfo map[string]string      `json:"versionInfo"`
	Uptime      time.Time              `json:"uptime"`
}

Config is the response type of alertmanager config endpoint Duped in cli/format needs to be moved to common/model

type MeshStatus

type MeshStatus struct {
	Name     string       `json:"name"`
	NickName string       `json:"nickName"`
	Peers    []PeerStatus `json:"peerStatus"`
}

type PeerStatus

type PeerStatus struct {
	Name     string `json:"name"`
	NickName string `json:"nickName"`
	UID      uint64 `uid`
}

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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