monitor

package
v0.5.23 Latest Latest
Warning

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

Go to latest
Published: Oct 5, 2021 License: MPL-2.0 Imports: 16 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

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"`
	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 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 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 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 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)

	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