Documentation ¶
Index ¶
- Constants
- func AddDashAlertMigration(mg *migrator.Migrator)
- func AddDashboardUIDPanelIDMigration(mg *migrator.Migrator)
- func AddTablesMigrations(mg *migrator.Migrator)
- func CreateDefaultFoldersForAlertingMigration(mg *migrator.Migrator)
- func RerunDashAlertMigration(mg *migrator.Migrator)
- func UpdateRuleGroupIndexMigration(mg *migrator.Migrator)
- type AlertConfiguration
- type CreateAlertNotificationCommand
- type MigrationError
- type ObjectMatchers
- type PostableApiAlertingConfig
- type PostableApiReceiver
- type PostableGrafanaReceiver
- type PostableUserConfig
- type Route
- type SecureJsonData
Constants ¶
const ( RoleViewer roleType = "Viewer" RoleEditor roleType = "Editor" RoleAdmin roleType = "Admin" )
const ( // Should be the same as 'NoDataAlertName' in pkg/services/schedule/compat.go. NoDataAlertName = "DatasourceNoData" ErrorAlertName = "DatasourceError" )
const ( // ContactLabel is a private label created during migration and used in notification policies. // It stores a string array of all contact point names an alert rule should send to. // It was created as a means to simplify post-migration notification policies. ContactLabel = "__contacts__" )
const DASHBOARD_FOLDER = "%s Alerts - %s"
const DefaultFieldMaxLength = 190
DefaultFieldMaxLength is the standard size for most user-settable string fields in Alerting. Use this for typical string fields, unless you have a special reason not to.
const ( // DisabledRepeatInterval is a large duration that will be used as a pseudo-disable in case a legacy channel doesn't have SendReminders enabled. DisabledRepeatInterval = model.Duration(time.Duration(8736) * time.Hour) // 1y )
const FOLDER_CREATED_BY = -8
FOLDER_CREATED_BY us used to track folders created by this migration during alert migration cleanup.
const GENERAL_FOLDER = "General Alerting"
const KV_NAMESPACE = "alertmanager"
const MaxFolderName = 255
MaxFolderName is the maximum length of the folder name generated using DASHBOARD_FOLDER format
const UIDMaxLength = 40
UIDMaxLength is the standard size for fields that contain UIDs.
Variables ¶
This section is empty.
Functions ¶
func AddDashAlertMigration ¶
func AddTablesMigrations ¶
AddTablesMigrations defines database migrations that affect Grafana Alerting tables.
func CreateDefaultFoldersForAlertingMigration ¶
CreateDefaultFoldersForAlertingMigration creates a folder dedicated for alerting if no folders exist
func RerunDashAlertMigration ¶
RerunDashAlertMigration force the dashboard alert migration to run to make sure that the Alertmanager configurations will be created for each organisation
func UpdateRuleGroupIndexMigration ¶
UpdateRuleGroupIndexMigration updates a new field rule_group_index for alert rules that belong to a group with more than 1 alert.
Types ¶
type AlertConfiguration ¶
type MigrationError ¶
func (MigrationError) Error ¶
func (e MigrationError) Error() string
func (*MigrationError) Unwrap ¶
func (e *MigrationError) Unwrap() error
type ObjectMatchers ¶
func (ObjectMatchers) MarshalJSON ¶
func (m ObjectMatchers) MarshalJSON() ([]byte, error)
MarshalJSON implements the json.Marshaler interface for Matchers. Vendored from definitions.ObjectMatchers.
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"` ObjectMatchers ObjectMatchers `yaml:"object_matchers,omitempty" json:"object_matchers,omitempty"` Routes []*Route `yaml:"routes,omitempty" json:"routes,omitempty"` Continue bool `yaml:"continue,omitempty" json:"continue,omitempty"` GroupByStr []string `yaml:"group_by,omitempty" json:"group_by,omitempty"` RepeatInterval *model.Duration `yaml:"repeat_interval,omitempty" json:"repeat_interval,omitempty"` }
type SecureJsonData ¶
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.