models

package
v2.17.0+incompatible Latest Latest
Warning

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

Go to latest
Published: May 7, 2021 License: AGPL-3.0 Imports: 31 Imported by: 0

Documentation

Overview

Package models contains generated Reform records and helpers.

Common order of helpers:

  • unexported validators (checkXXX);
  • FindAllXXX;
  • FindXXXByID;
  • other finder (e.g. FindNodesForAgent);
  • CreateXXX;
  • ChangeXXX;
  • RemoveXXX.

Index

Constants

View Source
const (
	Email     = ChannelType("email")
	PagerDuty = ChannelType("pagerduty")
	Slack     = ChannelType("slack")
	WebHook   = ChannelType("webhook")
)

Available notification channel types.

View Source
const (
	Echo                  = JobType("echo")
	MySQLBackupJob        = JobType("mysql_backup")
	MySQLRestoreBackupJob = JobType("mysql_restore_backup")
)

Supported job types.

View Source
const (
	Float  = ParamType("float")
	Bool   = ParamType("bool")
	String = ParamType("string")
)

Available parameter types.

View Source
const (
	Equal = FilterType("=")
	Regex = FilterType("=~")
)

Available filter types.

View Source
const (
	BuiltInSource  = Source("built_in")
	SAASSource     = Source("saas")
	UserFileSource = Source("user_file")
	UserAPISource  = Source("user_api")
)

Available template sources.

View Source
const PMMServerAgentID string = "pmm-server" // no /agent_id/ prefix

PMMServerAgentID is a special Agent ID representing pmm-agent on PMM Server.

View Source
const PMMServerNodeID string = "pmm-server" // no /node_id/ prefix

PMMServerNodeID is a special Node ID representing PMM Server Node.

View Source
const PMMServerPostgreSQLServiceName = "pmm-server-postgresql"

PMMServerPostgreSQLServiceName is a special Service Name representing PMM Server's PostgreSQL Service.

Variables

