alerts

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: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var Command = &cli.Command{
	Name:      "alerts",
	Usage:     "Retrieve/Close alerts",
	ArgsUsage: "[--with-closed | -w] [--limit | -l] [--jq <formula>]",
	Description: `
    Retrieve/Close alerts. With no subcommand specified, this will show all alerts.
    Requests APIs under "/api/v0/alerts". See https://mackerel.io/api-docs/entry/alerts .
`,
	Action: doAlertsRetrieve,
	Flags: []cli.Flag{
		&cli.BoolFlag{
			Name:    "with-closed",
			Aliases: []string{"w"},
			Usage:   "Display open alert including close alert. default: false",
		},
		&cli.IntFlag{
			Name:    "limit",
			Aliases: []string{"l"},
			Value:   defaultAlertsLimit,
			Usage:   fmt.Sprintf("Set the number of alerts to display. Default is set to %d when -with-closed is set, otherwise all the open alerts are displayed.", defaultAlertsLimit),
		},
		jq.CommandLineFlag,
	},
	Commands: []*cli.Command{
		{
			Name:      "list",
			Usage:     "list alerts",
			ArgsUsage: "[--service | -s <service>] [--host-status | -S <host-status>] [--color | -c] [--with-closed | -w] [--limit | -l]",
			Description: `
    Shows alerts in human-readable format.
`,
			Action: doAlertsList,
			Flags: []cli.Flag{
				&cli.StringSliceFlag{
					Name:    "service",
					Aliases: []string{"s"},
					Usage:   "Filters alerts by service. Multiple choices are allowed.",
				},
				&cli.StringSliceFlag{
					Name:    "host-status",
					Aliases: []string{"S"},
					Usage:   "Filters alerts by status of each host. Multiple choices are allowed.",
				},
				&cli.BoolFlag{
					Name:    "color",
					Value:   true,
					Aliases: []string{"c"},
					Usage:   "Colorize output. default: true",
				},
				&cli.BoolFlag{
					Name:    "with-closed",
					Aliases: []string{"w"},
					Usage:   "Display open alert including close alert. default: false",
				},
				&cli.IntFlag{
					Name:    "limit",
					Aliases: []string{"l"},
					Value:   defaultAlertsLimit,
					Usage:   fmt.Sprintf("Set the number of alerts to display. Default is set to %d when -with-closed is set, otherwise all the open alerts are displayed.", defaultAlertsLimit),
				},
			},
		},
		{
			Name:      "close",
			Usage:     "close alerts",
			ArgsUsage: "<alertIds....>",
			Description: `
    Closes alerts. Multiple alert IDs can be specified.
`,
			Action: doAlertsClose,
			Flags: []cli.Flag{
				&cli.StringFlag{
					Name:    "reason",
					Aliases: []string{"r"},
					Value:   "",
					Usage:   "Reason of closing alert.",
				},
				&cli.BoolFlag{
					Name:    "verbose",
					Aliases: []string{"v"},
					Usage:   "Verbose output mode",
				},
			},
		},
		{
			Name:      "logs",
			Usage:     "get alert logs",
			ArgsUsage: "<alertId> [--limit | -l] [--jq <formula>]",
			Description: `
		Get alert logs.
`,
			Action: findAlertLogs,
			Flags: []cli.Flag{
				&cli.IntFlag{
					Name:    "limit",
					Aliases: []string{"l"},
					Value:   defaultAlertLogsLimit,
					Usage:   "Set the number of alert logs to display",
				},
				jq.CommandLineFlag,
			},
		},
	},
}

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