monitors

package
v0.64.0 Latest Latest
Warning

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

Go to latest
Published: Apr 8, 2026 License: Apache-2.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:  "monitors",
	Usage: "Manipulate monitors",
	Description: `
    Manipulate monitor rules. With no subcommand specified, this will show all monitor rules.
    Requests APIs under "/api/v0/monitors". See https://mackerel.io/api-docs/entry/monitors .
`,
	Action: doMonitorsList,
	Flags: []cli.Flag{
		jq.CommandLineFlag,
	},
	Commands: []*cli.Command{
		{
			Name:      "pull",
			Usage:     "pull rules",
			ArgsUsage: "[--file-path | -F <file>] [--verbose | -v]",
			Description: `
    Pull monitor rules from Mackerel server and save them to a file. The file can be specified by filepath argument <file>. The default is 'monitors.json'.
`,
			Action: doMonitorsPull,
			Flags: []cli.Flag{
				&cli.StringFlag{
					Name:    "file-path",
					Aliases: []string{"F"},
					Value:   "",
					Usage:   "Filename to store monitor rule definitions. default: monitors.json",
				},
				&cli.BoolFlag{
					Name:    "verbose",
					Aliases: []string{"v"},
					Usage:   "Verbose output mode",
				},
			},
		},
		{
			Name:  "diff",
			Usage: "diff rules",
			Description: `
    Show difference of monitor rules between Mackerel and a file. The file can be specified by filepath argument <file>. The default is 'monitors.json'.
`,
			ArgsUsage: "[--file-path | -F <file>]",
			Action:    doMonitorsDiff,
			Flags: []cli.Flag{
				&cli.BoolFlag{
					Name:    "exit-code",
					Aliases: []string{"e"},
					Usage:   "Make mkr exit with code 1 if there are differences and 0 if there aren't. This is similar to diff(1)",
				},
				&cli.StringFlag{
					Name:    "file-path",
					Aliases: []string{"F"},
					Value:   "",
					Usage:   "Filename to store monitor rule definitions. default: monitors.json",
				},
				&cli.BoolFlag{
					Name:  "reverse",
					Usage: "The difference on the remote server is represented by plus and the difference on the local file is represented by minus",
				},
			},
		},
		{
			Name:      "push",
			Usage:     "push rules",
			ArgsUsage: "[--dry-run | -d] [--file-path | -F <file>] [--verbose | -v]",
			Description: `
    Push monitor rules stored in a file to Mackerel. The file can be specified by filepath argument <file>. The default is 'monitors.json'.
`,
			Action: doMonitorsPush,
			Flags: []cli.Flag{
				&cli.StringFlag{
					Name:    "file-path",
					Aliases: []string{"F"},
					Value:   "",
					Usage:   "Filename to store monitor rule definitions. default: monitors.json",
				},
				&cli.BoolFlag{
					Name:    "dry-run",
					Aliases: []string{"d"},
					Usage:   "Show which apis are called, but not execute.",
				},
				&cli.BoolFlag{
					Name:    "verbose",
					Aliases: []string{"v"},
					Usage:   "Verbose output mode",
				},
			},
		},
	},
}

Functions

This section is empty.

Types

This section is empty.

Jump to

Keyboard shortcuts

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