View Source
var (
	// ErrNotFound returned when entity is not found.
	ErrNotFound = errors.New("not found")
	// ErrInvalidArgument returned when some passed argument is invalid.
	ErrInvalidArgument = errors.New("invalid argument")
)
View Source
var ActionResultTable = &actionResultTableType{
	s: parse.StructInfo{
		Type:    "ActionResult",
		SQLName: "action_results",
		Fields: []parse.FieldInfo{
			{Name: "ID", Type: "string", Column: "id"},
			{Name: "PMMAgentID", Type: "string", Column: "pmm_agent_id"},
			{Name: "Done", Type: "bool", Column: "done"},
			{Name: "Error", Type: "string", Column: "error"},
			{Name: "Output", Type: "string", Column: "output"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
		},
		PKFieldIndex: 0,
	},
	z: new(ActionResult).Values(),
}

ActionResultTable represents action_results view or table in SQL database.

View Source
var AgentTable = &agentTableType{
	s: parse.StructInfo{
		Type:    "Agent",
		SQLName: "agents",
		Fields: []parse.FieldInfo{
			{Name: "AgentID", Type: "string", Column: "agent_id"},
			{Name: "AgentType", Type: "AgentType", Column: "agent_type"},
			{Name: "RunsOnNodeID", Type: "*string", Column: "runs_on_node_id"},
			{Name: "ServiceID", Type: "*string", Column: "service_id"},
			{Name: "NodeID", Type: "*string", Column: "node_id"},
			{Name: "PMMAgentID", Type: "*string", Column: "pmm_agent_id"},
			{Name: "CustomLabels", Type: "[]uint8", Column: "custom_labels"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
			{Name: "Disabled", Type: "bool", Column: "disabled"},
			{Name: "Status", Type: "string", Column: "status"},
			{Name: "ListenPort", Type: "*uint16", Column: "listen_port"},
			{Name: "Version", Type: "*string", Column: "version"},
			{Name: "Username", Type: "*string", Column: "username"},
			{Name: "Password", Type: "*string", Column: "password"},
			{Name: "TLS", Type: "bool", Column: "tls"},
			{Name: "TLSSkipVerify", Type: "bool", Column: "tls_skip_verify"},
			{Name: "AWSAccessKey", Type: "*string", Column: "aws_access_key"},
			{Name: "AWSSecretKey", Type: "*string", Column: "aws_secret_key"},
			{Name: "AzureOptions", Type: "*AzureOptions", Column: "azure_options"},
			{Name: "TableCount", Type: "*int32", Column: "table_count"},
			{Name: "TableCountTablestatsGroupLimit", Type: "int32", Column: "table_count_tablestats_group_limit"},
			{Name: "QueryExamplesDisabled", Type: "bool", Column: "query_examples_disabled"},
			{Name: "MaxQueryLogSize", Type: "int64", Column: "max_query_log_size"},
			{Name: "MetricsPath", Type: "*string", Column: "metrics_path"},
			{Name: "MetricsScheme", Type: "*string", Column: "metrics_scheme"},
			{Name: "RDSBasicMetricsDisabled", Type: "bool", Column: "rds_basic_metrics_disabled"},
			{Name: "RDSEnhancedMetricsDisabled", Type: "bool", Column: "rds_enhanced_metrics_disabled"},
			{Name: "PushMetrics", Type: "bool", Column: "push_metrics"},
			{Name: "DisabledCollectors", Type: "pq.StringArray", Column: "disabled_collectors"},
			{Name: "MySQLOptions", Type: "*MySQLOptions", Column: "mysql_options"},
			{Name: "MongoDBOptions", Type: "*MongoDBOptions", Column: "mongo_db_tls_options"},
		},
		PKFieldIndex: 0,
	},
	z: new(Agent).Values(),
}

AgentTable represents agents view or table in SQL database.

View Source
var ArtifactTable = &artifactTableType{
	s: parse.StructInfo{
		Type:    "Artifact",
		SQLName: "artifacts",
		Fields: []parse.FieldInfo{
			{Name: "ID", Type: "string", Column: "id"},
			{Name: "Name", Type: "string", Column: "name"},
			{Name: "Vendor", Type: "string", Column: "vendor"},
			{Name: "LocationID", Type: "string", Column: "location_id"},
			{Name: "ServiceID", Type: "string", Column: "service_id"},
			{Name: "DataModel", Type: "DataModel", Column: "data_model"},
			{Name: "Status", Type: "BackupStatus", Column: "status"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
		},
		PKFieldIndex: 0,
	},
	z: new(Artifact).Values(),
}

ArtifactTable represents artifacts view or table in SQL database.

View Source
var BackupLocationTable = &backupLocationTableType{
	s: parse.StructInfo{
		Type:    "BackupLocation",
		SQLName: "backup_locations",
		Fields: []parse.FieldInfo{
			{Name: "ID", Type: "string", Column: "id"},
			{Name: "Name", Type: "string", Column: "name"},
			{Name: "Description", Type: "string", Column: "description"},
			{Name: "Type", Type: "BackupLocationType", Column: "type"},
			{Name: "S3Config", Type: "*S3LocationConfig", Column: "s3_config"},
			{Name: "PMMServerConfig", Type: "*PMMServerLocationConfig", Column: "pmm_server_config"},
			{Name: "PMMClientConfig", Type: "*PMMClientLocationConfig", Column: "pmm_client_config"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
		},
		PKFieldIndex: 0,
	},
	z: new(BackupLocation).Values(),
}

BackupLocationTable represents backup_locations view or table in SQL database.

View Source
var ChannelTable = &channelTableType{
	s: parse.StructInfo{
		Type:    "Channel",
		SQLName: "ia_channels",
		Fields: []parse.FieldInfo{
			{Name: "ID", Type: "string", Column: "id"},
			{Name: "Summary", Type: "string", Column: "summary"},
			{Name: "Type", Type: "ChannelType", Column: "type"},
			{Name: "EmailConfig", Type: "*EmailConfig", Column: "email_config"},
			{Name: "PagerDutyConfig", Type: "*PagerDutyConfig", Column: "pagerduty_config"},
			{Name: "SlackConfig", Type: "*SlackConfig", Column: "slack_config"},
			{Name: "WebHookConfig", Type: "*WebHookConfig", Column: "webhook_config"},
			{Name: "Disabled", Type: "bool", Column: "disabled"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
		},
		PKFieldIndex: 0,
	},
	z: new(Channel).Values(),
}

ChannelTable represents ia_channels view or table in SQL database.

View Source
var CheckSettingsTable = &checkSettingsTableType{
	s: parse.StructInfo{
		Type:    "CheckSettings",
		SQLName: "check_settings",
		Fields: []parse.FieldInfo{
			{Name: "Name", Type: "string", Column: "name"},
			{Name: "Interval", Type: "Interval", Column: "interval"},
		},
		PKFieldIndex: 0,
	},
	z: new(CheckSettings).Values(),
}

CheckSettingsTable represents check_settings view or table in SQL database.

View Source
var JobResultTable = &jobResultTableType{
	s: parse.StructInfo{
		Type:    "JobResult",
		SQLName: "job_results",
		Fields: []parse.FieldInfo{
			{Name: "ID", Type: "string", Column: "id"},
			{Name: "PMMAgentID", Type: "string", Column: "pmm_agent_id"},
			{Name: "Type", Type: "JobType", Column: "type"},
			{Name: "Done", Type: "bool", Column: "done"},
			{Name: "Error", Type: "string", Column: "error"},
			{Name: "Result", Type: "*JobResultData", Column: "result"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
		},
		PKFieldIndex: 0,
	},
	z: new(JobResult).Values(),
}

JobResultTable represents job_results view or table in SQL database.

View Source
var KubernetesClusterTable = &kubernetesClusterTableType{
	s: parse.StructInfo{
		Type:    "KubernetesCluster",
		SQLName: "kubernetes_clusters",
		Fields: []parse.FieldInfo{
			{Name: "ID", Type: "string", Column: "id"},
			{Name: "KubernetesClusterName", Type: "string", Column: "kubernetes_cluster_name"},
			{Name: "KubeConfig", Type: "string", Column: "kube_config"},
			{Name: "PXC", Type: "*Component", Column: "pxc"},
			{Name: "ProxySQL", Type: "*Component", Column: "proxysql"},
			{Name: "HAProxy", Type: "*Component", Column: "haproxy"},
			{Name: "Mongod", Type: "*Component", Column: "mongod"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
		},
		PKFieldIndex: 0,
	},
	z: new(KubernetesCluster).Values(),
}

KubernetesClusterTable represents kubernetes_clusters view or table in SQL database.

View Source
var NodeTable = &nodeTableType{
	s: parse.StructInfo{
		Type:    "Node",
		SQLName: "nodes",
		Fields: []parse.FieldInfo{
			{Name: "NodeID", Type: "string", Column: "node_id"},
			{Name: "NodeType", Type: "NodeType", Column: "node_type"},
			{Name: "NodeName", Type: "string", Column: "node_name"},
			{Name: "MachineID", Type: "*string", Column: "machine_id"},
			{Name: "Distro", Type: "string", Column: "distro"},
			{Name: "NodeModel", Type: "string", Column: "node_model"},
			{Name: "AZ", Type: "string", Column: "az"},
			{Name: "CustomLabels", Type: "[]uint8", Column: "custom_labels"},
			{Name: "Address", Type: "string", Column: "address"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
			{Name: "ContainerID", Type: "*string", Column: "container_id"},
			{Name: "ContainerName", Type: "*string", Column: "container_name"},
			{Name: "Region", Type: "*string", Column: "region"},
		},
		PKFieldIndex: 0,
	},
	z: new(Node).Values(),
}

NodeTable represents nodes view or table in SQL database.

View Source
var Now = func() time.Time {
	return time.Now().Truncate(time.Microsecond).UTC()
}

Now returns current time with database precision.

View Source
var PMMAgentWithPushMetricsSupport = version.MustParse("2.11.99")

PMMAgentWithPushMetricsSupport - version of pmmAgent, that support vmagent and push metrics mode will be released with PMM Agent v2.12.

View Source
var RestoreHistoryItemTable = &restoreHistoryItemTableType{
	s: parse.StructInfo{
		Type:    "RestoreHistoryItem",
		SQLName: "restore_history",
		Fields: []parse.FieldInfo{
			{Name: "ID", Type: "string", Column: "id"},
			{Name: "ArtifactID", Type: "string", Column: "artifact_id"},
			{Name: "ServiceID", Type: "string", Column: "service_id"},
			{Name: "Status", Type: "RestoreStatus", Column: "status"},
			{Name: "StartedAt", Type: "time.Time", Column: "started_at"},
			{Name: "FinishedAt", Type: "*time.Time", Column: "finished_at"},
		},
		PKFieldIndex: 0,
	},
	z: new(RestoreHistoryItem).Values(),
}

RestoreHistoryItemTable represents restore_history view or table in SQL database.

View Source
var RuleTable = &ruleTableType{
	s: parse.StructInfo{
		Type:    "Rule",
		SQLName: "ia_rules",
		Fields: []parse.FieldInfo{
			{Name: "TemplateName", Type: "string", Column: "template_name"},
			{Name: "ID", Type: "string", Column: "id"},
			{Name: "Summary", Type: "string", Column: "summary"},
			{Name: "Disabled", Type: "bool", Column: "disabled"},
			{Name: "Params", Type: "RuleParams", Column: "params"},
			{Name: "For", Type: "time.Duration", Column: "for"},
			{Name: "Severity", Type: "Severity", Column: "severity"},
			{Name: "CustomLabels", Type: "[]uint8", Column: "custom_labels"},
			{Name: "Filters", Type: "Filters", Column: "filters"},
			{Name: "ChannelIDs", Type: "ChannelIDs", Column: "channel_ids"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
		},
		PKFieldIndex: 1,
	},
	z: new(Rule).Values(),
}

RuleTable represents ia_rules view or table in SQL database.

View Source
var ServiceTable = &serviceTableType{
	s: parse.StructInfo{
		Type:    "Service",
		SQLName: "services",
		Fields: []parse.FieldInfo{
			{Name: "ServiceID", Type: "string", Column: "service_id"},
			{Name: "ServiceType", Type: "ServiceType", Column: "service_type"},
			{Name: "ServiceName", Type: "string", Column: "service_name"},
			{Name: "NodeID", Type: "string", Column: "node_id"},
			{Name: "Environment", Type: "string", Column: "environment"},
			{Name: "Cluster", Type: "string", Column: "cluster"},
			{Name: "ReplicationSet", Type: "string", Column: "replication_set"},
			{Name: "CustomLabels", Type: "[]uint8", Column: "custom_labels"},
			{Name: "ExternalGroup", Type: "string", Column: "external_group"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
			{Name: "Address", Type: "*string", Column: "address"},
			{Name: "Port", Type: "*uint16", Column: "port"},
			{Name: "Socket", Type: "*string", Column: "socket"},
		},
		PKFieldIndex: 0,
	},
	z: new(Service).Values(),
}

ServiceTable represents services view or table in SQL database.

View Source
var TemplateTable = &templateTableType{
	s: parse.StructInfo{
		Type:    "Template",
		SQLName: "ia_templates",
		Fields: []parse.FieldInfo{
			{Name: "Name", Type: "string", Column: "name"},
			{Name: "Version", Type: "uint32", Column: "version"},
			{Name: "Summary", Type: "string", Column: "summary"},
			{Name: "Tiers", Type: "Tiers", Column: "tiers"},
			{Name: "Expr", Type: "string", Column: "expr"},
			{Name: "Params", Type: "TemplateParams", Column: "params"},
			{Name: "For", Type: "time.Duration", Column: "for"},
			{Name: "Severity", Type: "Severity", Column: "severity"},
			{Name: "Labels", Type: "[]uint8", Column: "labels"},
			{Name: "Annotations", Type: "[]uint8", Column: "annotations"},
			{Name: "Source", Type: "Source", Column: "source"},
			{Name: "Yaml", Type: "string", Column: "yaml"},
			{Name: "CreatedAt", Type: "time.Time", Column: "created_at"},
			{Name: "UpdatedAt", Type: "time.Time", Column: "updated_at"},
		},
		PKFieldIndex: 0,
	},
	z: new(Template).Values(),
}

TemplateTable represents ia_templates view or table in SQL database.

Functions

func ChangeActionResult

func ChangeActionResult(q *reform.Querier, actionID, pmmAgentID, aError, output string, done bool) error

ChangeActionResult updates an action result in action results storage.

func CleanupOldActionResults

func CleanupOldActionResults(q *reform.Querier, olderThan time.Time) error

CleanupOldActionResults deletes action results older than a specified date.

func CleanupOldJobResults

func CleanupOldJobResults(q *reform.Querier, olderThan time.Time) error

CleanupOldJobResults deletes jobs results older than a specified date.

func CountChannels

func CountChannels(q *reform.Querier) (int, error)

CountChannels returns number of notification channels.

func CountRules

func CountRules(q *reform.Querier) (int, error)

CountRules returns number of alert rules.

func FindArtifactsByIDs

func FindArtifactsByIDs(q *reform.Querier, ids []string) (map[string]*Artifact, error)

FindArtifactsByIDs finds artifacts by IDs.

func FindBackupLocationsByIDs

func FindBackupLocationsByIDs(q *reform.Querier, ids []string) (map[string]*BackupLocation, error)

FindBackupLocationsByIDs finds backup locations by IDs.

func FindCheckSettings

func FindCheckSettings(q *reform.Querier) (map[string]Interval, error)

FindCheckSettings returns all CheckSettings stored in the table.

func FindPMMAgentsIDsWithPushMetrics

func FindPMMAgentsIDsWithPushMetrics(q *reform.Querier) ([]string, error)

FindPMMAgentsIDsWithPushMetrics returns pmm-agents-ids with agent, that use push_metrics mode.

func FindPmmAgentIDToRunActionOrJob

func FindPmmAgentIDToRunActionOrJob(pmmAgentID string, agents []*Agent) (string, error)

FindPmmAgentIDToRunActionOrJob finds pmm-agent-id to run action.

func FindServicesByIDs

func FindServicesByIDs(q *reform.Querier, ids []string) (map[string]*Service, error)

FindServicesByIDs finds Services by IDs.

func IsPushMetricsSupported

func IsPushMetricsSupported(pmmAgentVersion *string) bool

IsPushMetricsSupported return if PUSH mode is supported for pmm agent version.

func MergeLabels

func MergeLabels(node *Node, service *Service, agent *Agent) (map[string]string, error)

MergeLabels merges unified labels of Node, Service, and Agent (each can be nil).

func OpenDB

func OpenDB(address, name, username, password string) (*sql.DB, error)

OpenDB returns configured connection pool for PostgreSQL.

func ParseEndpoint

func ParseEndpoint(endpoint string) (*url.URL, error)

ParseEndpoint parse endpoint and prepend https if no scheme is provided.

func RemoveArtifact

func RemoveArtifact(q *reform.Querier, id string) error

RemoveArtifact removes artifact by ID.

func RemoveBackupLocation

func RemoveBackupLocation(q *reform.Querier, id string, mode RemoveMode) error

RemoveBackupLocation removes BackupLocation by ID.

func RemoveChannel

func RemoveChannel(q *reform.Querier, id string) error

RemoveChannel removes notification channel with specified id.

func RemoveKubernetesCluster

func RemoveKubernetesCluster(q *reform.Querier, name string) error

RemoveKubernetesCluster removes Kubernetes cluster with provided name.

func RemoveNode

func RemoveNode(q *reform.Querier, id string, mode RemoveMode) error

RemoveNode removes single Node.

func RemoveRestoreHistoryItem

func RemoveRestoreHistoryItem(q *reform.Querier, id string) error

RemoveRestoreHistoryItem removes restore history item by ID.

func RemoveRule

func RemoveRule(q *reform.Querier, id string) error

RemoveRule removes alert Rule with specified id.

func RemoveService

func RemoveService(q *reform.Querier, id string, mode RemoveMode) error

RemoveService removes single Service.

func RemoveTemplate

func RemoveTemplate(q *reform.Querier, name string) error

RemoveTemplate removes rule template with specified name.

func SaveSettings

func SaveSettings(q reform.DBTX, s *Settings) error

SaveSettings saves PMM Server settings. It may modify passed settings to fill defaults.

func SetupDB

func SetupDB(sqlDB *sql.DB, params *SetupDBParams) (*reform.DB, error)

SetupDB runs PostgreSQL database migrations and optionally adds initial data.

func ValidateSettings

func ValidateSettings(params *ChangeSettingsParams) error

ValidateSettings validates settings changes.

Types

type ActionResult

type ActionResult struct {
	ID         string    `reform:"id,pk"`
	PMMAgentID string    `reform:"pmm_agent_id"`
	Done       bool      `reform:"done"`
	Error      string    `reform:"error"`
	Output     string    `reform:"output"`
	CreatedAt  time.Time `reform:"created_at"`
	UpdatedAt  time.Time `reform:"updated_at"`
}

ActionResult describes an action result which is storing in persistent storage.

func CreateActionResult

func CreateActionResult(q *reform.Querier, pmmAgentID string) (*ActionResult, error)

CreateActionResult stores an action result in action results storage.

func FindActionResultByID

func FindActionResultByID(q *reform.Querier, id string) (*ActionResult, error)

FindActionResultByID finds ActionResult by ID.

func (*ActionResult) AfterFind

func (s *ActionResult) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*ActionResult) BeforeInsert

func (s *ActionResult) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*ActionResult) BeforeUpdate

func (s *ActionResult) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*ActionResult) HasPK

func (s *ActionResult) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*ActionResult) PKPointer

func (s *ActionResult) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*ActionResult) PKValue

func (s *ActionResult) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*ActionResult) Pointers

func (s *ActionResult) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*ActionResult) SetPK deprecated

func (s *ActionResult) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.ID = pk.

func (ActionResult) String

func (s ActionResult) String() string

String returns a string representation of this struct or record.

func (*ActionResult) Table

func (s *ActionResult) Table() reform.Table

Table returns Table object for that record.

func (*ActionResult) Values

func (s *ActionResult) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*ActionResult) View

func (s *ActionResult) View() reform.View

View returns View object for that struct.

type AddDBMSServiceParams

type AddDBMSServiceParams struct {
	ServiceName    string
	NodeID         string
	Environment    string
	Cluster        string
	ReplicationSet string
	CustomLabels   map[string]string
	ExternalGroup  string
	Address        *string
	Port           *uint16
	Socket         *string
}

AddDBMSServiceParams contains parameters for adding DBMS (MySQL, PostgreSQL, MongoDB, External) Services.

type Agent

type Agent struct {
	AgentID      string    `reform:"agent_id,pk"`
	AgentType    AgentType `reform:"agent_type"`
	RunsOnNodeID *string   `reform:"runs_on_node_id"`
	ServiceID    *string   `reform:"service_id"`
	NodeID       *string   `reform:"node_id"`
	PMMAgentID   *string   `reform:"pmm_agent_id"`
	CustomLabels []byte    `reform:"custom_labels"`
	CreatedAt    time.Time `reform:"created_at"`
	UpdatedAt    time.Time `reform:"updated_at"`

	Disabled   bool    `reform:"disabled"`
	Status     string  `reform:"status"`
	ListenPort *uint16 `reform:"listen_port"`
	Version    *string `reform:"version"`

	Username      *string `reform:"username"`
	Password      *string `reform:"password"`
	TLS           bool    `reform:"tls"`
	TLSSkipVerify bool    `reform:"tls_skip_verify"`

	AWSAccessKey *string `reform:"aws_access_key"`
	AWSSecretKey *string `reform:"aws_secret_key"`

	AzureOptions *AzureOptions `reform:"azure_options"`

	// TableCount stores last known table count. NULL if unknown.
	TableCount *int32 `reform:"table_count"`

	// Tablestats group collectors are disabled if there are more than that number of tables.
	// 0 means tablestats group collectors are always enabled (no limit).
	// Negative value means tablestats group collectors are always disabled.
	// See IsMySQLTablestatsGroupEnabled method.
	TableCountTablestatsGroupLimit int32 `reform:"table_count_tablestats_group_limit"`

	QueryExamplesDisabled bool    `reform:"query_examples_disabled"`
	MaxQueryLogSize       int64   `reform:"max_query_log_size"`
	MetricsPath           *string `reform:"metrics_path"`
	MetricsScheme         *string `reform:"metrics_scheme"`

	RDSBasicMetricsDisabled    bool           `reform:"rds_basic_metrics_disabled"`
	RDSEnhancedMetricsDisabled bool           `reform:"rds_enhanced_metrics_disabled"`
	PushMetrics                bool           `reform:"push_metrics"`
	DisabledCollectors         pq.StringArray `reform:"disabled_collectors"`

	MySQLOptions   *MySQLOptions   `reform:"mysql_options"`
	MongoDBOptions *MongoDBOptions `reform:"mongo_db_tls_options"`
}

Agent represents Agent as stored in database.

func ChangeAgent

func ChangeAgent(q *reform.Querier, agentID string, params *ChangeCommonAgentParams) (*Agent, error)

ChangeAgent changes common parameters for given Agent.

func CreateAgent

func CreateAgent(q *reform.Querier, agentType AgentType, params *CreateAgentParams) (*Agent, error)

CreateAgent creates Agent with given type.

func CreateExternalExporter

func CreateExternalExporter(q *reform.Querier, params *CreateExternalExporterParams) (*Agent, error)

CreateExternalExporter creates ExternalExporter.

func CreateNodeExporter

func CreateNodeExporter(q *reform.Querier, pmmAgentID string, customLabels map[string]string, pushMetrics bool, disableCollectors []string) (*Agent, error)

CreateNodeExporter creates NodeExporter.

func CreatePMMAgent

func CreatePMMAgent(q *reform.Querier, runsOnNodeID string, customLabels map[string]string) (*Agent, error)

CreatePMMAgent creates PMMAgent.

func FindAgentByID

func FindAgentByID(q *reform.Querier, id string) (*Agent, error)

FindAgentByID finds Agent by ID.

func FindAgents

func FindAgents(q *reform.Querier, filters AgentFilters) ([]*Agent, error)

FindAgents returns Agents by filters.

func FindAgentsByIDs

func FindAgentsByIDs(q *reform.Querier, ids []string) ([]*Agent, error)

FindAgentsByIDs finds Agents by IDs.

func FindAgentsForScrapeConfig

func FindAgentsForScrapeConfig(q *reform.Querier, pmmAgentID *string, pushMetrics bool) ([]*Agent, error)

FindAgentsForScrapeConfig returns Agents for scrape config generation by pmm_agent_id and push_metrics value.

func FindDSNByServiceIDandPMMAgentID

func FindDSNByServiceIDandPMMAgentID(q *reform.Querier, serviceID, pmmAgentID, db string) (string, *Agent, error)

FindDSNByServiceIDandPMMAgentID resolves DSN and Files by service id.

func FindPMMAgentsForService

func FindPMMAgentsForService(q *reform.Querier, serviceID string) ([]*Agent, error)

FindPMMAgentsForService gets pmm-agents for service.

func FindPMMAgentsForServicesOnNode

func FindPMMAgentsForServicesOnNode(q *reform.Querier, nodeID string) ([]*Agent, error)

FindPMMAgentsForServicesOnNode gets pmm-agents for Services running on Node.

func FindPMMAgentsForVersion

func FindPMMAgentsForVersion(logger *logrus.Entry, agents []*Agent, minPMMAgentVersion *version.Parsed) []*Agent

FindPMMAgentsForVersion selects pmm-agents with version >= minPMMAgentVersion.

func FindPMMAgentsRunningOnNode

func FindPMMAgentsRunningOnNode(q *reform.Querier, nodeID string) ([]*Agent, error)

FindPMMAgentsRunningOnNode gets pmm-agents for node where it runs.

func RemoveAgent

func RemoveAgent(q *reform.Querier, id string, mode RemoveMode) (*Agent, error)

RemoveAgent removes Agent by ID.

func (*Agent) AfterFind

func (s *Agent) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*Agent) BeforeInsert

func (s *Agent) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*Agent) BeforeUpdate

