commands

package
v0.0.0-...-fbfa8e9 Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2024 License: AGPL-3.0 Imports: 77 Imported by: 0

Documentation

Overview

SPDX-License-Identifier: AGPL-3.0-only Provenance-includes-location: https://github.com/prometheus/alertmanager/blob/main/cli/template_render.go Provenance-includes-license: Apache-2.0 Provenance-includes-copyright: The Prometheus Authors.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AnalyzeDashboards

func AnalyzeDashboards(dashFilesList []string) (*analyze.MetricsInGrafana, error)

AnalyzeDashboards analyze the given list of dashboard files and return the list metrics used in them.

func AnalyzeGrafana

func AnalyzeGrafana(ctx context.Context, c *sdk.Client, folders []string, readTimeout time.Duration) (*analyze.MetricsInGrafana, error)

AnalyzeGrafana analyze grafana's dashboards and return the list metrics used in them.

func AnalyzeRuleFiles

func AnalyzeRuleFiles(ruleFiles []string) (*analyze.MetricsInRuler, error)

AnalyzeRuleFiles analyze rules files and return the list metrics used in them.

func AnalyzeRuler

func AnalyzeRuler(c client.Config) (*analyze.MetricsInRuler, error)

AnalyzeRuler analyze Mimir's ruler and return the list metrics used in them.

func IdentifyMetricsInPrometheus

func IdentifyMetricsInPrometheus(metricsUsed model.LabelValues, v1api v1.API, jobConcurrency int, readTimeout time.Duration) (analyze.MetricsInPrometheus, error)

IdentifyMetricsInPrometheus analyze prometheus metrics against metrics used metricsUsed and metricNames. It returns stats about used/unused timeseries.

func TemplateRender

func TemplateRender(cmd *TemplateRenderCmd) (string, error)

Types

type AccessControlCommand

type AccessControlCommand struct {
	InstanceID string
	ACLs       []string
}

AccessControlCommand is the kingpin command for ACLs.

func (*AccessControlCommand) Register

func (a *AccessControlCommand) Register(app *kingpin.Application, envVars EnvVarNames)

Register is used to register the command to a parent command.

type AlertCommand

type AlertCommand struct {
	CortexURL      string
	IgnoreString   string
	IgnoreAlerts   map[string]interface{}
	SourceLabel    string
	NumSources     int
	GracePeriod    int
	CheckFrequency int
	ClientConfig   client.Config
	// contains filtered or unexported fields
}

AlertCommand configures and executes rule related PromQL queries for alerts comparison.

func (*AlertCommand) Register

func (a *AlertCommand) Register(app *kingpin.Application, envVars EnvVarNames, reg prometheus.Registerer)

type AlertmanagerCommand

type AlertmanagerCommand struct {
	ClientConfig           client.Config
	AlertmanagerURL        url.URL
	AlertmanagerConfigFile string
	TemplateFiles          []string
	DisableColor           bool
	ForceColor             bool
	ValidateOnly           bool
	OutputDir              string
	UTF8StrictMode         bool
	// contains filtered or unexported fields
}

AlertmanagerCommand configures and executes rule related mimir api operations

func (*AlertmanagerCommand) Register

func (a *AlertmanagerCommand) Register(app *kingpin.Application, envVars EnvVarNames)

Register rule related commands and flags with the kingpin application

type AnalyzeCommand

type AnalyzeCommand struct{}

func (*AnalyzeCommand) Register

func (cmd *AnalyzeCommand) Register(app *kingpin.Application, envVars EnvVarNames)

type AnalyzeResult

type AnalyzeResult struct {
	// contains filtered or unexported fields
}

func AnalyzePrometheus

func AnalyzePrometheus(api v1.API, metrics model.LabelValues, skip func(model.LabelValue) bool, jobConcurrency int, readTimeout time.Duration) (AnalyzeResult, error)

AnalyzePrometheus analyze prometheus through the given provided API and return the list metrics used in it.

type BackfillCommand

type BackfillCommand struct {
	// contains filtered or unexported fields
}

func (*BackfillCommand) Register

func (c *BackfillCommand) Register(app *kingpin.Application, envVars EnvVarNames)

type BucketValidationCommand

type BucketValidationCommand struct {
	// contains filtered or unexported fields
}

BucketValidationCommand is the kingpin command for bucket validation.

func (*BucketValidationCommand) Register

func (b *BucketValidationCommand) Register(app *kingpin.Application, _ EnvVarNames)

Register is used to register the command to a parent command.

type ConfigCommand

type ConfigCommand struct {
	// contains filtered or unexported fields
}

ConfigCommand works with the mimir configuration parameters (YAML files and CLI flags)

func (*ConfigCommand) Register

