monitor

package
v1.4.1 Latest Latest
Warning

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

Go to latest
Published: May 8, 2023 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

View Source
const (
	// alert types enum
	AlertV2AlertType_AdvancedManual   = "ADVANCED_MANUAL"
	AlertV2AlertType_AnomalyDetection = "ANOMALY_DETECTION"
	AlertV2AlertType_Dowtime          = "DOWNTIME"
	AlertV2AlertType_Event            = "EVENT"
	AlertV2AlertType_GroupOutlier     = "GROUP_OUTLIER"
	AlertV2AlertType_Manual           = "MANUAL"
	AlertV2AlertType_Prometheus       = "PROMETHEUS"

	// severities enum
	AlertV2Severity_High   = "high"
	AlertV2Severity_Medium = "medium"
	AlertV2Severity_Low    = "low"
	AlertV2Severity_Info   = "info"

	// alert link type
	AlertLinkV2Type_Dashboard = "dashboard"
	AlertLinkV2Type_Runbook   = "runbook"

	// others
	AlertV2CaptureFilenameRegexp = `.*?\.scap`
)

--- Constants --

Variables

This section is empty.

Functions

func AlertLinkV2Type_Values added in v0.5.41

func AlertLinkV2Type_Values() []string

enums link types values

func AlertV2Severity_Values added in v0.5.41

func AlertV2Severity_Values() []string

enums severity values

func CloudAccountToJSON added in v0.5.47

func CloudAccountToJSON(providerInfo *CloudAccount) io.Reader

Types

type AlertLabelDescriptorV2 added in v0.5.41

type AlertLabelDescriptorV2 struct {
	ID       string `json:"id"`
	PublicID string `json:"publicId,omitempty"` //if passed empty in SegmentBy in put/posts will trigger an error 500
}

type AlertLinkV2 added in v0.5.41

type AlertLinkV2 struct {
	Type string `json:"type,omitempty"`
	ID   string `json:"id,omitempty"`
	Href string `json:"href,omitempty"`
}

type AlertMetricDescriptorV2 added in v0.5.41

type AlertMetricDescriptorV2 struct {
	ID string `json:"id"`
}

type AlertScopeV2 added in v0.5.41

type AlertScopeV2 struct {
	Expressions []ScopeExpressionV2 `json:"expressions,omitempty"`
}

AlertScopeV2

type AlertV2Common added in v0.5.41

type AlertV2Common struct {
	ID                            int                           `json:"id,omitempty"`
	Version                       int                           `json:"version,omitempty"`
	Name                          string                        `json:"name"`
	Description                   string                        `json:"description,omitempty"`
	DurationSec                   int                           `json:"durationSec"`
	Type                          string                        `json:"type"`
	Group                         string                        `json:"group,omitempty"`
	Severity                      string                        `json:"severity"`
	TeamID                        int                           `json:"teamId,omitempty"`
	Enabled                       bool                          `json:"enabled"`
	NotificationChannelConfigList []NotificationChannelConfigV2 `json:"notificationChannelConfigList"`
	CustomNotificationTemplate    *CustomNotificationTemplateV2 `json:"customNotificationTemplate,omitempty"`
	CaptureConfig                 *CaptureConfigV2              `json:"captureConfig,omitempty"`
	Links                         []AlertLinkV2                 `json:"links"`
}

AlertV2

type AlertV2ConfigDowntime added in v0.5.44

type AlertV2ConfigDowntime struct {
	ScopedSegmentedConfig

	ConditionOperator string  `json:"conditionOperator"`
	Threshold         float64 `json:"threshold"`

	GroupAggregation string                  `json:"groupAggregation"`
	TimeAggregation  string                  `json:"timeAggregation"`
	Metric           AlertMetricDescriptorV2 `json:"metric"`
	NoDataBehaviour  string                  `json:"noDataBehaviour"`
}

Downtime

type AlertV2ConfigEvent added in v0.5.44

type AlertV2ConfigEvent struct {
	ScopedSegmentedConfig

	ConditionOperator        string   `json:"conditionOperator"`
	Threshold                float64  `json:"threshold"`
	WarningConditionOperator string   `json:"warningConditionOperator,omitempty"`
	WarningThreshold         *float64 `json:"warningThreshold,omitempty"`

	Filter string   `json:"filter"`
	Tags   []string `json:"tags"`
}

Event

type AlertV2ConfigMetric added in v0.5.44

type AlertV2ConfigMetric struct {
	ScopedSegmentedConfig

	ConditionOperator        string   `json:"conditionOperator"`
	Threshold                float64  `json:"threshold"`
	WarningConditionOperator string   `json:"warningConditionOperator,omitempty"`
	WarningThreshold         *float64 `json:"warningThreshold,omitempty"`

	GroupAggregation string                  `json:"groupAggregation"`
	TimeAggregation  string                  `json:"timeAggregation"`
	Metric           AlertMetricDescriptorV2 `json:"metric"`
	NoDataBehaviour  string                  `json:"noDataBehaviour"`
}

