pagerduty

package
v0.34.0 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: Apache-2.0 Imports: 18 Imported by: 4

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	// DefaultPagerdutyDetails defines the default values for PagerDuty details.
	DefaultPagerdutyDetails = map[string]any{
		"firing":       `{{ .Alerts.Firing | toJson }}`,
		"resolved":     `{{ .Alerts.Resolved | toJson }}`,
		"num_firing":   `{{ .Alerts.Firing | len }}`,
		"num_resolved": `{{ .Alerts.Resolved | len }}`,
	}

	// DefaultPagerdutyConfig defines default values for PagerDuty configurations.
	DefaultPagerdutyConfig = PagerdutyConfig{
		NotifierConfig: amcommoncfg.NotifierConfig{
			VSendResolved: true,
		},
		Description: `{{ template "pagerduty.default.description" .}}`,
		Client:      `{{ template "pagerduty.default.client" . }}`,
		ClientURL:   `{{ template "pagerduty.default.clientURL" . }}`,
	}
)

Functions

This section is empty.

Types

type Notifier

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

Notifier implements a Notifier for PagerDuty notifications.

func New

New returns a new PagerDuty notifier.

func (*Notifier) Notify

func (n *Notifier) Notify(ctx context.Context, as ...*types.Alert) (bool, error)

Notify implements the Notifier interface.

type PagerdutyConfig added in v0.34.0

type PagerdutyConfig struct {
	amcommoncfg.NotifierConfig `yaml:",inline" json:",inline"`

	HTTPConfig *commoncfg.HTTPClientConfig `yaml:"http_config,omitempty" json:"http_config,omitempty"`

	ServiceKey     commoncfg.Secret `yaml:"service_key,omitempty" json:"service_key,omitempty"`
	ServiceKeyFile string           `yaml:"service_key_file,omitempty" json:"service_key_file,omitempty"`
	RoutingKey     commoncfg.Secret `yaml:"routing_key,omitempty" json:"routing_key,omitempty"`
	RoutingKeyFile string           `yaml:"routing_key_file,omitempty" json:"routing_key_file,omitempty"`
	URL            *amcommoncfg.URL `yaml:"url,omitempty" json:"url,omitempty"`
	Client         string           `yaml:"client,omitempty" json:"client,omitempty"`
	ClientURL      string           `yaml:"client_url,omitempty" json:"client_url,omitempty"`
	Description    string           `yaml:"description,omitempty" json:"description,omitempty"`
	Details        map[string]any   `yaml:"details,omitempty" json:"details,omitempty"`
	Images         []PagerdutyImage `yaml:"images,omitempty" json:"images,omitempty"`
	Links          []PagerdutyLink  `yaml:"links,omitempty" json:"links,omitempty"`
	Source         string           `yaml:"source,omitempty" json:"source,omitempty"`
	Severity       string           `yaml:"severity,omitempty" json:"severity,omitempty"`
	Class          string           `yaml:"class,omitempty" json:"class,omitempty"`
	Component      string           `yaml:"component,omitempty" json:"component,omitempty"`
	Group          string           `yaml:"group,omitempty" json:"group,omitempty"`
	// Timeout is the maximum time allowed to invoke the pagerduty. Setting this to 0
	// does not impose a timeout.
	Timeout time.Duration `yaml:"timeout" json:"timeout"`
}

PagerdutyConfig configures notifications via PagerDuty.

func (*PagerdutyConfig) UnmarshalYAML added in v0.34.0

func (c *PagerdutyConfig) UnmarshalYAML(unmarshal func(any) error) error

UnmarshalYAML implements the yaml.Unmarshaler interface.

type PagerdutyImage added in v0.34.0

type PagerdutyImage struct {
	Src  string `yaml:"src,omitempty" json:"src,omitempty"`
	Alt  string `yaml:"alt,omitempty" json:"alt,omitempty"`
	Href string `yaml:"href,omitempty" json:"href,omitempty"`
}

PagerdutyImage is an image.

type PagerdutyLink struct {
	Href string `yaml:"href,omitempty" json:"href,omitempty"`
	Text string `yaml:"text,omitempty" json:"text,omitempty"`
}

PagerdutyLink is a link.

Jump to

Keyboard shortcuts

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