guanceyun

package
v1.9.9 Latest Latest
Warning

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

Go to latest
Published: Oct 24, 2023 License: Apache-2.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

View Source
const MonitorPageSize = 100

Variables

This section is empty.

Functions

This section is empty.

Types

type AlertInfo

type AlertInfo struct {
	MatchedSilentRule interface{} `json:"matchedSilentRule"`
	Targets           []Targets   `json:"targets"`
}

type CheckTargets

type CheckTargets struct {
	Alias     string `json:"alias"`
	Dql       string `json:"dql"`
	QueryType string `json:"queryType"`
	Range     int    `json:"range"`
}

type CheckerOpt

type CheckerOpt struct {
	ID                   string      `json:"id"`
	InfoEvent            bool        `json:"infoEvent"`
	Interval             int         `json:"interval"`
	Message              interface{} `json:"message"`
	Name                 string      `json:"name"`
	NoDataAction         string      `json:"noDataAction"`
	NoDataInterval       int         `json:"noDataInterval"`
	NoDataMessage        interface{} `json:"noDataMessage"`
	NoDataRecoverMessage interface{} `json:"noDataRecoverMessage"`
	NoDataRecoverTitle   interface{} `json:"noDataRecoverTitle"`
	NoDataScale          int         `json:"noDataScale"`
	NoDataTitle          interface{} `json:"noDataTitle"`
	RecoverInterval      int         `json:"recoverInterval"`
	RecoverMessage       interface{} `json:"recoverMessage"`
	RecoverScale         int         `json:"recoverScale"`
	RecoverTitle         string      `json:"recoverTitle"`
	Rules                []Rules     `json:"rules"`
	Title                string      `json:"title"`
}

type Client

type Client struct {
	*req.Client
	BaseURL string
}

func NewClient

func NewClient(url, apiKey string) *Client

func (*Client) ListAllMonitor

func (c *Client) ListAllMonitor(search string) (resp []MonitorContent, err error)

func (*Client) ListMonitor

func (c *Client) ListMonitor(search string, pageSize, pageIndex int) ([]MonitorContent, int, error)

func (*Client) SearchEventByChecker

func (c *Client) SearchEventByChecker(args []*SearchEventByMonitorArg, startTime, endTime int64) ([]*EventResp, error)

SearchEventByChecker startTime and endTime are Millisecond timestamps

type Conditions

type Conditions struct {
	Alias    string   `json:"alias"`
	Operands []string `json:"operands"`
	Operator string   `json:"operator"`
}

type CrontabInfo

type CrontabInfo struct {
	Crontab string `json:"crontab"`
	ID      string `json:"id"`
}

type Data

type Data struct {
	Docid                    string        `json:"__docid"`
	AlertTimeRanges          []interface{} `json:"alert_time_ranges"`
	Date                     int64         `json:"date"`
	DfBotObsDetail           interface{}   `json:"df_bot_obs_detail"`
	DfDimensionTags          string        `json:"df_dimension_tags"`
	DfEventID                string        `json:"df_event_id"`
	DfMessage                string        `json:"df_message"`
	DfMeta                   string        `json:"df_meta"`
	DfMonitorChecker         string        `json:"df_monitor_checker"`
	DfMonitorCheckerEventRef string        `json:"df_monitor_checker_event_ref"`
	DfMonitorCheckerName     string        `json:"df_monitor_checker_name"`
	DfMonitorType            string        `json:"df_monitor_type"`
	DfSource                 string        `json:"df_source"`
	DfStatus                 string        `json:"df_status"`
	DfTitle                  string        `json:"df_title"`
}

type DimensionTags

type DimensionTags struct {
}

type EventContent

type EventContent struct {
	Data       []Data `json:"data"`
	Limit      int    `json:"limit"`
	Offset     int    `json:"offset"`
	TotalCount int    `json:"total_count"`
}

type EventFilters

type EventFilters struct {
	Name      string   `json:"name"`
	Condition string   `json:"condition"`
	Operation string   `json:"operation"`
	Value     []string `json:"value"`
}

type EventResp

type EventResp struct {
	CheckerName string
	CheckerID   string
	EventLevel  Level
}

type EventResponse

type EventResponse struct {
	Code      int           `json:"code"`
	Content   *EventContent `json:"content"`
	ErrorCode string        `json:"errorCode"`
	Message   string        `json:"message"`
	Success   bool          `json:"success"`
	TraceID   string        `json:"traceId"`
}

type Extend

type Extend struct {
	FuncName  string      `json:"funcName"`
	Querylist []Querylist `json:"querylist"`
	Rules     []Rules     `json:"rules"`
}

type ExtraData

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

type Filters

type Filters struct {
	ID    string `json:"id"`
	Logic string `json:"logic"`
	Name  string `json:"name"`
	Op    string `json:"op"`
	Type  string `json:"type"`
	Value string `json:"value"`
}

type JSONScript