Metric

type AlertV2ConfigPrometheus added in v0.5.41

type AlertV2ConfigPrometheus struct {
	Query string `json:"query"`
}

Prometheus

type AlertV2Downtime added in v0.5.44

type AlertV2Downtime struct {
	AlertV2Common
	Config AlertV2ConfigDowntime `json:"config"`
}

func AlertV2DowntimeFromJSON added in v0.5.44

func AlertV2DowntimeFromJSON(body []byte) AlertV2Downtime

func (*AlertV2Downtime) ToJSON added in v0.5.44

func (a *AlertV2Downtime) ToJSON() io.Reader

type AlertV2Event added in v0.5.44

type AlertV2Event struct {
	AlertV2Common
	Config AlertV2ConfigEvent `json:"config"`
}

func AlertV2EventFromJSON added in v0.5.44

func AlertV2EventFromJSON(body []byte) AlertV2Event

func (*AlertV2Event) ToJSON added in v0.5.44

func (a *AlertV2Event) ToJSON() io.Reader

type AlertV2Metric added in v0.5.44

type AlertV2Metric struct {
	AlertV2Common
	Config AlertV2ConfigMetric `json:"config"`
}

func AlertV2MetricFromJSON added in v0.5.44

func AlertV2MetricFromJSON(body []byte) AlertV2Metric

func (*AlertV2Metric) ToJSON added in v0.5.44

func (a *AlertV2Metric) ToJSON() io.Reader

type AlertV2Prometheus added in v0.5.41

type AlertV2Prometheus struct {
	AlertV2Common
	Config AlertV2ConfigPrometheus `json:"config"`
}

func AlertV2PrometheusFromJSON added in v0.5.41

func AlertV2PrometheusFromJSON(body []byte) AlertV2Prometheus

func (*AlertV2Prometheus) ToJSON added in v0.5.41

func (a *AlertV2Prometheus) ToJSON() io.Reader

type CaptureConfigV2 added in v0.5.41

type CaptureConfigV2 struct {
	DurationSec int    `json:"durationSec"`
	Storage     string `json:"storage"`
	Filter      string `json:"filter"`
	FileName    string `json:"fileName"`
	Enabled     bool   `json:"enabled"`
}

type CloudAccount added in v0.5.47

type CloudAccount struct {
	Id                int                     `json:"id"`
	Platform          string                  `json:"platform"`
	IntegrationType   string                  `json:"integrationType"`
	Credentials       CloudAccountCredentials `json:"credentials"`
	AdditionalOptions string                  `json:"additionalOptions"`
}

func CloudAccountFromJSON added in v0.5.47

func CloudAccountFromJSON(body []byte) *CloudAccount

type CloudAccountCredentials added in v0.5.47

type CloudAccountCredentials struct {
	AccountId string `json:"accountId"`
}

type CustomNotificationTemplateV2 added in v0.5.41

type CustomNotificationTemplateV2 struct {
	Subject     string `json:"subject"`
	PrependText string `json:"prependText"`
	AppendText  string `json:"appendText"`
}

type LabelDescriptorV3 added in v0.5.44

type LabelDescriptorV3 struct {
	ID       string `json:"id"`
	PublicID string `json:"publicId"`
}

type NotificationChannel

type NotificationChannel struct {
	ID      int                        `json:"id,omitempty"`
	Version int                        `json:"version,omitempty"`
	Type    string                     `json:"type"`
	Name    string                     `json:"name"`
	Enabled bool                       `json:"enabled"`
	Options NotificationChannelOptions `json:"options"`
}

func NotificationChannelFromJSON

func NotificationChannelFromJSON(body []byte) NotificationChannel

type NotificationChannelConfigV2 added in v0.5.41

type NotificationChannelConfigV2 struct {
	// Type can be one of EMAIL, SNS, SLACK, PAGER_DUTY, VICTOROPS, OPSGENIE, WEBHOOK, IBM_FUNCTION, MS_TEAMS, TEAM_EMAIL, IBM_EVENT_NOTIFICATIONS, PROMETHEUS_ALERT_MANAGER
	ChannelID       int                          `json:"channelId,omitempty"`
	Type            string                       `json:"type,omitempty"`
	Name            string                       `json:"nam,omitempty"`
	Enabled         bool                         `json:"enabled,omitempty"`
	OverrideOptions NotificationChannelOptionsV2 `json:"overrideOptions"`
}

type NotificationChannelOptions

