pagerduty

package
v0.13.4 Latest Latest
Warning

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

Go to latest
Published: Apr 23, 2024 License: Apache-2.0 Imports: 12 Imported by: 0

Documentation

Overview

Package pagerduty implements pagerduty notifications for Cloudprober alert events.

Index

Constants

View Source
const (
	Trigger     EventV2Action = "trigger"
	Acknowledge               = "acknowledge"
	Resolve                   = "resolve"
)
View Source
const (
	Critical EventV2Severity = "critical"
	Error                    = "error"
	Warning                  = "warning"
	Info                     = "info"
)
View Source
const (
	// PAGERDUTY_API_URL is the base URL for the PagerDuty API.
	PAGERDUTY_API_URL = "https://events.pagerduty.com"

	// DEFAULT_PAGERDUTY_ROUTING_KEY_ENV_VAR is the default environment variable
	// to use for the PagerDuty routing key.
	DEFAULT_PAGERDUTY_ROUTING_KEY_ENV_VAR = "PAGERDUTY_ROUTING_KEY"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

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

func New

func New(pagerdutycfg *configpb.PagerDuty, l *logger.Logger) (*Client, error)

func (*Client) Notify

func (c *Client) Notify(ctx context.Context, alertInfo *alertinfo.AlertInfo, alertFields map[string]string) error

func (*Client) NotifyResolve

func (c *Client) NotifyResolve(ctx context.Context, alertInfo *alertinfo.AlertInfo, alertFields map[string]string) error

type EventV2Action

type EventV2Action string

EventV2Action is the action to be performed on the event, documented as: The type of event. Can be trigger, acknowledge or resolve. https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTgx-send-an-alert-event#event-action-behavior

type EventV2Links struct {
	Href string `json:"href"`
	Text string `json:"text"`
}

EventV2Links is the data structure for the links field of a PagerDuty event.

type EventV2Payload

type EventV2Payload struct {
	Summary       string            `json:"summary"`  // required
	Source        string            `json:"source"`   // required
	Severity      EventV2Severity   `json:"severity"` // required
	Timestamp     string            `json:"timestamp,omitempty"`
	Component     string            `json:"component,omitempty"`
	CustomDetails map[string]string `json:"custom_details,omitempty"`
}

EventV2Payload is the data structure for the payload of a PagerDuty event. This struct encapsulates metadata about the alarm.

type EventV2Request

type EventV2Request struct {
	RoutingKey  string         `json:"routing_key"` // required
	DedupKey    string         `json:"dedup_key,omitempty"`
	EventAction EventV2Action  `json:"event_action"` // required
	Client      string         `json:"client,omitempty"`
	ClientURL   string         `json:"client_url,omitempty"`
	Links       []EventV2Links `json:"links,omitempty"`
	Payload     EventV2Payload `json:"payload"` // required
}

EventV2Request is the data structure for a Pagerduty event. The event can either be an alarm event, or a change event.

type EventV2Response

type EventV2Response struct {
	Status   string `json:"status,omitempty"`
	Message  string `json:"message,omitempty"`
	DedupKey string `json:"dedup_key,omitempty"`
}

EventV2Response is the data structure that is returned from PagerDuty when sending a EventV2 request.

type EventV2Severity

type EventV2Severity string

EventV2Severity is the severity of the event, documented as: The perceived severity of the status the event is describing with respect to the affected system. This can be critical, error, warning or info. https://developer.pagerduty.com/docs/ZG9jOjExMDI5NTgx-send-an-alert-event#parameters

Jump to

Keyboard shortcuts

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