func (s *Agent) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*Agent) DBConfig

func (s *Agent) DBConfig(service *Service) DBConfig

DBConfig returns DBConfig for given Service with this agent.

func (*Agent) DSN

func (s *Agent) DSN(service *Service, dialTimeout time.Duration, database string, tdp *DelimiterPair) string

DSN returns DSN string for accessing given Service with this Agent (and implicit driver).

func (*Agent) ExporterURL

func (s *Agent) ExporterURL(q *reform.Querier) (string, error)

ExporterURL composes URL to an external exporter.

func (Agent) Files

func (s Agent) Files() map[string]string

Files returns files map required to connect to DB.

func (*Agent) GetCustomLabels

func (s *Agent) GetCustomLabels() (map[string]string, error)

GetCustomLabels decodes custom labels.

func (*Agent) HasPK

func (s *Agent) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Agent) IsMySQLTablestatsGroupEnabled

func (s *Agent) IsMySQLTablestatsGroupEnabled() bool

IsMySQLTablestatsGroupEnabled returns true if mysqld_exporter tablestats group collectors should be enabled.

func (*Agent) PKPointer

func (s *Agent) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Agent) PKValue

func (s *Agent) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Agent) Pointers

func (s *Agent) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Agent) SetCustomLabels

func (s *Agent) SetCustomLabels(m map[string]string) error

SetCustomLabels encodes custom labels.

func (*Agent) SetPK deprecated

func (s *Agent) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.AgentID = pk.

func (Agent) String

func (s Agent) String() string

String returns a string representation of this struct or record.

func (*Agent) Table

func (s *Agent) Table() reform.Table

Table returns Table object for that record.

func (Agent) TemplateDelimiters

func (s Agent) TemplateDelimiters(svc *Service) *DelimiterPair

TemplateDelimiters returns a pair of safe template delimiters that are not present in agent parameters.

func (*Agent) UnifiedLabels

func (s *Agent) UnifiedLabels() (map[string]string, error)

UnifiedLabels returns combined standard and custom labels with empty labels removed.

func (*Agent) Values

func (s *Agent) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Agent) View

func (s *Agent) View() reform.View

View returns View object for that struct.

type AgentFilters

type AgentFilters struct {
	// Return only Agents started by this pmm-agent.
	PMMAgentID string
	// Return only Agents that provide insights for that Node.
	NodeID string
	// Return only Agents that provide insights for that Service.
	ServiceID string
	// Return Agents with provided type.
	AgentType *AgentType
}

AgentFilters represents filters for agents list.

type AgentType

type AgentType string

AgentType represents Agent type as stored in databases: pmm-managed's PostgreSQL, qan-api's ClickHouse, and VictoriaMetrics.

const (
	PMMAgentType                        AgentType = "pmm-agent"
	NodeExporterType                    AgentType = "node_exporter"
	MySQLdExporterType                  AgentType = "mysqld_exporter"
	MongoDBExporterType                 AgentType = "mongodb_exporter"
	PostgresExporterType                AgentType = "postgres_exporter"
	ProxySQLExporterType                AgentType = "proxysql_exporter"
	RDSExporterType                     AgentType = "rds_exporter"
	AzureDatabaseExporterType           AgentType = "azure_database_exporter"
	QANMySQLPerfSchemaAgentType         AgentType = "qan-mysql-perfschema-agent"
	QANMySQLSlowlogAgentType            AgentType = "qan-mysql-slowlog-agent"
	QANMongoDBProfilerAgentType         AgentType = "qan-mongodb-profiler-agent"
	QANPostgreSQLPgStatementsAgentType  AgentType = "qan-postgresql-pgstatements-agent"
	QANPostgreSQLPgStatMonitorAgentType AgentType = "qan-postgresql-pgstatmonitor-agent"
	ExternalExporterType                AgentType = "external-exporter"
	VMAgentType                         AgentType = "vmagent"
)

Agent types (in the same order as in agents.proto).

type Artifact

type Artifact struct {
	ID         string       `reform:"id,pk"`
	Name       string       `reform:"name"`
	Vendor     string       `reform:"vendor"`
	LocationID string       `reform:"location_id"`
	ServiceID  string       `reform:"service_id"`
	DataModel  DataModel    `reform:"data_model"`
	Status     BackupStatus `reform:"status"`
	CreatedAt  time.Time    `reform:"created_at"`
}

Artifact represents result of a backup.