type NotificationChannelOptions struct {
	EmailRecipients   []string               `json:"emailRecipients,omitempty"`   // Type: email
	SnsTopicARNs      []string               `json:"snsTopicARNs,omitempty"`      // Type: SNS
	APIKey            string                 `json:"apiKey,omitempty"`            // Type: VictorOps
	RoutingKey        string                 `json:"routingKey,omitempty"`        // Type: VictorOps
	Url               string                 `json:"url,omitempty"`               // Type: OpsGenie, Webhook and Slack
	Channel           string                 `json:"channel,omitempty"`           // Type: Slack
	Account           string                 `json:"account,omitempty"`           // Type: PagerDuty
	ServiceKey        string                 `json:"serviceKey,omitempty"`        // Type: PagerDuty
	ServiceName       string                 `json:"serviceName,omitempty"`       // Type: PagerDuty
	AdditionalHeaders map[string]interface{} `json:"additionalHeaders,omitempty"` // Type: Webhook
	Region            string                 `json:"region,omitempty"`            // Type: OpsGenie

	NotifyOnOk           bool `json:"notifyOnOk"`
	NotifyOnResolve      bool `json:"notifyOnResolve"`
	SendTestNotification bool `json:"sendTestNotification"`
}

type NotificationChannelOptionsV2 added in v0.5.41

type NotificationChannelOptionsV2 struct {
	// commons
	NotifyOnAcknowledge        bool                          `json:"notifyOnAcknowledge,omitempty"`
	NotifyOnResolve            bool                          `json:"notifyOnResolve"`
	ReNotifyEverySec           *int                          `json:"reNotifyEverySec"` // must send null to remove this opt
	CustomNotificationTemplate *CustomNotificationTemplateV2 `json:"customNotificationTemplate,omitempty"`
	Thresholds                 []string                      `json:"thresholds"` //Set of thresholds the notification channel will be used for. Possible values [MAIN, WARNING]
}

type ScopeExpressionV2 added in v0.5.41

type ScopeExpressionV2 struct {
	Operand    string                  `json:"operand"` // old dot notation, e.g. "kubernetes.cluster.name"
	Descriptor *AlertLabelDescriptorV2 `json:"descriptor,omitempty"`
	Operator   string                  `json:"operator"`
	Value      []string                `json:"value"`
}

type ScopedSegmentedConfig added in v0.5.44

type ScopedSegmentedConfig struct {
	Scope     *AlertScopeV2            `json:"scope,omitempty"`
	SegmentBy []AlertLabelDescriptorV2 `json:"segmentBy"`
}

type SysdigMonitorClient

type SysdigMonitorClient interface {
	CreateAlertV2Prometheus(context.Context, AlertV2Prometheus) (AlertV2Prometheus, error)
	DeleteAlertV2Prometheus(context.Context, int) error
	UpdateAlertV2Prometheus(context.Context, AlertV2Prometheus) (AlertV2Prometheus, error)
	GetAlertV2PrometheusById(context.Context, int) (AlertV2Prometheus, error)

	CreateAlertV2Event(context.Context, AlertV2Event) (AlertV2Event, error)
	DeleteAlertV2Event(context.Context, int) error
	UpdateAlertV2Event(context.Context, AlertV2Event) (AlertV2Event, error)
	GetAlertV2EventById(context.Context, int) (AlertV2Event, error)

	CreateAlertV2Metric(context.Context, AlertV2Metric) (AlertV2Metric, error)
	DeleteAlertV2Metric(context.Context, int) error
	UpdateAlertV2Metric(context.Context, AlertV2Metric) (AlertV2Metric, error)
	GetAlertV2MetricById(context.Context, int) (AlertV2Metric, error)

	CreateAlertV2Downtime(context.Context, AlertV2Downtime) (AlertV2Downtime, error)
	DeleteAlertV2Downtime(context.Context, int) error
	UpdateAlertV2Downtime(context.Context, AlertV2Downtime) (AlertV2Downtime, error)
	GetAlertV2DowntimeById(context.Context, int) (AlertV2Downtime, error)

	GetLabelDescriptor(ctx context.Context, label string) (LabelDescriptorV3, error)

	GetNotificationChannelById(context.Context, int) (NotificationChannel, error)

	GetDashboardByID(context.Context, int) (*model.Dashboard, error)
	CreateDashboard(context.Context, *model.Dashboard) (*model.Dashboard, error)
	UpdateDashboard(context.Context, *model.Dashboard) (*model.Dashboard, error)
	DeleteDashboard(context.Context, int) error

	GetCloudAccountById(context.Context, int) (*CloudAccount, error)
	CreateCloudAccount(context.Context, *CloudAccount) (*CloudAccount, error)
	UpdateCloudAccount(context.Context, int, *CloudAccount) (*CloudAccount, error)
	DeleteCloudAccountById(context.Context, int) error
}

func NewSysdigMonitorClient

func NewSysdigMonitorClient(apiToken string, url string, insecure bool) SysdigMonitorClient

func WithExtraHeaders

func WithExtraHeaders(client SysdigMonitorClient, extraHeaders map[string]string) SysdigMonitorClient

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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