prometheus

package
v0.9.0 Latest Latest
Warning

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

Go to latest
Published: Feb 22, 2026 License: Apache-2.0 Imports: 17 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AuthTypeNone   = "none"
	AuthTypeBasic  = "basic"
	AuthTypeBearer = "bearer"

	AlertStateAny      = "any"
	AlertStateFiring   = "firing"
	AlertStateResolved = "resolved"
	AlertStatePending  = "pending"
	AlertStateInactive = "inactive"

	PrometheusAlertPayloadType = "prometheus.alert"
)
View Source
const MaxResponseSize = 1 * 1024 * 1024 // 1MB

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertmanagerAlert

type AlertmanagerAlert struct {
	Status       string            `json:"status"`
	Labels       map[string]string `json:"labels"`
	Annotations  map[string]string `json:"annotations"`
	StartsAt     string            `json:"startsAt"`
	EndsAt       string            `json:"endsAt"`
	GeneratorURL string            `json:"generatorURL"`
	Fingerprint  string            `json:"fingerprint"`
}

type AlertmanagerWebhookPayload

type AlertmanagerWebhookPayload struct {
	Version           string              `json:"version"`
	GroupKey          string              `json:"groupKey"`
	Status            string              `json:"status"`
	Receiver          string              `json:"receiver"`
	GroupLabels       map[string]string   `json:"groupLabels"`
	CommonLabels      map[string]string   `json:"commonLabels"`
	CommonAnnotations map[string]string   `json:"commonAnnotations"`
	ExternalURL       string              `json:"externalURL"`
	TruncatedAlerts   int                 `json:"truncatedAlerts"`
	Alerts            []AlertmanagerAlert `json:"alerts"`
}

type Client

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

func NewClient

func NewClient(httpContext core.HTTPContext, integration core.IntegrationContext) (*Client, error)

func (*Client) GetAlertsFromPrometheus

func (c *Client) GetAlertsFromPrometheus() ([]PrometheusAlert, error)

func (*Client) Query

func (c *Client) Query(query string) (map[string]any, error)

type Configuration

type Configuration struct {
	BaseURL            string `json:"baseURL" mapstructure:"baseURL"`
	AuthType           string `json:"authType" mapstructure:"authType"`
	Username           string `json:"username,omitempty" mapstructure:"username"`
	Password           string `json:"password,omitempty" mapstructure:"password"`
	BearerToken        string `json:"bearerToken,omitempty" mapstructure:"bearerToken"`
	WebhookBearerToken string `json:"webhookBearerToken,omitempty" mapstructure:"webhookBearerToken"`
}

type GetAlert

type GetAlert struct{}

func (*GetAlert) Actions

func (c *GetAlert) Actions() []core.Action

func (*GetAlert) Cancel

func (c *GetAlert) Cancel(ctx core.ExecutionContext) error

func (*GetAlert) Cleanup

func (c *GetAlert) Cleanup(ctx core.SetupContext) error

func (*GetAlert) Color

func (c *GetAlert) Color() string

func (*GetAlert) Configuration

func (c *GetAlert) Configuration() []configuration.Field

func (*GetAlert) Description

func (c *GetAlert) Description() string

func (*GetAlert) Documentation

func (c *GetAlert) Documentation() string

func (*GetAlert) ExampleOutput

func (c *GetAlert) ExampleOutput() map[string]any

func (*GetAlert) Execute

func (c *GetAlert) Execute(ctx core.ExecutionContext) error

func (*GetAlert) HandleAction

func (c *GetAlert) HandleAction(ctx core.ActionContext) error

func (*GetAlert) HandleWebhook

func (c *GetAlert) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*GetAlert) Icon

func (c *GetAlert) Icon() string

func (*GetAlert) Label

func (c *GetAlert) Label() string

func (*GetAlert) Name

func (c *GetAlert) Name() string

func (*GetAlert) OutputChannels

func (c *GetAlert) OutputChannels(configuration any) []core.OutputChannel

func (*GetAlert) ProcessQueueItem

func (c *GetAlert) ProcessQueueItem(ctx core.ProcessQueueContext) (*uuid.UUID, error)

func (*GetAlert) Setup

func (c *GetAlert) Setup(ctx core.SetupContext) error