func (c *ConfigCommand) Register(app *kingpin.Application, _ EnvVarNames)

Register config related commands and flags with the kingpin application.

type DashboardAnalyzeCommand

type DashboardAnalyzeCommand struct {
	DashFilesList []string
	// contains filtered or unexported fields
}

type EnvVarNames

type EnvVarNames struct {
	Address               string
	APIKey                string
	APIUser               string
	TLSCAPath             string
	TLSCertPath           string
	TLSKeyPath            string
	TLSInsecureSkipVerify string
	TenantID              string
	UseLegacyRoutes       string
	MimirHTTPPrefix       string
	AuthToken             string
	ExtraHeaders          string
}

func NewEnvVarsWithPrefix

func NewEnvVarsWithPrefix(prefix string) EnvVarNames

type GrafanaAnalyzeCommand

type GrafanaAnalyzeCommand struct {
	// contains filtered or unexported fields
}

type LoadgenCommand

type LoadgenCommand struct {
	// contains filtered or unexported fields
}

func (*LoadgenCommand) Register

func (c *LoadgenCommand) Register(app *kingpin.Application, _ EnvVarNames, reg prometheus.Registerer)

type LoggerConfig

type LoggerConfig struct {
	Level string
}

func (*LoggerConfig) Register

func (l *LoggerConfig) Register(app *kingpin.Application, _ EnvVarNames)

Register configures log related flags

type PromQLCommand

type PromQLCommand struct {
	// contains filtered or unexported fields
}

func (*PromQLCommand) Register

func (c *PromQLCommand) Register(app *kingpin.Application, _ EnvVarNames)

type PrometheusAnalyzeCommand

type PrometheusAnalyzeCommand struct {
	// contains filtered or unexported fields
}

type PushGatewayConfig

type PushGatewayConfig struct {
	Endpoint *url.URL
	JobName  string
	Interval time.Duration
	// contains filtered or unexported fields
}

PushGatewayConfig configures the pushgateway

func (*PushGatewayConfig) Register

func (l *PushGatewayConfig) Register(app *kingpin.Application, _ EnvVarNames)

Register configures log related flags

func (*PushGatewayConfig) Stop

func (l *PushGatewayConfig) Stop()

Stop shutsdown the pushgateway

type RemoteReadCommand

type RemoteReadCommand struct {
	// contains filtered or unexported fields
}

func (*RemoteReadCommand) Register

func (c *RemoteReadCommand) Register(app *kingpin.Application, envVars EnvVarNames)

type RuleCommand

type RuleCommand struct {
	ClientConfig client.Config

	// Backend type (cortex | loki)
	Backend string

	// Get Rule Groups Configs
	Namespace string
	RuleGroup string
	OutputDir string

	// Load Rules Config
	RuleFilesList []string
	RuleFilesPath string

	// Sync/Diff Rules Config
	Namespaces string

	NamespacesRegex        *regexp.Regexp
	IgnoredNamespaces      string
	IgnoredNamespacesRegex *regexp.Regexp

	// Sync Rules Config
	SyncConcurrency int

	// Prepare Rules Config
	InPlaceEdit                        bool
	AggregationLabel                   string
	AggregationLabelExcludedRuleGroups string

	// Lint Rules Config
	LintDryRun bool

	// Rules check flags
	Strict bool

	// List Rules Config
	Format string

	DisableColor bool
	ForceColor   bool

	// Diff Rules Config
	Verbose bool
	// contains filtered or unexported fields
}

RuleCommand configures and executes rule related mimir operations

func (*RuleCommand) Register

func (r *RuleCommand) Register(app *kingpin.Application, envVars EnvVarNames, reg prometheus.Registerer)

Register rule related commands and flags with the kingpin application

type RuleFileAnalyzeCommand

type RuleFileAnalyzeCommand struct {
	RuleFilesList []string
	// contains filtered or unexported fields
}

type RulerAnalyzeCommand

type RulerAnalyzeCommand struct {
	ClientConfig client.Config
	// contains filtered or unexported fields
}

type RuntimeConfigCommand

type RuntimeConfigCommand struct {
	// contains filtered or unexported fields
}

RuntimeConfigCommand works with Mimir's runtime config.

func (*RuntimeConfigCommand) Register

func (c *RuntimeConfigCommand) Register(app *kingpin.Application)

Register runtime config related commands and flags with the kingpin application.

type TemplateRenderCmd

type TemplateRenderCmd struct {
	TemplateFilesGlobs []string
	TemplateType       string
	TemplateText       string
	TemplateData       *os.File
	TenantID           string // Needed in the function WithCustomFunctions
}

TemplateRenderCmd Render a given definition in a template file to standard output

Jump to

Keyboard shortcuts

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