func ChangeArtifact

func ChangeArtifact(q *reform.Querier, artifactID string, params ChangeArtifactParams) (*Artifact, error)

ChangeArtifact updates existing artifact.

func CreateArtifact

func CreateArtifact(q *reform.Querier, params CreateArtifactParams) (*Artifact, error)

CreateArtifact creates artifact entry in DB.

func FindArtifactByID

func FindArtifactByID(q *reform.Querier, id string) (*Artifact, error)

FindArtifactByID returns artifact by given ID if found, ErrNotFound if not.

func FindArtifacts

func FindArtifacts(q *reform.Querier) ([]*Artifact, error)

FindArtifacts returns artifacts list.

func (*Artifact) AfterFind

func (s *Artifact) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*Artifact) BeforeInsert

func (s *Artifact) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*Artifact) HasPK

func (s *Artifact) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Artifact) PKPointer

func (s *Artifact) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Artifact) PKValue

func (s *Artifact) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Artifact) Pointers

func (s *Artifact) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Artifact) SetPK deprecated

func (s *Artifact) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.ID = pk.

func (Artifact) String

func (s Artifact) String() string

String returns a string representation of this struct or record.

func (*Artifact) Table

func (s *Artifact) Table() reform.Table

Table returns Table object for that record.

func (*Artifact) Values

func (s *Artifact) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Artifact) View

func (s *Artifact) View() reform.View

View returns View object for that struct.

type AzureOptions

type AzureOptions struct {
	SubscriptionID string `json:"subscription_id"`
	ClientID       string `json:"client_id"`
	ClientSecret   string `json:"client_secret"`
	TenantID       string `json:"tenant_id"`
	ResourceGroup  string `json:"resource_group"`
}

AzureOptions represents structure for special Azure options.

func AzureOptionsFromRequest

func AzureOptionsFromRequest(params AzureOptionsParams) *AzureOptions

AzureOptionsFromRequest creates AzureOptions object from request.

func (*AzureOptions) Scan

func (c *AzureOptions) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (AzureOptions) Value

func (c AzureOptions) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type AzureOptionsParams

type AzureOptionsParams interface {
	GetAzureSubscriptionId() string
	GetAzureClientId() string
	GetAzureClientSecret() string
	GetAzureTenantId() string
	GetAzureResourceGroup() string
}

AzureOptionsParams contains methods to create AzureOptions object.

type BackupLocation

type BackupLocation struct {
	ID              string                   `reform:"id,pk"`
	Name            string                   `reform:"name"`
	Description     string                   `reform:"description"`
	Type            BackupLocationType       `reform:"type"`
	S3Config        *S3LocationConfig        `reform:"s3_config"`
	PMMServerConfig *PMMServerLocationConfig `reform:"pmm_server_config"`
	PMMClientConfig *PMMClientLocationConfig `reform:"pmm_client_config"`

	CreatedAt time.Time `reform:"created_at"`
	UpdatedAt time.Time `reform:"updated_at"`
}

BackupLocation represents destination for backup.

func ChangeBackupLocation

func ChangeBackupLocation(q *reform.Querier, locationID string, params ChangeBackupLocationParams) (*BackupLocation, error)

ChangeBackupLocation updates existing location by specified locationID and params.

func CreateBackupLocation

func CreateBackupLocation(q *reform.Querier, params CreateBackupLocationParams) (*BackupLocation, error)

CreateBackupLocation creates backup location.

func FindBackupLocationByID

func FindBackupLocationByID(q *reform.Querier, id string) (*BackupLocation, error)

FindBackupLocationByID finds a Backup Location by its ID.

func FindBackupLocations

func FindBackupLocations(q *reform.Querier) ([]*BackupLocation, error)

FindBackupLocations returns saved backup locations configuration.

func (*BackupLocation) AfterFind

func (s *BackupLocation) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*BackupLocation) BeforeInsert

func (s *BackupLocation) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*BackupLocation) BeforeUpdate

func (s *BackupLocation) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*BackupLocation) HasPK

func (s *BackupLocation) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*BackupLocation) PKPointer

func (s *BackupLocation) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*BackupLocation) PKValue

func (s *BackupLocation) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*BackupLocation) Pointers

func (s *BackupLocation) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*BackupLocation) SetPK deprecated

func (s *BackupLocation) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.ID = pk.

func (BackupLocation) String

func (s BackupLocation) String() string

String returns a string representation of this struct or record.

func (*BackupLocation) Table

func (s *BackupLocation) Table() reform.Table

Table returns Table object for that record.

func (*BackupLocation) Values

func (s *BackupLocation) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*BackupLocation) View

func (s *BackupLocation) View() reform.View

View returns View object for that struct.

type BackupLocationConfig

type BackupLocationConfig struct {
	PMMClientConfig *PMMClientLocationConfig
	PMMServerConfig *PMMServerLocationConfig
	S3Config        *S3LocationConfig
}

BackupLocationConfig groups all backup locations configs.

func (BackupLocationConfig) FillLocationConfig

func (c BackupLocationConfig) FillLocationConfig(location *BackupLocation)

FillLocationConfig fills provided location according to backup config.

func (BackupLocationConfig) Validate

Validate checks if there is exactly one config with required fields and returns if config is set.

type BackupLocationType

type BackupLocationType string

BackupLocationType represents BackupLocation type as stored in database.

const (
	S3BackupLocationType        BackupLocationType = "s3"
	PMMServerBackupLocationType BackupLocationType = "pmm-server"
	PMMClientBackupLocationType BackupLocationType = "pmm-client"
)

BackupLocation types.

type BackupLocationValidationParams

type BackupLocationValidationParams struct {
	RequireConfig    bool
	WithBucketRegion bool
}

BackupLocationValidationParams contains typed params for backup location validate.

type BackupStatus

type BackupStatus string

BackupStatus shows current status of backup.

const (
	PendingBackupStatus    BackupStatus = "pending"
	InProgressBackupStatus BackupStatus = "in_progress"
	PausedBackupStatus     BackupStatus = "paused"
	SuccessBackupStatus    BackupStatus = "success"
	ErrorBackupStatus      BackupStatus = "error"
)

BackupStatus status (in the same order as in artifacts.proto).

func (BackupStatus) Validate

func (bs BackupStatus) Validate() error

Validate validates backup status.

type BoolParam

type BoolParam struct {
	Default *bool `json:"default,omitempty"`
}

BoolParam represents boolean template parameter.

type ChangeArtifactParams

type ChangeArtifactParams struct {
	Status BackupStatus
}

ChangeArtifactParams are params for changing existing artifact.

type ChangeBackupLocationParams

type ChangeBackupLocationParams struct {
	Name        string
	Description string

	BackupLocationConfig
}

ChangeBackupLocationParams are params for updating existing backup location.

type ChangeChannelParams

type ChangeChannelParams struct {
	Summary string

	EmailConfig     *EmailConfig
	PagerDutyConfig *PagerDutyConfig
	SlackConfig     *SlackConfig
	WebHookConfig   *WebHookConfig

	Disabled bool
}

ChangeChannelParams is params for changing existing channel.

type ChangeCommonAgentParams

type ChangeCommonAgentParams struct {
	Disabled           *bool // true - disable, false - enable, nil - do not change
	CustomLabels       map[string]string
	RemoveCustomLabels bool
	DisablePushMetrics *bool
}

ChangeCommonAgentParams contains parameters that can be changed for all Agents.

type ChangeRestoreHistoryItemParams

type ChangeRestoreHistoryItemParams struct {
	Status RestoreStatus
}

ChangeRestoreHistoryItemParams are params for changing existing restore history item.

type ChangeRuleParams

type ChangeRuleParams struct {
	Summary      string
	Disabled     bool
	RuleParams   RuleParams
	For          time.Duration
	Severity     Severity
	CustomLabels map[string]string
	Filters      Filters
	ChannelIDs   []string
}

ChangeRuleParams is params for updating existing Rule.

type ChangeSettingsParams

type ChangeSettingsParams struct {
	// We don't save it to db
	DisableUpdates bool

	DisableTelemetry bool
	EnableTelemetry  bool

	MetricsResolutions MetricsResolutions

	DataRetention time.Duration

	AWSPartitions []string

	SSHKey string

	// not url.URL to keep username and password
	AlertManagerURL       string
	RemoveAlertManagerURL bool

	// Enable Security Threat Tool
	EnableSTT bool
	// Disable Security Threat Tool
	DisableSTT bool
	// List of STT checks to disable
	DisableSTTChecks []string
	// List of STT checks to enable
	EnableSTTChecks []string
	// STT check intevals
	STTCheckIntervals STTCheckIntervals

	// Enable DBaaS features.
	EnableDBaaS bool
	// Disable DBaaS features.
	DisableDBaaS bool

	// Enable Azure Discover features.
	EnableAzurediscover bool
	// Disable Azure Discover features.
	DisableAzurediscover bool

	// Enable Integrated Alerting features.
	EnableAlerting bool
	// Disable Integrated Alerting features.
	DisableAlerting bool

	// Email config for Integrated Alerting.
	EmailAlertingSettings *EmailAlertingSettings
	// If true removes email alerting settings.
	RemoveEmailAlertingSettings bool

	// Slack config for Integrated Alerting.
	SlackAlertingSettings *SlackAlertingSettings
	// If true removes Slack alerting settings.
	RemoveSlackAlertingSettings bool

	// Percona Platform user email
	Email string
	// Percona Platform session Id
	SessionID string
	// LogOut user from Percona Platform, i.e. remove user email and session id
	LogOut bool

	// EnableVMCache enables caching for vmdb search queries
	EnableVMCache bool
	// DisableVMCache disables caching for vmdb search queries
	DisableVMCache bool

	// PMM Server public address.
	PMMPublicAddress       string
	RemovePMMPublicAddress bool

	// Enable Backup Management features.
	EnableBackupManagement bool
	// Disable Backup Management features.
	DisableBackupManagement bool
}

ChangeSettingsParams contains values to change data in settings table.

type ChangeTemplateParams

type ChangeTemplateParams struct {
	Template *alert.Template
	Name     string
	Yaml     string
}

ChangeTemplateParams is params for changing existing rule template.

type Channel

type Channel struct {
	ID      string      `reform:"id,pk"`
	Summary string      `reform:"summary"`
	Type    ChannelType `reform:"type"`

	EmailConfig     *EmailConfig     `reform:"email_config"`
	PagerDutyConfig *PagerDutyConfig `reform:"pagerduty_config"`
	SlackConfig     *SlackConfig     `reform:"slack_config"`
	WebHookConfig   *WebHookConfig   `reform:"webhook_config"`

	Disabled bool `reform:"disabled"`

	CreatedAt time.Time `reform:"created_at"`
	UpdatedAt time.Time `reform:"updated_at"`
}

Channel represents Integrated Alerting Notification Channel configuration.

func ChangeChannel