type JSONScript struct {
	AtAccounts             []string      `json:"atAccounts"`
	AtNoDataAccounts       []interface{} `json:"atNoDataAccounts"`
	Channels               []interface{} `json:"channels"`
	CheckerOpt             CheckerOpt    `json:"checkerOpt"`
	Every                  string        `json:"every"`
	GroupBy                []interface{} `json:"groupBy"`
	Interval               int           `json:"interval"`
	Message                string        `json:"message"`
	Name                   string        `json:"name"`
	NoDataMessage          string        `json:"noDataMessage"`
	NoDataTitle            string        `json:"noDataTitle"`
	RecoverNeedPeriodCount int           `json:"recoverNeedPeriodCount"`
	Title                  string        `json:"title"`
	Type                   string        `json:"type"`
}

type Level

type Level string
var (
	Critical Level = "critical"
	Error    Level = "error"
	Warning  Level = "warning"

	LevelMap = map[Level]int{
		Critical: 4,
		Error:    3,
		Warning:  2,
	}
)

type MonitorContent

type MonitorContent struct {
	CreateAt      int         `json:"createAt"`
	CreatedWay    string      `json:"createdWay"`
	Creator       string      `json:"creator"`
	CrontabInfo   CrontabInfo `json:"crontabInfo"`
	DeleteAt      int         `json:"deleteAt"`
	Extend        Extend      `json:"extend"`
	ID            int         `json:"id"`
	IsSLI         bool        `json:"isSLI"`
	JSONScript    JSONScript  `json:"jsonScript"`
	MonitorName   string      `json:"monitorName"`
	MonitorUUID   string      `json:"monitorUUID"`
	RefKey        string      `json:"refKey"`
	Status        int         `json:"status"`
	Type          string      `json:"type"`
	UpdateAt      int         `json:"updateAt"`
	Updator       string      `json:"updator"`
	UpdatorInfo   UpdatorInfo `json:"updatorInfo"`
	UUID          string      `json:"uuid"`
	WorkspaceUUID string      `json:"workspaceUUID"`
}

type MonitorMeta

type MonitorMeta struct {
	AlertInfo     AlertInfo      `json:"alert_info"`
	CheckTargets  []CheckTargets `json:"check_targets"`
	CheckerOpt    CheckerOpt     `json:"checker_opt"`
	DimensionTags DimensionTags  `json:"dimension_tags"`
	ExtraData     ExtraData      `json:"extra_data"`
	MonitorOpt    MonitorOpt     `json:"monitor_opt"`
}

type MonitorOpt

type MonitorOpt struct {
	ID   string `json:"id"`
	Name string `json:"name"`
	Type string `json:"type"`
}

type MonitorResponse

type MonitorResponse struct {
	Code      int              `json:"code"`
	Content   []MonitorContent `json:"content"`
	ErrorCode string           `json:"errorCode"`
	Message   string           `json:"message"`
	PageInfo  PageInfo         `json:"pageInfo"`
	Success   bool             `json:"success"`
	TraceID   string           `json:"traceId"`
}

type PageInfo

type PageInfo struct {
	Count      int `json:"count"`
	PageIndex  int `json:"pageIndex"`
	PageSize   int `json:"pageSize"`
	TotalCount int `json:"totalCount"`
}

type Query

type Query struct {
	Alias       string        `json:"alias"`
	Code        string        `json:"code"`
	DataSource  string        `json:"dataSource"`
	Field       string        `json:"field"`
	FieldFunc   string        `json:"fieldFunc"`
	FieldType   string        `json:"fieldType"`
	Filters     []Filters     `json:"filters"`
	FuncList    []interface{} `json:"funcList"`
	GroupBy     []interface{} `json:"groupBy"`
	GroupByTime string        `json:"groupByTime"`
	Namespace   string        `json:"namespace"`
	Q           string        `json:"q"`
	Type        string        `json:"type"`
}

type Querylist

type Querylist struct {
	Datasource string `json:"datasource"`
	Qtype      string `json:"qtype"`
	Query      Query  `json:"query"`
	UUID       string `json:"uuid"`
}

type Rules

type Rules struct {
	ConditionLogic string       `json:"conditionLogic"`
	Conditions     []Conditions `json:"conditions"`
	Status         string       `json:"status"`
}

type SearchEventBody

type SearchEventBody struct {
	TimeRange []int64        `json:"timeRange"`
	Filters   []EventFilters `json:"filters"`
	Limit     int            `json:"limit"`
}

type SearchEventByMonitorArg

type SearchEventByMonitorArg struct {
	CheckerName string
	CheckerID   string
}

type Targets

type Targets struct {
	HasSecret    bool          `json:"hasSecret"`
	IgnoreReason string        `json:"ignoreReason"`
	IsIgnored    bool          `json:"isIgnored"`
	MinInterval  int           `json:"minInterval"`
	Status       []interface{} `json:"status"`
	SubStatus    []string      `json:"subStatus"`
	To           []string      `json:"to,omitempty"`
	Type         string        `json:"type"`
	BodyType     string        `json:"bodyType,omitempty"`
	Name         string        `json:"name,omitempty"`
	URL          string        `json:"url,omitempty"`
}

type UpdatorInfo

type UpdatorInfo struct {
	AcntWsNickname string `json:"acntWsNickname"`
	Email          string `json:"email"`
	Name           string `json:"name"`
	UserIconURL    string `json:"userIconUrl"`
}

Jump to

Keyboard shortcuts

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