ualert

package
v0.0.85-test Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: AGPL-3.0 Imports: 33 Imported by: 0

Documentation

Index

Constants

View Source
const (
	ROLE_VIEWER roleType = "Viewer"
	ROLE_EDITOR roleType = "Editor"
	ROLE_ADMIN  roleType = "Admin"
)
View Source
const (
	// Should be the same as 'NoDataAlertName' in pkg/services/schedule/compat.go.
	NoDataAlertName = "DatasourceNoData"

	ErrorAlertName = "DatasourceError"
)
View Source
const DASHBOARD_FOLDER = "%s Alerts - %s"
View Source
const FOLDER_CREATED_BY = -8

FOLDER_CREATED_BY us used to track folders created by this migration during alert migration cleanup.

View Source
const GENERAL_FOLDER = "General Alerting"
View Source
const KV_NAMESPACE = "alertmanager"
View Source
const MaxFolderName = 255

MaxFolderName is the maximum length of the folder name generated using DASHBOARD_FOLDER format

Variables

This section is empty.

Functions

func AddAlertAdminConfigMigrations

func AddAlertAdminConfigMigrations(mg *migrator.Migrator)

func AddAlertDefinitionMigrations

func AddAlertDefinitionMigrations(mg *migrator.Migrator, defaultIntervalSeconds int64)

AddAlertDefinitionMigrations should not be modified.

func AddAlertDefinitionVersionMigrations

func AddAlertDefinitionVersionMigrations(mg *migrator.Migrator)

AddAlertDefinitionMigrations should not be modified.

func AddAlertRuleMigrations

func AddAlertRuleMigrations(mg *migrator.Migrator, defaultIntervalSeconds int64)

func AddAlertRuleVersionMigrations

func AddAlertRuleVersionMigrations(mg *migrator.Migrator)

func AddAlertmanagerConfigMigrations

func AddAlertmanagerConfigMigrations(mg *migrator.Migrator)

func AddDashAlertMigration

func AddDashAlertMigration(mg *migrator.Migrator)

func AddDashboardUIDPanelIDMigration

func AddDashboardUIDPanelIDMigration(mg *migrator.Migrator)

func AddProvisioningMigrations

func AddProvisioningMigrations(mg *migrator.Migrator)

func AddTablesMigrations

func AddTablesMigrations(mg *migrator.Migrator)

AddMigration defines database migrations.

func AlertInstanceMigration

func AlertInstanceMigration(mg *migrator.Migrator)

func CheckUnifiedAlertingEnabledByDefault

func CheckUnifiedAlertingEnabledByDefault(migrator *migrator.Migrator) error

CheckUnifiedAlertingEnabledByDefault determines the final status of unified alerting, if it is not enabled explicitly. Checks table `alert` and if it is empty, then it changes UnifiedAlerting.Enabled to true. Otherwise, it sets the flag to false. After this method is executed the status of alerting should be determined, i.e. both flags will not be nil. Note: this is not a real migration but a step that other migrations depend on. TODO Delete when unified alerting is enabled by default unconditionally (Grafana v9)

func RerunDashAlertMigration

func RerunDashAlertMigration(mg *migrator.Migrator)

RerunDashAlertMigration force the dashboard alert migration to run to make sure that the Alertmanager configurations will be created for each organisation

Types

type AlertConfiguration

type AlertConfiguration struct {
	ID    int64 `xorm:"pk autoincr 'id'"`
	OrgID int64 `xorm:"org_id"`

	AlertmanagerConfiguration string
	ConfigurationVersion      string
	CreatedAt                 int64 `xorm:"created"`
}

type CreateAlertNotificationCommand

type CreateAlertNotificationCommand struct {
	UID                   string            `json:"uid"`
	Name                  string            `json:"name"`
	Type                  string            `json:"type"`
	DisableResolveMessage bool              `json:"disableResolveMessage"`
	Settings              *simplejson.Json  `json:"settings"`
	SecureSettings        map[string]string `json:"secureSettings"`
}

type Matchers

type Matchers labels.Matchers

func (Matchers) MarshalJSON

func (m Matchers) MarshalJSON() ([]byte, error)

type MigrationError

type MigrationError struct {
	AlertId int64
	Err     error
}

func (MigrationError) Error

func (e MigrationError) Error() string

func (*MigrationError) Unwrap

func (e *MigrationError) Unwrap() error

type PostableApiAlertingConfig

type PostableApiAlertingConfig struct {
	Route     *Route                 `yaml:"route,omitempty" json:"route,omitempty"`
	Templates []string               `yaml:"templates" json:"templates"`
	Receivers []*PostableApiReceiver `yaml:"receivers,omitempty" json:"receivers,omitempty"`
}

type PostableApiReceiver

type PostableApiReceiver struct {
	Name                    string                     `yaml:"name" json:"name"`
	GrafanaManagedReceivers []*PostableGrafanaReceiver `yaml:"grafana_managed_receiver_configs,omitempty" json:"grafana_managed_receiver_configs,omitempty"`
}

type PostableGrafanaReceiver

type PostableGrafanaReceiver CreateAlertNotificationCommand

type PostableUserConfig

type PostableUserConfig struct {
	TemplateFiles      map[string]string         `yaml:"template_files" json:"template_files"`
	AlertmanagerConfig PostableApiAlertingConfig `yaml:"alertmanager_config" json:"alertmanager_config"`
}

type Route

type Route struct {
	Receiver string   `yaml:"receiver,omitempty" json:"receiver,omitempty"`
	Matchers Matchers `yaml:"matchers,omitempty" json:"matchers,omitempty"`
	Routes   []*Route `yaml:"routes,omitempty" json:"routes,omitempty"`
	Continue bool     `yaml:"continue,omitempty" json:"continue,omitempty"`
}

type SecureJsonData

type SecureJsonData map[string][]byte

SecureJsonData is used to store encrypted data (for example in data_source table). Only values are separately encrypted.

func GetEncryptedJsonData

func GetEncryptedJsonData(sjd map[string]string) SecureJsonData

GetEncryptedJsonData returns map where all keys are encrypted.

func (SecureJsonData) Decrypt

func (s SecureJsonData) Decrypt() map[string]string

Decrypt returns map of the same type but where the all the values are decrypted. Opposite of what GetEncryptedJsonData is doing.

func (SecureJsonData) DecryptedValue

func (s SecureJsonData) DecryptedValue(key string) (string, bool)

DecryptedValue returns single decrypted value from SecureJsonData. Similar to normal map access second return value is true if the key exists and false if not.

Jump to

Keyboard shortcuts

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