func ChangeChannel(q *reform.Querier, channelID string, params *ChangeChannelParams) (*Channel, error)

ChangeChannel updates existing notifications channel.

func CreateChannel

func CreateChannel(q *reform.Querier, params *CreateChannelParams) (*Channel, error)

CreateChannel persists notification channel.

func FindChannelByID

func FindChannelByID(q *reform.Querier, id string) (*Channel, error)

FindChannelByID finds Channel by ID.

func FindChannels

func FindChannels(q *reform.Querier) ([]*Channel, error)

FindChannels returns saved notification channels configuration.

func FindChannelsByIDs

func FindChannelsByIDs(q *reform.Querier, ids []string) ([]*Channel, error)

FindChannelsByIDs finds channels by IDs.

func FindChannelsOnPage

func FindChannelsOnPage(q *reform.Querier, pageIndex, pageSize int) ([]*Channel, error)

FindChannelsOnPage returns a page with saved notification channels.

func (*Channel) AfterFind

func (c *Channel) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*Channel) BeforeInsert

func (c *Channel) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*Channel) BeforeUpdate

func (c *Channel) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*Channel) HasPK

func (s *Channel) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Channel) PKPointer

func (s *Channel) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Channel) PKValue

func (s *Channel) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Channel) Pointers

func (s *Channel) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Channel) SetPK deprecated

func (s *Channel) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.ID = pk.

func (Channel) String

func (s Channel) String() string

String returns a string representation of this struct or record.

func (*Channel) Table

func (s *Channel) Table() reform.Table

Table returns Table object for that record.

func (*Channel) Values

func (s *Channel) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Channel) View

func (s *Channel) View() reform.View

View returns View object for that struct.

type ChannelIDs

type ChannelIDs []string

ChannelIDs is a slice of notification channel ids.

func (*ChannelIDs) Scan

func (t *ChannelIDs) Scan(src interface{}) error

Scan implements database/sql Scanner interface.

func (ChannelIDs) Value

func (t ChannelIDs) Value() (driver.Value, error)

Value implements database/sql/driver Valuer interface.

type ChannelType

type ChannelType string

ChannelType represents notificaion channel type.

type CheckSettings

type CheckSettings struct {
	Name     string   `reform:"name,pk"`
	Interval Interval `reform:"interval"`
}

CheckSettings represents any changes to an STT check loaded in pmm-managed.

func ChangeCheckSettings

func ChangeCheckSettings(q *reform.Querier, name string, interval Interval) (*CheckSettings, error)

ChangeCheckSettings updates the interval of a check setting if already present.

func CreateCheckSettings

func CreateCheckSettings(q *reform.Querier, name string, interval Interval) (*CheckSettings, error)

CreateCheckSettings persists CheckSettings.

func FindCheckSettingsByName

func FindCheckSettingsByName(q *reform.Querier, name string) (*CheckSettings, error)

FindCheckSettingsByName finds CheckSettings by check name.

func (*CheckSettings) HasPK

func (s *CheckSettings) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*CheckSettings) PKPointer

func (s *CheckSettings) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*CheckSettings) PKValue

func (s *CheckSettings) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*CheckSettings) Pointers

func (s *CheckSettings) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*CheckSettings) SetPK deprecated

func (s *CheckSettings) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.Name = pk.

func (CheckSettings) String

func (s CheckSettings) String() string

String returns a string representation of this struct or record.

func (*CheckSettings) Table

func (s *CheckSettings) Table() reform.Table

Table returns Table object for that record.

func (*CheckSettings) Values

func (s *CheckSettings) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*CheckSettings) View

func (s *CheckSettings) View() reform.View

View returns View object for that struct.

type Component

type Component struct {
	DisabledVersions []string
	DefaultVersion   string
}

Component stores info about DBaaS Component

func (*Component) Scan

func (c *Component) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (Component) Value

func (c Component) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type CreateAgentParams

type CreateAgentParams struct {
	PMMAgentID                     string
	NodeID                         string
	ServiceID                      string
	Username                       string
	Password                       string
	CustomLabels                   map[string]string
	TLS                            bool
	TLSSkipVerify                  bool
	MySQLOptions                   *MySQLOptions
	MongoDBOptions                 *MongoDBOptions
	TableCountTablestatsGroupLimit int32
	QueryExamplesDisabled          bool
	MaxQueryLogSize                int64
	AWSAccessKey                   string
	AWSSecretKey                   string
	RDSBasicMetricsDisabled        bool
	RDSEnhancedMetricsDisabled     bool
	AzureOptions                   *AzureOptions
	PushMetrics                    bool
	DisableCollectors              []string
}

CreateAgentParams params for add common exporter.

type CreateArtifactParams

type CreateArtifactParams struct {
	Name       string
	Vendor     string
	LocationID string
	ServiceID  string
	DataModel  DataModel
	Status     BackupStatus
}

CreateArtifactParams are params for creating a new artifact.

func (*CreateArtifactParams) Validate

func (p *CreateArtifactParams) Validate() error

Validate validates params used for creating an artifact entry.

type CreateBackupLocationParams

type CreateBackupLocationParams struct {
	Name        string
	Description string

	BackupLocationConfig
}

CreateBackupLocationParams are params for creating new backup location.

type CreateChannelParams

type CreateChannelParams struct {
	Summary string

	EmailConfig     *EmailConfig
	PagerDutyConfig *PagerDutyConfig
	SlackConfig     *SlackConfig
	WebHookConfig   *WebHookConfig

	Disabled bool
}

CreateChannelParams are params for creating new channel.

type CreateExternalExporterParams

type CreateExternalExporterParams struct {
	RunsOnNodeID string
	ServiceID    string
	Username     string
	Password     string
	Scheme       string
	MetricsPath  string
	ListenPort   uint32
	CustomLabels map[string]string
	PushMetrics  bool
}

CreateExternalExporterParams params for add external exporter.

type CreateKubernetesClusterParams

type CreateKubernetesClusterParams struct {
	KubernetesClusterName string
	KubeConfig            string
}

CreateKubernetesClusterParams contains all params required to create Kubernetes cluster.

type CreateNodeParams

type CreateNodeParams struct {
	NodeName      string
	MachineID     *string
	Distro        string
	NodeModel     string
	AZ            string
	ContainerID   *string
	ContainerName *string
	CustomLabels  map[string]string
	Address       string
	Region        *string
}

CreateNodeParams contains parameters for creating Nodes.

type CreateRestoreHistoryItemParams

type CreateRestoreHistoryItemParams struct {
	ArtifactID string
	ServiceID  string
	Status     RestoreStatus
}

CreateRestoreHistoryItemParams are params for creating a new restore history item.

func (*CreateRestoreHistoryItemParams) Validate

func (p *CreateRestoreHistoryItemParams) Validate() error

Validate validates params used for creating a restore history item.

type CreateRuleParams

type CreateRuleParams struct {
	TemplateName string
	Summary      string
	Disabled     bool
	RuleParams   RuleParams
	For          time.Duration
	Severity     Severity
	CustomLabels map[string]string
	Filters      Filters
	ChannelIDs   []string
}

CreateRuleParams are params for creating new Rule.

type CreateTemplateParams

type CreateTemplateParams struct {
	Template *alert.Template
	Yaml     string
	Source   Source
}

CreateTemplateParams are params for creating new rule template.

type DBConfig

type DBConfig struct {
	User     string
	Password string
	Address  string
	Port     int
	Socket   string
}

DBConfig contains values required to connect to DB.

func FindDBConfigForService

func FindDBConfigForService(q *reform.Querier, serviceID string) (DBConfig, error)

FindDBConfigForService find DB config from agents running on service specified by serviceID.

func (DBConfig) Valid

func (c DBConfig) Valid() bool

Valid returns true if config is valid.

type DataModel

type DataModel string

DataModel represents a data model used for performing a backup.

const (
	PhysicalDataModel DataModel = "physical"
	LogicalDataModel  DataModel = "logical"
)

DataModel types (in the same order as in artifacts.proto).

func (DataModel) Validate

func (dm DataModel) Validate() error

Validate validates data model.

type DelimiterPair

type DelimiterPair struct {
	Left  string
	Right string
}

DelimiterPair contains a pair of safe template delimiters.

func TemplateDelimsPair

func TemplateDelimsPair(str ...string) DelimiterPair

TemplateDelimsPair returns a pair of safe template delimiters that are not present in any given string.

type EchoJobResult

type EchoJobResult struct {
	Message string `json:"message"`
}

EchoJobResult stores echo job specific result data.

type EmailAlertingSettings

type EmailAlertingSettings struct {
	From      string `json:"from"`
	Smarthost string `json:"smarthost"`
	Hello     string `json:"hello"`
	Username  string `json:"username"`
	Password  string `json:"password"`
	Identity  string `json:"identity"`
	Secret    string `json:"secret"`
}

EmailAlertingSettings represents email settings for Integrated Alerting.

type EmailConfig

type EmailConfig struct {
	SendResolved bool     `json:"send_resolved"`
	To           []string `json:"to"`
}

EmailConfig is email notification channel configuration.

func (*EmailConfig) Scan

func (c *EmailConfig) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (EmailConfig) Value

func (c EmailConfig) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type Filter

type Filter struct {
	Type FilterType `json:"type"`
	Key  string     `json:"key"`
	Val  string     `json:"value"`
}

Filter represents rule filter.

func (*Filter) Scan

func (f *Filter) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (Filter) Value

func (f Filter) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type FilterType

type FilterType string

FilterType represents rule filter type.

type Filters

type Filters []Filter

Filters represents filters slice.

func (*Filters) Scan

func (t *Filters) Scan(src interface{}) error

Scan implements database/sql Scanner interface.

func (Filters) Value

func (t Filters) Value() (driver.Value, error)

Value implements database/sql/driver Valuer interface.

type FloatParam

type FloatParam struct {
	Default *float64 `json:"default,omitempty"`
	Min     *float64 `json:"min,omitempty"`
	Max     *float64 `json:"max,omitempty"`
}

FloatParam represents float template parameter.

type HTTPBasicAuth

type HTTPBasicAuth struct {
	Username     string `json:"username,omitempty"`
	Password     string `json:"password,omitempty"`
	PasswordFile string `json:"password_file,omitempty"`
}

HTTPBasicAuth is HTTP basic authentication configuration.

type HTTPConfig

type HTTPConfig struct {
	BasicAuth       *HTTPBasicAuth `json:"basic_auth,omitempty"`
	BearerToken     string         `json:"bearer_token,omitempty"`
	BearerTokenFile string         `json:"bearer_token_file,omitempty"`
	TLSConfig       *TLSConfig     `json:"tls_config,omitempty"`
	ProxyURL        string         `json:"proxy_url,omitempty"`
}

HTTPConfig is HTTP connection configuration.

type IntegratedAlerting

