monitor

package
v0.5.43 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2022 License: MPL-2.0 Imports: 15 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

Types

type Aggregation added in v0.5.41

type Aggregation struct {
	ID               int         `json:"id"`
	Percentile       bool        `json:"percentile"`
	AggregationValue interface{} `json:"aggregationValue"`
}

type Alert

type Alert struct {
	ID                     int                 `json:"id,omitempty"`
	Version                int                 `json:"version,omitempty"`
	Type                   string              `json:"type"` // computed MANUAL
	Name                   string              `json:"name"`
	Description            string              `json:"description"`
	Enabled                bool                `json:"enabled"`
	GroupName              string              `json:"groupName,omitempty"`
	NotificationChannelIds []int               `json:"notificationChannelIds"`
	Filter                 string              `json:"filter"`
	Severity               int                 `json:"severity"` // 6 == INFO, 4 == LOW, 2 == MEDIUM, 0 == HIGH // NOT USED
	Timespan               int                 `json:"timespan"` // computed 600000000
	CustomNotification     *CustomNotification `json:"customNotification"`
	TeamID                 int                 `json:"teamId,omitempty"` // computed
	AutoCreated            bool                `json:"autoCreated"`
	SysdigCapture          *SysdigCapture      `json:"sysdigCapture"`
	RateOfChange           bool                `json:"rateOfChange,omitempty"`
	ReNotifyMinutes        int                 `json:"reNotifyMinutes"`
	ReNotify               bool                `json:"reNotify"`
	Valid                  bool                `json:"valid"`
	SeverityLabel          string              `json:"severityLabel,omitempty"` // MEDIUM == MEDIUM, LOW == LOW, NONE == INFO, HIGH == HIGH
	SegmentBy              []string            `json:"segmentBy"`
	SegmentCondition       *SegmentCondition   `json:"segmentCondition"`
	Criteria               *Criteria           `json:"criteria,omitempty"`
	Monitor                []*Monitor          `json:"monitor,omitempty"`
	Condition              string              `json:"condition"`
	SeverityLevel          int                 `json:"severityLevel,omitempty"` // 0 == MEDIUM, 2 == LOW, 4 == INFO, 6 == HIGH
}

func AlertFromJSON

func AlertFromJSON(body []byte) Alert

func (*Alert) ToJSON

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

type AlertLabelDescriptorV2 added in v0.5.41

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

type AlertLinkV2 added in v0.5.41

type AlertLinkV2 struct {
	Name string `json:"name"`
	Type string `json:"type"`
	ID   string `json:"id"`
	Href string `json:"href"`
}

type AlertMetricDescriptorV2 added in v0.5.41

type AlertMetricDescriptorV2 struct {
	ID                string        `json:"id"`
	PublicID          string        `json:"publicId"`
	MetricType        string        `json:"metricType"`
	Type              string        `json:"type"`
	Scale             float64       `json:"scale"`
	GroupAggregations []Aggregation `json:"groupAggregations"`
	TimeAggregations  []Aggregation `json:"timeAggregations"`
}

type AlertScopeV2 added in v0.5.41

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

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,omitempty"`
	CustomNotificationTemplate    *CustomNotificationTemplateV2  `json:"customNotificationTemplate,omitempty"`
	CaptureConfig                 *CaptureConfigV2               `json:"captureConfig,omitempty"`
	Links                         *[]AlertLinkV2                 `json:"links,omitempty"`
}

AlertV2

type AlertV2ConfigPrometheus added in v0.5.41

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

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,omitempty"`
	FileName    string `json:"fileName"`
	Enabled     bool   `json:"enabled"`
}

type Criteria

type Criteria struct {
	Text   string `json:"text"`
	Source string `json:"source"`
}

type CustomNotification

type CustomNotification struct {
	TitleTemplate  string `json:"titleTemplate"`
	UseNewTemplate bool   `json:"useNewTemplate"`
	PrependText    string `json:"prependText,omitempty"`
	AppendText     string `json:"appendText,omitempty"`
}

-------- Alert --------

type CustomNotificationTemplateV2 added in v0.5.41

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

type EntryPoint

type EntryPoint struct {
	Module    string `json:"module"`
	Selection string `json:"selection,omitempty"`
}

type Monitor

type Monitor struct {
	Metric       string  `json:"metric"`
	StdDevFactor float64 `json:"stdDevFactor"`
}

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

func NotificationChannelListFromJSON

func NotificationChannelListFromJSON(body []byte) []NotificationChannel

func (*NotificationChannel) ToJSON