type GetAlertConfiguration

type GetAlertConfiguration struct {
	AlertName string `json:"alertName" mapstructure:"alertName"`
	State     string `json:"state" mapstructure:"state"`
}

type Metadata

type Metadata struct{}

type OnAlert

type OnAlert struct{}

func (*OnAlert) Actions

func (t *OnAlert) Actions() []core.Action

func (*OnAlert) Cleanup

func (t *OnAlert) Cleanup(ctx core.TriggerContext) error

func (*OnAlert) Color

func (t *OnAlert) Color() string

func (*OnAlert) Configuration

func (t *OnAlert) Configuration() []configuration.Field

func (*OnAlert) Description

func (t *OnAlert) Description() string

func (*OnAlert) Documentation

func (t *OnAlert) Documentation() string

func (*OnAlert) ExampleData

func (t *OnAlert) ExampleData() map[string]any

func (*OnAlert) HandleAction

func (t *OnAlert) HandleAction(ctx core.TriggerActionContext) (map[string]any, error)

func (*OnAlert) HandleWebhook

func (t *OnAlert) HandleWebhook(ctx core.WebhookRequestContext) (int, error)

func (*OnAlert) Icon

func (t *OnAlert) Icon() string

func (*OnAlert) Label

func (t *OnAlert) Label() string

func (*OnAlert) Name

func (t *OnAlert) Name() string

func (*OnAlert) Setup

func (t *OnAlert) Setup(ctx core.TriggerContext) error

type OnAlertConfiguration

type OnAlertConfiguration struct {
	Statuses   []string `json:"statuses" mapstructure:"statuses"`
	AlertNames []string `json:"alertNames" mapstructure:"alertNames"`
}

type OnAlertMetadata

type OnAlertMetadata struct {
	WebhookURL         string `json:"webhookUrl" mapstructure:"webhookUrl"`
	WebhookAuthEnabled bool   `json:"webhookAuthEnabled,omitempty" mapstructure:"webhookAuthEnabled"`
}

type Prometheus

type Prometheus struct{}

func (*Prometheus) Actions

func (p *Prometheus) Actions() []core.Action

func (*Prometheus) Cleanup

func (*Prometheus) Components

func (p *Prometheus) Components() []core.Component

func (*Prometheus) Configuration

func (p *Prometheus) Configuration() []configuration.Field

func (*Prometheus) Description

func (p *Prometheus) Description() string

func (*Prometheus) HandleAction

func (p *Prometheus) HandleAction(ctx core.IntegrationActionContext) error

func (*Prometheus) HandleRequest

func (p *Prometheus) HandleRequest(ctx core.HTTPRequestContext)

func (*Prometheus) Icon

func (p *Prometheus) Icon() string

func (*Prometheus) Instructions

func (p *Prometheus) Instructions() string

func (*Prometheus) Label

func (p *Prometheus) Label() string

func (*Prometheus) ListResources

func (p *Prometheus) ListResources(resourceType string, ctx core.ListResourcesContext) ([]core.IntegrationResource, error)

func (*Prometheus) Name

func (p *Prometheus) Name() string

func (*Prometheus) Sync

func (p *Prometheus) Sync(ctx core.SyncContext) error

func (*Prometheus) Triggers

func (p *Prometheus) Triggers() []core.Trigger

type PrometheusAlert

type PrometheusAlert struct {
	Labels      map[string]string `json:"labels"`
	Annotations map[string]string `json:"annotations"`
	State       string            `json:"state"`
	ActiveAt    string            `json:"activeAt,omitempty"`
	Value       string            `json:"value,omitempty"`
}

type PrometheusAlertsData

type PrometheusAlertsData struct {
	Alerts []PrometheusAlert `json:"alerts"`
}

type PrometheusWebhookHandler

type PrometheusWebhookHandler struct{}

func (*PrometheusWebhookHandler) Cleanup

func (*PrometheusWebhookHandler) CompareConfig

func (h *PrometheusWebhookHandler) CompareConfig(a any, b any) (bool, error)

func (*PrometheusWebhookHandler) Merge

func (h *PrometheusWebhookHandler) Merge(current, requested any) (any, bool, error)

func (*PrometheusWebhookHandler) Setup

Jump to

Keyboard shortcuts

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