type IntegratedAlerting struct {
	Enabled               bool                   `json:"enabled"`
	EmailAlertingSettings *EmailAlertingSettings `json:"email_settings"`
	SlackAlertingSettings *SlackAlertingSettings `json:"slack_settings"`
}

IntegratedAlerting contains settings related to IntegratedAlerting.

type Interval

type Interval string

Interval represents check execution interval.

const (
	Standard Interval = "standard"
	Frequent Interval = "frequent"
	Rare     Interval = "rare"
)

Available check execution intervals.

type JobResult

type JobResult struct {
	ID         string         `reform:"id,pk"`
	PMMAgentID string         `reform:"pmm_agent_id"`
	Type       JobType        `reform:"type"`
	Done       bool           `reform:"done"`
	Error      string         `reform:"error"`
	Result     *JobResultData `reform:"result"`
	CreatedAt  time.Time      `reform:"created_at"`
	UpdatedAt  time.Time      `reform:"updated_at"`
}

JobResult describes a job result which is storing in persistent storage.

func CreateJobResult

func CreateJobResult(q *reform.Querier, pmmAgentID string, jobType JobType, data *JobResultData) (*JobResult, error)

CreateJobResult stores a job result in the storage.

func FindJobResultByID

func FindJobResultByID(q *reform.Querier, id string) (*JobResult, error)

FindJobResultByID finds JobResult by ID.

func (*JobResult) AfterFind

func (r *JobResult) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*JobResult) BeforeInsert

func (r *JobResult) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*JobResult) BeforeUpdate

func (r *JobResult) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*JobResult) HasPK

func (s *JobResult) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*JobResult) PKPointer

func (s *JobResult) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*JobResult) PKValue

func (s *JobResult) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*JobResult) Pointers

func (s *JobResult) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*JobResult) SetPK deprecated

func (s *JobResult) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.ID = pk.

func (JobResult) String

func (s JobResult) String() string

String returns a string representation of this struct or record.

func (*JobResult) Table

func (s *JobResult) Table() reform.Table

Table returns Table object for that record.

func (*JobResult) Values

func (s *JobResult) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*JobResult) View

func (s *JobResult) View() reform.View

View returns View object for that struct.

type JobResultData

type JobResultData struct {
	Echo               *EchoJobResult               `json:"echo,omitempty"`
	MySQLBackup        *MySQLBackupJobResult        `json:"mysql_backup,omitempty"`
	MySQLRestoreBackup *MySQLRestoreBackupJobResult `json:"mysql_restore_backup,omitempty"`
}

JobResultData holds result data for different job types.

func (*JobResultData) Scan

func (c *JobResultData) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (JobResultData) Value

func (c JobResultData) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type JobType

type JobType string

JobType represents job type.

type KubernetesCluster

type KubernetesCluster struct {
	ID                    string     `reform:"id,pk"`
	KubernetesClusterName string     `reform:"kubernetes_cluster_name"`
	KubeConfig            string     `reform:"kube_config"`
	PXC                   *Component `reform:"pxc"`
	ProxySQL              *Component `reform:"proxysql"`
	HAProxy               *Component `reform:"haproxy"`
	Mongod                *Component `reform:"mongod"`
	CreatedAt             time.Time  `reform:"created_at"`
	UpdatedAt             time.Time  `reform:"updated_at"`
}

KubernetesCluster represents a Kubernetes cluster as stored in database.

func CreateKubernetesCluster

func CreateKubernetesCluster(q *reform.Querier, params *CreateKubernetesClusterParams) (*KubernetesCluster, error)

CreateKubernetesCluster creates Kubernetes cluster with provided params.

func FindAllKubernetesClusters

func FindAllKubernetesClusters(q *reform.Querier) ([]*KubernetesCluster, error)

FindAllKubernetesClusters returns all Kubernetes clusters.

func FindKubernetesClusterByName

func FindKubernetesClusterByName(q *reform.Querier, name string) (*KubernetesCluster, error)

FindKubernetesClusterByName finds a Kubernetes cluster with provided name.

func (*KubernetesCluster) AfterFind

func (s *KubernetesCluster) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*KubernetesCluster) BeforeInsert

func (s *KubernetesCluster) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*KubernetesCluster) BeforeUpdate

func (s *KubernetesCluster) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*KubernetesCluster) HasPK

func (s *KubernetesCluster) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*KubernetesCluster) PKPointer

func (s *KubernetesCluster) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*KubernetesCluster) PKValue

func (s *KubernetesCluster) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*KubernetesCluster) Pointers

func (s *KubernetesCluster) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*KubernetesCluster) SetPK deprecated

func (s *KubernetesCluster) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.ID = pk.

func (KubernetesCluster) String

func (s KubernetesCluster) String() string

String returns a string representation of this struct or record.

func (*KubernetesCluster) Table

func (s *KubernetesCluster) Table() reform.Table

Table returns Table object for that record.

func (*KubernetesCluster) Values

func (s *KubernetesCluster) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*KubernetesCluster) View

func (s *KubernetesCluster) View() reform.View

View returns View object for that struct.

type MetricsResolutions

type MetricsResolutions struct {
	HR time.Duration `json:"hr"`
	MR time.Duration `json:"mr"`
	LR time.Duration `json:"lr"`
}

MetricsResolutions contains standard VictoriaMetrics metrics resolutions.

type MongoDBOptions

type MongoDBOptions struct {
	TLSCertificateKey             string `json:"tls_certificate_key"`
	TLSCertificateKeyFilePassword string `json:"tls_certificate_key_file_password"`
	TLSCa                         string `json:"tls_ca"`
}

MongoDBOptions represents structure for special MongoDB options.

func MongoDBOptionsFromRequest

func MongoDBOptionsFromRequest(params MongoDBOptionsParams) *MongoDBOptions

MongoDBOptionsFromRequest creates MongoDBOptionsParams object from request.

func (*MongoDBOptions) Scan

func (c *MongoDBOptions) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (MongoDBOptions) Value

func (c MongoDBOptions) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type MongoDBOptionsParams

type MongoDBOptionsParams interface {
	GetTlsCertificateKey() string
	GetTlsCertificateKeyFilePassword() string
	GetTlsCa() string
}

MongoDBOptionsParams contains methods to create MongoDBOptions object.

type MySQLBackupJobResult

type MySQLBackupJobResult struct {
	ArtifactID string `json:"artifact_id"`
}

MySQLBackupJobResult stores MySQL job specific result data.

type MySQLOptions

type MySQLOptions struct {
	TLSCa   string `json:"tls_ca"`
	TLSCert string `json:"tls_cert"`
	TLSKey  string `json:"tls_key"`
}

MySQLOptions represents structure for special MySQL options.

func MySQLOptionsFromRequest

func MySQLOptionsFromRequest(params MySQLOptionsParams) *MySQLOptions

MySQLOptionsFromRequest creates MySQLOptions object from request.

func (*MySQLOptions) Scan

func (c *MySQLOptions) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (MySQLOptions) Value

func (c MySQLOptions) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type MySQLOptionsParams

type MySQLOptionsParams interface {
	GetTlsCa() string
	GetTlsCert() string
	GetTlsKey() string
}

MySQLOptionsParams contains methods to create MySQLOptions object.

type MySQLRestoreBackupJobResult

type MySQLRestoreBackupJobResult struct {
	RestoreID string `json:"restore_id,omitempty"`
}

MySQLRestoreBackupJobResult stores MySQL restore backup job specific result data.

type Node

type Node struct {
	NodeID       string   `reform:"node_id,pk"`
	NodeType     NodeType `reform:"node_type"`
	NodeName     string   `reform:"node_name"`
	MachineID    *string  `reform:"machine_id"`
	Distro       string   `reform:"distro"`
	NodeModel    string   `reform:"node_model"`
	AZ           string   `reform:"az"`
	CustomLabels []byte   `reform:"custom_labels"`

	// Node address. Used to construct endpoint for node_exporter.
	// For RemoteRDS Nodes contains DBInstanceIdentifier (not DbiResourceId; not endpoint - that's Service address).
	Address string `reform:"address"`

	CreatedAt time.Time `reform:"created_at"`
	UpdatedAt time.Time `reform:"updated_at"`

	ContainerID   *string `reform:"container_id"` // nil means "unknown"; non-nil value must be unique
	ContainerName *string `reform:"container_name"`

	Region *string `reform:"region"` // non-nil value must be unique in combination with instance/address
}

Node represents Node as stored in database.

func CheckUniqueNodeInstanceRegion

func CheckUniqueNodeInstanceRegion(q *reform.Querier, instance string, region *string) (*Node, error)

CheckUniqueNodeInstanceRegion checks for uniqueness of instance address and region. This function not only return an error in case of finding an existing node with those paramenters but also returns the Node itself if there is any, because if we are recreating the instance (--force in pmm-admin) we need to know the Node.ID to remove it and its dependencies. This check only applies is region is not empty.

func CreateNode

func CreateNode(q *reform.Querier, nodeType NodeType, params *CreateNodeParams) (*Node, error)

CreateNode creates a Node.

func FindNodeByID

func FindNodeByID(q *reform.Querier, id string) (*Node, error)

FindNodeByID finds a Node by ID.

func FindNodeByName

func FindNodeByName(q *reform.Querier, name string) (*Node, error)

FindNodeByName finds a Node by name.

func FindNodes

func FindNodes(q *reform.Querier, filters NodeFilters) ([]*Node, error)

FindNodes returns Nodes by filters.

func FindNodesByIDs

func FindNodesByIDs(q *reform.Querier, ids []string) ([]*Node, error)

FindNodesByIDs finds Nodes by IDs.

func (*Node) AfterFind

func (s *Node) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*Node) BeforeInsert

func (s *Node) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*Node) BeforeUpdate

func (s *Node) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*Node) GetCustomLabels

func (s *Node) GetCustomLabels() (map[string]string, error)

GetCustomLabels decodes custom labels.

func (*Node) HasPK

func (s *Node) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Node) PKPointer

func (s *Node) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Node) PKValue

func (s *Node) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Node) Pointers

func (s *Node) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Node) SetCustomLabels

func (s *Node) SetCustomLabels(m map[string]string) error

SetCustomLabels encodes custom labels.

func (*Node) SetPK deprecated

func (s *Node) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.NodeID = pk.

func (Node) String

func (s Node) String() string

String returns a string representation of this struct or record.

func (*Node) Table

func (s *Node) Table() reform.Table

Table returns Table object for that record.

func (*Node) UnifiedLabels

func (s *Node) UnifiedLabels() (map[string]string, error)

UnifiedLabels returns combined standard and custom labels with empty labels removed.

func (*Node) Values

func (s *Node) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Node) View

func (s *Node) View() reform.View

View returns View object for that struct.

type NodeFilters

type NodeFilters struct {
	// Return Nodes with provided type.
	NodeType *NodeType
}

NodeFilters represents filters for nodes list.

type NodeType

type NodeType string