func (n *NotificationChannel) ToJSON() io.Reader

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"`
	Options   *NotificationChannelOptionsV2 `json:"options,omitempty"`
}

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

	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,omitempty"`
	ReNotifyEverySec           int                           `json:"reNotifyEverySec,omitempty"`
	CustomNotificationTemplate *CustomNotificationTemplateV2 `json:"customNotificationTemplate,omitempty"`
	Thresholds                 []string                      `json:"thresholds,omitempty"`
}

type NotificationGroupingConditionV2 added in v0.5.41

type NotificationGroupingConditionV2 struct {
	Type  string  `json:"type"`
	Value float64 `json:"value"`
}

type ScopeExpressionOperator added in v0.5.41

type ScopeExpressionOperator struct {
}

type ScopeExpressionV2 added in v0.5.41

type ScopeExpressionV2 struct {
	Operand    string                  `json:"operand"`
	Descriptor AlertLabelDescriptorV2  `json:"descriptor"`
	Operator   ScopeExpressionOperator `json:"operator"`
	Value      []string                `json:"value"`
}

type SegmentCondition

type SegmentCondition struct {
	Type string `json:"type"`
}

type SysdigCapture

type SysdigCapture struct {
	Name       string      `json:"name"`
	Filters    string      `json:"filters,omitempty"`
	Duration   int         `json:"duration"`
	Type       string      `json:"type,omitempty"`
	BucketName string      `json:"bucketName"`
	Folder     string      `json:"folder,omitempty"`
	Enabled    bool        `json:"enabled"`
	StorageID  interface{} `json:"storageId,omitempty"`
}

type SysdigMonitorClient

type SysdigMonitorClient interface {
	CreateAlert(context.Context, Alert) (Alert, error)
	DeleteAlert(context.Context, int) error
	UpdateAlert(context.Context, Alert) (Alert, error)
	GetAlertById(context.Context, int) (Alert, error)

	CreateAlertV2Prometheus(context.Context, AlertV2Prometheus) (AlertV2Prometheus, error)
	DeleteAlertV2Prometheus(context.Context, int) error
	UpdateAlertV2Prometheus(context.Context, AlertV2Prometheus) (AlertV2Prometheus, error)
	GetAlertV2PrometheusById(context.Context, int) (AlertV2Prometheus, error)

	CreateTeam(context.Context, Team) (Team, error)
	GetTeamById(context.Context, int) (Team, error)
	UpdateTeam(context.Context, Team) (Team, error)
	DeleteTeam(context.Context, int) error

	CreateNotificationChannel(context.Context, NotificationChannel) (NotificationChannel, error)
	GetNotificationChannelById(context.Context, int) (NotificationChannel, error)
	GetNotificationChannelByName(context.Context, string) (NotificationChannel, error)
	DeleteNotificationChannel(context.Context, int) error
	UpdateNotificationChannel(context.Context, NotificationChannel) (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
}

func NewSysdigMonitorClient

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

func WithExtraHeaders

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

type Team

type Team struct {
	UserRoles           []UserRoles `json:"userRoles"`
	Description         string      `json:"description"`
	Name                string      `json:"name"`
	ID                  int         `json:"id,omitempty"`
	Version             int         `json:"version,omitempty"`
	Origin              string      `json:"origin,omitempty"`
	LastUpdated         int64       `json:"lastUpdated,omitempty"`
	EntryPoint          EntryPoint  `json:"entryPoint"`
	Theme               string      `json:"theme"`
	CustomerID          int         `json:"customerId"`
	DateCreated         int64       `json:"dateCreated"`
	Products            []string    `json:"products,omitempty"`
	Show                string      `json:"show"`
	Immutable           bool        `json:"immutable"`
	CanUseSysdigCapture bool        `json:"canUseSysdigCapture"`
	CanUseCustomEvents  bool        `json:"canUseCustomEvents"`
	CanUseAwsMetrics    bool        `json:"canUseAwsMetrics"`
	CanUseBeaconMetrics bool        `json:"canUseBeaconMetrics"`
	UserCount           int         `json:"userCount"`
	Filter              string      `json:"filter,omitempty"`
	DefaultTeam         bool        `json:"default,omitempty"`
}

-------- Team --------

func TeamFromJSON

func TeamFromJSON(body []byte) Team

func (*Team) ToJSON

func (t *Team) ToJSON() io.Reader

type UserRoles

type UserRoles struct {
	UserId int    `json:"userId"`
	Email  string `json:"userName,omitempty"`
	Role   string `json:"role"`
	Admin  bool   `json:"admin,omitempty"`
}

type UsersList

type UsersList struct {
	ID    int    `json:"id"`
	Email string `json:"username"`
}

-------- UsersList --------

func UsersListFromJSON

func UsersListFromJSON(body []byte) []UsersList

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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