NodeType represents Node type as stored in databases: pmm-managed's PostgreSQL, qan-api's ClickHouse, and VictoriaMetrics.

const (
	GenericNodeType             NodeType = "generic"
	ContainerNodeType           NodeType = "container"
	RemoteNodeType              NodeType = "remote"
	RemoteRDSNodeType           NodeType = "remote_rds"
	RemoteAzureDatabaseNodeType NodeType = "remote_azure_database"
)

Node types (in the same order as in nodes.proto).

type PMMClientLocationConfig

type PMMClientLocationConfig struct {
	Path string `json:"path"`
}

PMMClientLocationConfig contains require properties for accessing file system on pmm-client-node.

func (*PMMClientLocationConfig) Scan

func (c *PMMClientLocationConfig) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (PMMClientLocationConfig) Value

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type PMMServerLocationConfig

type PMMServerLocationConfig struct {
	Path string `json:"path"`
}

PMMServerLocationConfig contains require properties for accessing file system on pmm-server-node.

func (*PMMServerLocationConfig) Scan

func (c *PMMServerLocationConfig) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (PMMServerLocationConfig) Value

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type PagerDutyConfig

type PagerDutyConfig struct {
	SendResolved bool   `json:"send_resolved"`
	RoutingKey   string `json:"routing_key,omitempty"`
	ServiceKey   string `json:"service_key,omitempty"`
}

PagerDutyConfig represents PagerDuty channel configuration.

func (*PagerDutyConfig) Scan

func (c *PagerDutyConfig) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (PagerDutyConfig) Value

func (c PagerDutyConfig) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type ParamType

type ParamType string

ParamType represents parameter type.

type RemoveMode

type RemoveMode int

RemoveMode defines how Remove functions deal with dependend objects.

const (
	// RemoveRestrict returns error if there dependend objects.
	RemoveRestrict RemoveMode = iota
	// RemoveCascade removes dependend objects recursively.
	RemoveCascade
)

type RestoreHistoryItem

type RestoreHistoryItem struct {
	ID         string        `reform:"id,pk"`
	ArtifactID string        `reform:"artifact_id"`
	ServiceID  string        `reform:"service_id"`
	Status     RestoreStatus `reform:"status"`
	StartedAt  time.Time     `reform:"started_at"`
	FinishedAt *time.Time    `reform:"finished_at"`
}

RestoreHistoryItem represents a restore backup history.

func ChangeRestoreHistoryItem

func ChangeRestoreHistoryItem(
	q *reform.Querier,
	restoreID string,
	params ChangeRestoreHistoryItemParams,
) (*RestoreHistoryItem, error)

ChangeRestoreHistoryItem updates existing restore history item.

func CreateRestoreHistoryItem

func CreateRestoreHistoryItem(q *reform.Querier, params CreateRestoreHistoryItemParams) (*RestoreHistoryItem, error)

CreateRestoreHistoryItem creates a restore history item entry in DB.

func FindRestoreHistoryItems

func FindRestoreHistoryItems(q *reform.Querier) ([]*RestoreHistoryItem, error)

FindRestoreHistoryItems returns restore history list.

func (*RestoreHistoryItem) AfterFind

func (s *RestoreHistoryItem) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*RestoreHistoryItem) BeforeInsert

func (s *RestoreHistoryItem) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*RestoreHistoryItem) HasPK

func (s *RestoreHistoryItem) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*RestoreHistoryItem) PKPointer

func (s *RestoreHistoryItem) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*RestoreHistoryItem) PKValue

func (s *RestoreHistoryItem) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*RestoreHistoryItem) Pointers

func (s *RestoreHistoryItem) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*RestoreHistoryItem) SetPK deprecated

func (s *RestoreHistoryItem) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.ID = pk.

func (RestoreHistoryItem) String

func (s RestoreHistoryItem) String() string

String returns a string representation of this struct or record.

func (*RestoreHistoryItem) Table

func (s *RestoreHistoryItem) Table() reform.Table

Table returns Table object for that record.

func (*RestoreHistoryItem) Values

func (s *RestoreHistoryItem) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*RestoreHistoryItem) View

func (s *RestoreHistoryItem) View() reform.View

View returns View object for that struct.

type RestoreStatus

type RestoreStatus string

RestoreStatus shows current status of restore.

const (
	InProgressRestoreStatus RestoreStatus = "in_progress"
	SuccessRestoreStatus    RestoreStatus = "success"
	ErrorRestoreStatus      RestoreStatus = "error"
)

RestoreStatus status (in the same order as in restores.proto).

func (RestoreStatus) Validate

func (rs RestoreStatus) Validate() error

Validate validates restore status.

type Rule

type Rule struct {
	TemplateName string        `reform:"template_name"`
	ID           string        `reform:"id,pk"`
	Summary      string        `reform:"summary"`
	Disabled     bool          `reform:"disabled"`
	Params       RuleParams    `reform:"params"`
	For          time.Duration `reform:"for"`
	Severity     Severity      `reform:"severity"`
	CustomLabels []byte        `reform:"custom_labels"`
	Filters      Filters       `reform:"filters"`
	ChannelIDs   ChannelIDs    `reform:"channel_ids"`
	CreatedAt    time.Time     `reform:"created_at"`
	UpdatedAt    time.Time     `reform:"updated_at"`
}

Rule represents alert rule configuration.

func ChangeRule

func ChangeRule(q *reform.Querier, ruleID string, params *ChangeRuleParams) (*Rule, error)

ChangeRule updates existing alerts Rule.

func CreateRule

func CreateRule(q *reform.Querier, params *CreateRuleParams) (*Rule, error)

CreateRule persists alert Rule.

func FindRuleByID

func FindRuleByID(q *reform.Querier, id string) (*Rule, error)

FindRuleByID finds Rule by ID.

func FindRules

func FindRules(q *reform.Querier) ([]*Rule, error)

FindRules returns saved alert rules configuration.

func FindRulesOnPage

func FindRulesOnPage(q *reform.Querier, pageIndex, pageSize int) ([]*Rule, error)

FindRulesOnPage returns a page with saved alert rules configuration.

func ToggleRule

func ToggleRule(q *reform.Querier, ruleID string, params *ToggleRuleParams) (*Rule, error)

ToggleRule updates some alert rule fields.

func (*Rule) AfterFind

func (r *Rule) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*Rule) BeforeInsert

func (r *Rule) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*Rule) BeforeUpdate

func (r *Rule) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*Rule) GetCustomLabels

func (r *Rule) GetCustomLabels() (map[string]string, error)

GetCustomLabels decodes template labels.

func (*Rule) HasPK

func (s *Rule) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Rule) PKPointer

func (s *Rule) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Rule) PKValue

func (s *Rule) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Rule) Pointers

func (s *Rule) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Rule) SetCustomLabels

func (r *Rule) SetCustomLabels(m map[string]string) error

SetCustomLabels encodes template labels.

func (*Rule) SetPK deprecated

func (s *Rule) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.ID = pk.

func (Rule) String

func (s Rule) String() string

String returns a string representation of this struct or record.

func (*Rule) Table

func (s *Rule) Table() reform.Table

Table returns Table object for that record.

func (*Rule) Values

func (s *Rule) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Rule) View

func (s *Rule) View() reform.View

View returns View object for that struct.

type RuleParam

type RuleParam struct {
	Name        string    `json:"name"`
	Type        ParamType `json:"type"`
	BoolValue   bool      `json:"bool"`
	FloatValue  float32   `json:"float"`
	StringValue string    `json:"string"`
}

RuleParam represents rule parameter.

func (*RuleParam) Scan

func (p *RuleParam) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (RuleParam) Value

func (p RuleParam) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type RuleParams

type RuleParams []RuleParam

RuleParams represents rule parameters slice.

func (*RuleParams) Scan

func (t *RuleParams) Scan(src interface{}) error

Scan implements database/sql Scanner interface.

func (RuleParams) Value

func (t RuleParams) Value() (driver.Value, error)

Value implements database/sql/driver Valuer interface.

type S3LocationConfig

type S3LocationConfig struct {
	Endpoint     string `json:"endpoint"`
	AccessKey    string `json:"access_key"`
	SecretKey    string `json:"secret_key"`
	BucketName   string `json:"bucket_name"`
	BucketRegion string `json:"bucket_region"`
}

S3LocationConfig contains required properties for accessing S3 Bucket.

func (*S3LocationConfig) Scan

func (c *S3LocationConfig) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (S3LocationConfig) Value

func (c S3LocationConfig) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type STTCheckIntervals

type STTCheckIntervals struct {
	StandardInterval time.Duration `json:"standard_interval"`
	RareInterval     time.Duration `json:"rare_interval"`
	FrequentInterval time.Duration `json:"frequent_interval"`
}

STTCheckIntervals represents intervals between STT checks.

type SaaS

type SaaS struct {
	// Percona Platform user email
	Email string `json:"email"`
	// Percona Platform session Id
	SessionID string `json:"session_id"`
	// Security Threat Tool enabled
	STTEnabled bool `json:"stt_enabled"`
	// List of disabled STT checks
	DisabledSTTChecks []string `json:"disabled_stt_checks"`
	// STT check intervals
	STTCheckIntervals STTCheckIntervals `json:"stt_check_intervals"`
}

SaaS contains settings related to the SaaS platform.

type Service

type Service struct {
	ServiceID      string      `reform:"service_id,pk"`
	ServiceType    ServiceType `reform:"service_type"`
	ServiceName    string      `reform:"service_name"`
	NodeID         string      `reform:"node_id"`
	Environment    string      `reform:"environment"`
	Cluster        string      `reform:"cluster"`
	ReplicationSet string      `reform:"replication_set"`
	CustomLabels   []byte      `reform:"custom_labels"`
	ExternalGroup  string      `reform:"external_group"`
	CreatedAt      time.Time   `reform:"created_at"`
	UpdatedAt      time.Time   `reform:"updated_at"`

	Address *string `reform:"address"`
	Port    *uint16 `reform:"port"`
	Socket  *string `reform:"socket"`
}

Service represents Service as stored in database.

func AddNewService

func AddNewService(q *reform.Querier, serviceType ServiceType, params *AddDBMSServiceParams) (*Service, error)

AddNewService adds new service to storage.

func FindServiceByID

func FindServiceByID(q *reform.Querier, id string) (*Service, error)

FindServiceByID finds Service by ID.

func FindServiceByName

func FindServiceByName(q *reform.Querier, name string) (*Service, error)

FindServiceByName finds Service by Name.

func FindServices

func FindServices(q *reform.Querier, filters ServiceFilters) ([]*Service, error)

FindServices returns Services by filters.

func (*Service) AfterFind

func (s *Service) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*Service) BeforeInsert

func (s *Service) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*Service) BeforeUpdate

func (s *Service) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*Service) GetCustomLabels

func (s *Service) GetCustomLabels() (map[string]string, error)

GetCustomLabels decodes custom labels.

func (*Service) HasPK

func (s *Service) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Service) PKPointer

func (s *Service) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Service) PKValue

func (s *Service) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Service) Pointers

func (s *Service) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Service) SetCustomLabels

func (s *Service) SetCustomLabels(m map[string]string) error

SetCustomLabels encodes custom labels.

func (*Service) SetPK deprecated

func (s *Service) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.ServiceID = pk.

func (Service) String

func (s Service) String() string

String returns a string representation of this struct or record.

func (*Service) Table

func (s *Service) Table() reform.Table

Table returns Table object for that record.

func (*Service) UnifiedLabels

func (s *Service) UnifiedLabels() (map[string]string, error)

UnifiedLabels returns combined standard and custom labels with empty labels removed.

func (*Service) Values

func (s *Service) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Service) View

func (s *Service) View() reform.View

View returns View object for that struct.

type ServiceFilters

type ServiceFilters struct {
	// Return only Services runs on that Node.
	NodeID string
	// Return only Services with provided type.
	ServiceType *ServiceType
	// Return only Services with given external group.
	ExternalGroup string
}

ServiceFilters represents filters for services list.

type ServiceType

type ServiceType string

ServiceType represents Service type as stored in databases: pmm-managed's PostgreSQL, qan-api's ClickHouse, and VictoriaMetrics.

const (
	MySQLServiceType      ServiceType = "mysql"
	MongoDBServiceType    ServiceType = "mongodb"
	PostgreSQLServiceType ServiceType = "postgresql"
	ProxySQLServiceType   ServiceType = "proxysql"
	HAProxyServiceType    ServiceType = "haproxy"
	ExternalServiceType   ServiceType = "external"
)

Service types (in the same order as in services.proto).

type Settings

type Settings struct {
	PMMPublicAddress string `json:"pmm_public_address"`

	Telemetry struct {
		Disabled bool   `json:"disabled"`
		UUID     string `json:"uuid"`
	} `json:"telemetry"`

	MetricsResolutions MetricsResolutions `json:"metrics_resolutions"`

	DataRetention time.Duration `json:"data_retention"`

	AWSPartitions []string `json:"aws_partitions"`

	AWSInstanceChecked bool `json:"aws_instance_checked"`

	SSHKey string `json:"ssh_key"`

	// not url.URL to keep username and password
	AlertManagerURL string `json:"alert_manager_url"`

	VictoriaMetrics struct {
		CacheEnabled bool `json:"cache_enabled"`
	} `json:"victoria_metrics"`

	SaaS SaaS `json:"sass"` // sic :(

	// DBaaS config options
	DBaaS struct {
		Enabled bool `json:"enabled"`
	} `json:"dbaas"`

	IntegratedAlerting IntegratedAlerting `json:"ia"`

	Azurediscover struct {
		Enabled bool `json:"enabled"`
	} `json:"azure"`

	BackupManagement struct {
		Enabled bool `json:"enabled"`
	} `json:"backup_management"`
}

Settings contains PMM Server settings.

func GetSettings

func GetSettings(q reform.DBTX) (*Settings, error)

GetSettings returns current PMM Server settings.

func UpdateSettings

func UpdateSettings(q reform.DBTX, params *ChangeSettingsParams) (*Settings, error)

UpdateSettings updates only non-zero, non-empty values.

type SetupDBParams

type SetupDBParams struct {
	Logf             reform.Printf
	Username         string
	Password         string
	SetupFixtures    SetupFixturesMode
	MigrationVersion *int
}

SetupDBParams represents SetupDB parameters.

type SetupFixturesMode

type SetupFixturesMode int

SetupFixturesMode defines if SetupDB adds initial data to the database or not.

const (
	// SetupFixtures adds initial data to the database.
	SetupFixtures SetupFixturesMode = iota
	// SkipFixtures skips adding initial data to the database. Useful for tests.
	SkipFixtures
)

type Severity

type Severity common.Severity

Severity represents alert severity. Integer values is the same as common.Severity. Common constants can be used. Database representation is a string and is handled by Value and Scan methods below.

func (*Severity) Scan

func (s *Severity) Scan(src interface{}) error

Scan implements database/sql Scanner interface.

func (Severity) Value

func (s Severity) Value() (driver.Value, error)

Value implements database/sql/driver Valuer interface.

type SlackAlertingSettings

type SlackAlertingSettings struct {
	URL string `json:"url"`
}

SlackAlertingSettings represents Slack settings for Integrated Alerting.

type SlackConfig

type SlackConfig struct {
	SendResolved bool   `json:"send_resolved"`
	Channel      string `json:"channel"`
}

SlackConfig is slack notification channel configuration.

func (*SlackConfig) Scan

func (c *SlackConfig) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (SlackConfig) Value

func (c SlackConfig) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type Source

type Source string

Source represents template source.

type StringParam

type StringParam struct {
	Default *string `json:"default,omitempty"`
}

StringParam represents string template parameter.

type TLSConfig

type TLSConfig struct {
	CaFile             string `json:"ca_file,omitempty"`
	CertFile           string `json:"cert_file,omitempty"`
	KeyFile            string `json:"key_file,omitempty"`
	ServerName         string `json:"server_name,omitempty"`
	InsecureSkipVerify bool   `json:"insecure_skip_verify,omitempty"`
}

TLSConfig is TLS configuration.

type Template

type Template struct {
	Name        string         `reform:"name,pk"`
	Version     uint32         `reform:"version"`
	Summary     string         `reform:"summary"`
	Tiers       Tiers          `reform:"tiers"`
	Expr        string         `reform:"expr"`
	Params      TemplateParams `reform:"params"`
	For         time.Duration  `reform:"for"`
	Severity    Severity       `reform:"severity"`
	Labels      []byte         `reform:"labels"`
	Annotations []byte         `reform:"annotations"`
	Source      Source         `reform:"source"`
	Yaml        string         `reform:"yaml"`

	CreatedAt time.Time `reform:"created_at"`
	UpdatedAt time.Time `reform:"updated_at"`
}

Template represents Integrated Alerting rule template.

func ChangeTemplate

func ChangeTemplate(q *reform.Querier, params *ChangeTemplateParams) (*Template, error)

ChangeTemplate updates existing rule template.

func CreateTemplate

func CreateTemplate(q *reform.Querier, params *CreateTemplateParams) (*Template, error)

CreateTemplate creates rule template.

func FindTemplateByName

func FindTemplateByName(q *reform.Querier, name string) (*Template, error)

FindTemplateByName finds template by name.

func FindTemplates

func FindTemplates(q *reform.Querier) ([]Template, error)

FindTemplates returns saved notification rule templates.

func (*Template) AfterFind

func (t *Template) AfterFind() error

AfterFind implements reform.AfterFinder interface.

func (*Template) BeforeInsert

func (t *Template) BeforeInsert() error

BeforeInsert implements reform.BeforeInserter interface.

func (*Template) BeforeUpdate

func (t *Template) BeforeUpdate() error

BeforeUpdate implements reform.BeforeUpdater interface.

func (*Template) GetAnnotations

func (t *Template) GetAnnotations() (map[string]string, error)

GetAnnotations decodes template annotations.

func (*Template) GetLabels

func (t *Template) GetLabels() (map[string]string, error)

GetLabels decodes template labels.

func (*Template) HasPK

func (s *Template) HasPK() bool

HasPK returns true if record has non-zero primary key set, false otherwise.

func (*Template) PKPointer

func (s *Template) PKPointer() interface{}

PKPointer returns a pointer to primary key field for that record. Returned interface{} value is never untyped nil.

func (*Template) PKValue

func (s *Template) PKValue() interface{}

PKValue returns a value of primary key for that record. Returned interface{} value is never untyped nil.

func (*Template) Pointers

func (s *Template) Pointers() []interface{}

Pointers returns a slice of pointers to struct or record fields. Returned interface{} values are never untyped nils.

func (*Template) SetAnnotations

func (t *Template) SetAnnotations(m map[string]string) error

SetAnnotations encodes template annotations.

func (*Template) SetLabels

func (t *Template) SetLabels(m map[string]string) error

SetLabels encodes template labels.

func (*Template) SetPK deprecated

func (s *Template) SetPK(pk interface{})

SetPK sets record primary key, if possible.

Deprecated: prefer direct field assignment where possible: s.Name = pk.

func (Template) String

func (s Template) String() string

String returns a string representation of this struct or record.

func (*Template) Table

func (s *Template) Table() reform.Table

Table returns Table object for that record.

func (*Template) Values

func (s *Template) Values() []interface{}

Values returns a slice of struct or record field values. Returned interface{} values are never untyped nils.

func (*Template) View

func (s *Template) View() reform.View

View returns View object for that struct.

type TemplateParam

type TemplateParam struct {
	Name    string    `json:"name"`
	Summary string    `json:"summary"`
	Unit    string    `json:"unit"`
	Type    ParamType `json:"type"`

	FloatParam *FloatParam `json:"float_param"`
}

TemplateParam represents template parameter.

type TemplateParams

type TemplateParams []TemplateParam

TemplateParams represent TemplateParam slice.

func (*TemplateParams) Scan

func (p *TemplateParams) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (TemplateParams) Value

func (p TemplateParams) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type Tiers

type Tiers []common.Tier

Tiers represents tiers slice.

func (*Tiers) Scan

func (t *Tiers) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (Tiers) Value

func (t Tiers) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

type ToggleRuleParams

type ToggleRuleParams struct {
	Disabled *bool // nil - do not change
}

ToggleRuleParams represents rule toggle parameters.

type VictoriaMetricsParams

type VictoriaMetricsParams struct {
	// VMAlertFlags additional flags for VMAlert.
	VMAlertFlags []string
	// BaseConfigPath defines path for basic prometheus config.
	BaseConfigPath string
}

VictoriaMetricsParams - defines flags and settings for victoriametrics.

func NewVictoriaMetricsParams

func NewVictoriaMetricsParams(basePath string) (*VictoriaMetricsParams, error)

NewVictoriaMetricsParams - returns configuration params for VictoriaMetrics.

func (*VictoriaMetricsParams) UpdateParams

func (vmp *VictoriaMetricsParams) UpdateParams() error

UpdateParams - reads configuration file and updates corresponding flags.

type WebHookConfig

type WebHookConfig struct {
	SendResolved bool        ` json:"send_resolved"`
	URL          string      ` json:"url"`
	HTTPConfig   *HTTPConfig ` json:"http_config,omitempty"`
	MaxAlerts    int32       ` json:"max_alerts"`
}

WebHookConfig is webhook notification channel configuration.

func (*WebHookConfig) Scan

func (c *WebHookConfig) Scan(src interface{}) error

Scan implements database/sql.Scanner interface. Should be defined on the pointer.

func (WebHookConfig) Value

func (c WebHookConfig) Value() (driver.Value, error)

Value implements database/sql/driver.Valuer interface. Should be defined on the value.

Jump to

Keyboard shortcuts

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