Documentation ¶
Index ¶
- type Alarm
- type Alert
- func (a *Alert) GetExternalURL() string
- func (a *Alert) GetFingerprint() string
- func (a *Alert) Index() string
- func (a *Alert) MarshalBinary() (data []byte, err error)
- func (a *Alert) Message() *watch.Message
- func (a *Alert) PushedFlag() string
- func (a *Alert) String() string
- func (a *Alert) UnmarshalBinary(data []byte) error
- type Datasource
- type GetMetricsParams
- type IStrategy
- type IStrategyEvent
- type LabelNotices
- type MQDatasource
- type MetricDetail
- type PushMetricParams
- type QueryQLParams
- type StrategyDomain
- func (s *StrategyDomain) BuilderAlarmBaseInfo() *Alarm
- func (s *StrategyDomain) Eval(ctx context.Context) (map[watch.Indexer]*datasource.Point, error)
- func (s *StrategyDomain) GetAnnotations() map[string]string
- func (s *StrategyDomain) GetInterval() *types.Duration
- func (s *StrategyDomain) GetLabelNotices() []*LabelNotices
- func (s *StrategyDomain) GetReceiverGroupIDs() []uint32
- func (s *StrategyDomain) GetStatus() vobj.Status
- func (s *StrategyDomain) GetTeamID() uint32
- func (s *StrategyDomain) Index() string
- func (s *StrategyDomain) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
- func (s *StrategyDomain) Message() *watch.Message
- func (s *StrategyDomain) String() string
- type StrategyEndpoint
- func (e *StrategyEndpoint) BuilderAlarmBaseInfo() *Alarm
- func (e *StrategyEndpoint) Eval(ctx context.Context) (map[watch.Indexer]*datasource.Point, error)
- func (e *StrategyEndpoint) GetAnnotations() map[string]string
- func (e *StrategyEndpoint) GetInterval() *types.Duration
- func (e *StrategyEndpoint) GetLabelNotices() []*LabelNotices
- func (e *StrategyEndpoint) GetReceiverGroupIDs() []uint32
- func (e *StrategyEndpoint) GetStatus() vobj.Status
- func (e *StrategyEndpoint) GetTeamID() uint32
- func (e *StrategyEndpoint) Index() string
- func (e *StrategyEndpoint) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
- func (e *StrategyEndpoint) Message() *watch.Message
- func (e *StrategyEndpoint) String() string
- type StrategyEvent
- func (s *StrategyEvent) BuilderAlarmBaseInfo() *Alarm
- func (s *StrategyEvent) Eval(_ context.Context) (map[watch.Indexer]*datasource.Point, error)
- func (s *StrategyEvent) GetAnnotations() map[string]string
- func (s *StrategyEvent) GetDatasource() []*MQDatasource
- func (s *StrategyEvent) GetInterval() *types.Duration
- func (s *StrategyEvent) GetLabelNotices() []*LabelNotices
- func (s *StrategyEvent) GetReceiverGroupIDs() []uint32
- func (s *StrategyEvent) GetStatus() vobj.Status
- func (s *StrategyEvent) GetTeamID() uint32
- func (s *StrategyEvent) GetTopic() string
- func (s *StrategyEvent) Index() string
- func (s *StrategyEvent) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
- func (s *StrategyEvent) Message() *watch.Message
- func (s *StrategyEvent) SetValue(msg *mq.Msg) IStrategyEvent
- func (s *StrategyEvent) String() string
- type StrategyMetric
- func (s *StrategyMetric) BuilderAlarmBaseInfo() *Alarm
- func (s *StrategyMetric) Eval(ctx context.Context) (map[watch.Indexer]*datasource.Point, error)
- func (s *StrategyMetric) GetAnnotations() map[string]string
- func (s *StrategyMetric) GetInterval() *types.Duration
- func (s *StrategyMetric) GetLabelNotices() []*LabelNotices
- func (s *StrategyMetric) GetReceiverGroupIDs() []uint32
- func (s *StrategyMetric) GetStatus() vobj.Status
- func (s *StrategyMetric) GetTeamID() uint32
- func (s *StrategyMetric) Index() string
- func (s *StrategyMetric) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
- func (s *StrategyMetric) Message() *watch.Message
- func (s *StrategyMetric) String() string
- type StrategyPing
- func (s *StrategyPing) BuilderAlarmBaseInfo() *Alarm
- func (s *StrategyPing) Eval(ctx context.Context) (map[watch.Indexer]*datasource.Point, error)
- func (s *StrategyPing) GetAnnotations() map[string]string
- func (s *StrategyPing) GetInterval() *types.Duration
- func (s *StrategyPing) GetLabelNotices() []*LabelNotices
- func (s *StrategyPing) GetReceiverGroupIDs() []uint32
- func (s *StrategyPing) GetStatus() vobj.Status
- func (s *StrategyPing) GetTeamID() uint32
- func (s *StrategyPing) Index() string
- func (s *StrategyPing) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
- func (s *StrategyPing) Message() *watch.Message
- func (s *StrategyPing) String() string
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Alarm ¶
type Alarm struct { Receiver string `json:"receiver"` Status vobj.AlertStatus `json:"status"` Alerts []*Alert `json:"alerts"` GroupLabels *vobj.Labels `json:"groupLabels"` CommonLabels *vobj.Labels `json:"commonLabels"` CommonAnnotations *vobj.Annotations `json:"commonAnnotations"` ExternalURL string `json:"externalURL"` Version string `json:"version"` GroupKey string `json:"groupKey"` TruncatedAlerts int32 `json:"truncatedAlerts"` }
Alarm alarm detail info
type Alert ¶
type Alert struct { Status vobj.AlertStatus `json:"status"` Labels *vobj.Labels `json:"labels"` Annotations vobj.Annotations `json:"annotations"` StartsAt *types.Time `json:"startsAt"` EndsAt *types.Time `json:"endsAt"` GeneratorURL string `json:"generatorURL"` Fingerprint string `json:"fingerprint"` Value float64 `json:"value"` }
Alert alert detail info
func NewAlertWithAlertStrInfo ¶
NewAlertWithAlertStrInfo 从告警字符串信息创建告警结构体
func (*Alert) MarshalBinary ¶ added in v1.1.0
MarshalBinary 将告警信息编码为二进制
func (*Alert) UnmarshalBinary ¶ added in v1.1.0
UnmarshalBinary 将告警信息解码为告警结构体
type Datasource ¶
type Datasource struct { // 数据源类型 Category vobj.DatasourceType `json:"category,omitempty"` // 存储器类型 StorageType vobj.StorageType `json:"storage_type,omitempty"` // 数据源配置 json Config map[string]string `json:"config,omitempty"` // 数据源地址 Endpoint string `json:"endpoint,omitempty"` // 数据源ID ID uint32 `json:"id,omitempty"` }
Datasource 数据源明细
type GetMetricsParams ¶
type GetMetricsParams struct { Endpoint string `json:"endpoint"` Config map[string]string `json:"config"` // 存储类型 StorageType vobj.StorageType `json:"storageType"` }
GetMetricsParams 查询指标请求参数
type IStrategy ¶ added in v1.1.0
type IStrategy interface { watch.Indexer Message() *watch.Message BuilderAlarmBaseInfo() *Alarm GetTeamID() uint32 GetStatus() vobj.Status GetReceiverGroupIDs() []uint32 GetLabelNotices() []*LabelNotices GetAnnotations() map[string]string GetInterval() *types.Duration Eval(ctx context.Context) (map[watch.Indexer]*datasource.Point, error) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool) }
IStrategy 策略接口
type IStrategyEvent ¶ added in v1.1.38
type IStrategyEvent interface { IStrategy // SetValue 设置数据 SetValue(msg *mq.Msg) IStrategyEvent // GetDatasource 获取数据源 GetDatasource() []*MQDatasource // GetTopic 获取主题 GetTopic() string }
IStrategyEvent 事件策略统一接口
type LabelNotices ¶ added in v1.1.0
type LabelNotices struct { // label key Key string `json:"key,omitempty"` // label value 支持正则 Value string `json:"value,omitempty"` // 接收者 (告警组ID列表) ReceiverGroupIDs []uint32 `json:"receiverGroupIDs,omitempty"` }
LabelNotices 自定义接收者匹配对象
type MQDatasource ¶ added in v1.1.38
type MQDatasource struct { TeamID uint32 `json:"team_id"` ID uint32 `json:"id"` Status vobj.Status `json:"status"` Conf *conf.MQ `json:"conf"` }
MQDatasource MQ 数据源配置
func (*MQDatasource) GetMQConfig ¶ added in v1.1.38
func (m *MQDatasource) GetMQConfig() *conf.MQ
GetMQConfig 获取 MQ 配置
func (*MQDatasource) Index ¶ added in v1.1.38
func (m *MQDatasource) Index() string
Index 实现 watch.Indexer 接口
func (*MQDatasource) String ¶ added in v1.1.38
func (m *MQDatasource) String() string
String 实现 fmt.Stringer 接口
type MetricDetail ¶
type MetricDetail struct { // 指标名称 Name string `json:"name"` // 帮助信息 Help string `json:"help"` // 类型 Type string `json:"type"` // 标签集合 Labels map[string][]string `json:"labels"` // 指标单位 Unit string `json:"unit"` }
MetricDetail 指标详情
type PushMetricParams ¶
type PushMetricParams struct { // 指标明细 *MetricDetail // 数据源ID DatasourceID uint32 `json:"datasourceId"` // 是否完成 Done bool `json:"done"` // 团队ID TeamID uint32 `json:"teamId"` }
PushMetricParams 推送指标请求参数
type QueryQLParams ¶
type QueryQLParams struct { // 查询指标请求参数 GetMetricsParams // 查询QL QueryQL string `json:"queryQL"` // 时间范围 TimeRange []string `json:"timeRange"` // 步长 Step uint32 `json:"step"` }
QueryQLParams 查询QL请求参数
type StrategyDomain ¶ added in v1.1.0
type StrategyDomain struct { // 接收者 (告警组ID列表) ReceiverGroupIDs []uint32 `json:"receiverGroupIDs,omitempty"` // 自定义接收者匹配对象 LabelNotices []*LabelNotices `json:"labelNotices,omitempty"` // 策略ID ID uint32 `json:"id,omitempty"` // 策略等级ID LevelID uint32 `json:"levelId,omitempty"` // 团队ID TeamID uint32 `json:"teamId,omitempty"` // 状态 Status vobj.Status `json:"status,omitempty"` // 策略名称 Alert string `json:"alert,omitempty"` // 阈值 Threshold float64 `json:"threshold,omitempty"` // 策略标签 Labels *vobj.Labels `json:"labels,omitempty"` // 策略注解 Annotations *vobj.Annotations `json:"annotations,omitempty"` // 域名 Domain string `json:"domain,omitempty"` // 超时时间 Timeout uint32 `json:"timeout,omitempty"` // 执行频率 Interval *types.Duration `json:"interval,omitempty"` // 端口 Port uint32 `json:"port,omitempty"` // 类型 Type vobj.StrategyType `json:"type,omitempty"` }
StrategyDomain 证书策略
func (*StrategyDomain) BuilderAlarmBaseInfo ¶ added in v1.1.0
func (s *StrategyDomain) BuilderAlarmBaseInfo() *Alarm
BuilderAlarmBaseInfo 构建告警基础信息
func (*StrategyDomain) Eval ¶ added in v1.1.0
func (s *StrategyDomain) Eval(ctx context.Context) (map[watch.Indexer]*datasource.Point, error)
Eval 策略评估
func (*StrategyDomain) GetAnnotations ¶ added in v1.1.0
func (s *StrategyDomain) GetAnnotations() map[string]string
GetAnnotations 获取策略注解
func (*StrategyDomain) GetInterval ¶ added in v1.1.0
func (s *StrategyDomain) GetInterval() *types.Duration
GetInterval 获取执行频率
func (*StrategyDomain) GetLabelNotices ¶ added in v1.1.0
func (s *StrategyDomain) GetLabelNotices() []*LabelNotices
GetLabelNotices 获取自定义接收者匹配对象
func (*StrategyDomain) GetReceiverGroupIDs ¶ added in v1.1.0
func (s *StrategyDomain) GetReceiverGroupIDs() []uint32
GetReceiverGroupIDs 获取接收者组ID列表
func (*StrategyDomain) GetStatus ¶ added in v1.1.0
func (s *StrategyDomain) GetStatus() vobj.Status
GetStatus 获取策略状态
func (*StrategyDomain) GetTeamID ¶ added in v1.1.0
func (s *StrategyDomain) GetTeamID() uint32
GetTeamID 获取团队ID
func (*StrategyDomain) IsCompletelyMeet ¶ added in v1.1.0
func (s *StrategyDomain) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
IsCompletelyMeet 判断策略是否完全满足条件
func (*StrategyDomain) Message ¶ added in v1.1.0
func (s *StrategyDomain) Message() *watch.Message
Message 策略转消息
func (*StrategyDomain) String ¶ added in v1.1.0
func (s *StrategyDomain) String() string
String 策略转字符串
type StrategyEndpoint ¶ added in v1.1.0
type StrategyEndpoint struct { // 类型 Type vobj.StrategyType `json:"type,omitempty"` // url 地址 URL string `json:"url,omitempty"` // 超时时间 Timeout uint32 `json:"timeout,omitempty"` // 状态码 200 404 500 StatusCode uint32 `json:"statusCode,omitempty"` // 请求头 Headers map[string]string `json:"headers,omitempty"` // 请求体 Body string `json:"body,omitempty"` // 请求方式 Method vobj.HTTPMethod `json:"method,omitempty"` // 相应时间阈值 Threshold float64 `json:"threshold,omitempty"` // 策略标签 Labels *vobj.Labels `json:"labels,omitempty"` // 策略注解 Annotations *vobj.Annotations `json:"annotations,omitempty"` // 接收者 (告警组ID列表) ReceiverGroupIDs []uint32 `json:"receiverGroupIDs,omitempty"` // 自定义接收者匹配对象 LabelNotices []*LabelNotices `json:"labelNotices,omitempty"` // 团队ID TeamID uint32 `json:"teamId,omitempty"` // 状态 Status vobj.Status `json:"status,omitempty"` // 策略名称 Alert string `json:"alert,omitempty"` // 执行频率 Interval *types.Duration `json:"interval,omitempty"` // 策略级别ID LevelID uint32 `json:"levelId,omitempty"` // 策略ID ID uint32 `json:"id,omitempty"` }
StrategyEndpoint 端点响应时间、状态码策略
func (*StrategyEndpoint) BuilderAlarmBaseInfo ¶ added in v1.1.0
func (e *StrategyEndpoint) BuilderAlarmBaseInfo() *Alarm
BuilderAlarmBaseInfo 生成告警基础信息
func (*StrategyEndpoint) Eval ¶ added in v1.1.0
func (e *StrategyEndpoint) Eval(ctx context.Context) (map[watch.Indexer]*datasource.Point, error)
Eval 评估策略
func (*StrategyEndpoint) GetAnnotations ¶ added in v1.1.0
func (e *StrategyEndpoint) GetAnnotations() map[string]string
GetAnnotations 获取策略注解
func (*StrategyEndpoint) GetInterval ¶ added in v1.1.0
func (e *StrategyEndpoint) GetInterval() *types.Duration
GetInterval 获取执行频率
func (*StrategyEndpoint) GetLabelNotices ¶ added in v1.1.0
func (e *StrategyEndpoint) GetLabelNotices() []*LabelNotices
GetLabelNotices 获取自定义接收者匹配对象
func (*StrategyEndpoint) GetReceiverGroupIDs ¶ added in v1.1.0
func (e *StrategyEndpoint) GetReceiverGroupIDs() []uint32
GetReceiverGroupIDs 获取接收者组ID列表
func (*StrategyEndpoint) GetStatus ¶ added in v1.1.0
func (e *StrategyEndpoint) GetStatus() vobj.Status
GetStatus 获取策略状态
func (*StrategyEndpoint) GetTeamID ¶ added in v1.1.0
func (e *StrategyEndpoint) GetTeamID() uint32
GetTeamID 获取团队ID
func (*StrategyEndpoint) Index ¶ added in v1.1.0
func (e *StrategyEndpoint) Index() string
Index 生成策略索引
func (*StrategyEndpoint) IsCompletelyMeet ¶ added in v1.1.0
func (e *StrategyEndpoint) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
IsCompletelyMeet 是否完全满足策略条件
func (*StrategyEndpoint) Message ¶ added in v1.1.0
func (e *StrategyEndpoint) Message() *watch.Message
Message 生成策略消息
func (*StrategyEndpoint) String ¶ added in v1.1.0
func (e *StrategyEndpoint) String() string
String 将策略端点转换为字符串
type StrategyEvent ¶ added in v1.1.38
type StrategyEvent struct { // 策略类型 StrategyType vobj.StrategyType `json:"strategyType,omitempty"` // 团队ID TeamID uint32 `json:"teamId,omitempty"` // 接收者 (告警组ID列表) ReceiverGroupIDs []uint32 `json:"receiverGroupIDs,omitempty"` // 策略ID ID uint32 `json:"id,omitempty"` // 策略等级ID LevelID uint32 `json:"levelId,omitempty"` // 策略名称 Alert string `json:"alert,omitempty"` // 策略语句 Expr string `json:"expr,omitempty"` // 阈值 Threshold string `json:"threshold,omitempty"` // 判断条件 Condition vobj.MQCondition `json:"condition,omitempty"` // 数据类型 DataType vobj.MQDataType `json:"dataType,omitempty"` // 数据 Key DataKey string `json:"dataKey,omitempty"` // 数据源 Datasource []*MQDatasource `json:"datasource,omitempty"` // 策略状态 Status vobj.Status `json:"status,omitempty"` // 策略标签 Labels *vobj.Labels `json:"labels,omitempty"` // 策略注解 Annotations *vobj.Annotations `json:"annotations,omitempty"` // contains filtered or unexported fields }
StrategyEvent 事件策略明细
func (*StrategyEvent) BuilderAlarmBaseInfo ¶ added in v1.1.38
func (s *StrategyEvent) BuilderAlarmBaseInfo() *Alarm
BuilderAlarmBaseInfo 实现 IStrategy 接口
func (*StrategyEvent) Eval ¶ added in v1.1.38
func (s *StrategyEvent) Eval(_ context.Context) (map[watch.Indexer]*datasource.Point, error)
Eval 实现 IStrategy 接口
func (*StrategyEvent) GetAnnotations ¶ added in v1.1.38
func (s *StrategyEvent) GetAnnotations() map[string]string
GetAnnotations 实现 IStrategy 接口
func (*StrategyEvent) GetDatasource ¶ added in v1.1.38
func (s *StrategyEvent) GetDatasource() []*MQDatasource
GetDatasource 获取数据源
func (*StrategyEvent) GetInterval ¶ added in v1.1.38
func (s *StrategyEvent) GetInterval() *types.Duration
GetInterval 实现 IStrategy 接口
func (*StrategyEvent) GetLabelNotices ¶ added in v1.1.38
func (s *StrategyEvent) GetLabelNotices() []*LabelNotices
GetLabelNotices 实现 IStrategy 接口
func (*StrategyEvent) GetReceiverGroupIDs ¶ added in v1.1.38
func (s *StrategyEvent) GetReceiverGroupIDs() []uint32
GetReceiverGroupIDs 实现 IStrategy 接口
func (*StrategyEvent) GetStatus ¶ added in v1.1.38
func (s *StrategyEvent) GetStatus() vobj.Status
GetStatus 实现 IStrategy 接口
func (*StrategyEvent) GetTeamID ¶ added in v1.1.38
func (s *StrategyEvent) GetTeamID() uint32
GetTeamID 实现 IStrategy 接口
func (*StrategyEvent) GetTopic ¶ added in v1.1.38
func (s *StrategyEvent) GetTopic() string
GetTopic 获取主题
func (*StrategyEvent) Index ¶ added in v1.1.38
func (s *StrategyEvent) Index() string
Index 实现 watch.Indexer 接口
func (*StrategyEvent) IsCompletelyMeet ¶ added in v1.1.38
func (s *StrategyEvent) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
IsCompletelyMeet 实现 IStrategy 接口
func (*StrategyEvent) Message ¶ added in v1.1.38
func (s *StrategyEvent) Message() *watch.Message
Message 实现 watch.Message 接口
func (*StrategyEvent) SetValue ¶ added in v1.1.38
func (s *StrategyEvent) SetValue(msg *mq.Msg) IStrategyEvent
SetValue 设置数据
func (*StrategyEvent) String ¶ added in v1.1.38
func (s *StrategyEvent) String() string
String 实现 fmt.Stringer 接口
type StrategyMetric ¶ added in v1.1.0
type StrategyMetric struct { // 接收者 (告警组ID列表) ReceiverGroupIDs []uint32 `json:"receiverGroupIDs,omitempty"` // 自定义接收者匹配对象 LabelNotices []*LabelNotices `json:"labelNotices,omitempty"` // 策略ID ID uint32 `json:"id,omitempty"` // 策略等级ID LevelID uint32 `json:"levelId,omitempty"` // 策略名称 Alert string `json:"alert,omitempty"` // 策略语句 Expr string `json:"expr,omitempty"` // 策略持续时间 For *types.Duration `json:"for,omitempty"` // 持续次数 Count uint32 `json:"count,omitempty"` // 持续的类型 SustainType vobj.Sustain `json:"sustainType,omitempty"` // 多数据源持续类型 MultiDatasourceSustainType vobj.MultiDatasourceSustain `json:"multiDatasourceSustainType,omitempty"` // 策略标签 Labels *vobj.Labels `json:"labels,omitempty"` // 策略注解 Annotations *vobj.Annotations `json:"annotations,omitempty"` // 执行频率 Interval *types.Duration `json:"interval,omitempty"` // 数据源 Datasource []*Datasource `json:"datasource,omitempty"` // 策略状态 Status vobj.Status `json:"status,omitempty"` // 判断条件 Condition vobj.Condition `json:"condition,omitempty"` // 阈值 Threshold float64 `json:"threshold,omitempty"` // 团队ID TeamID uint32 `json:"teamId,omitempty"` }
StrategyMetric 策略明细
func (*StrategyMetric) BuilderAlarmBaseInfo ¶ added in v1.1.0
func (s *StrategyMetric) BuilderAlarmBaseInfo() *Alarm
BuilderAlarmBaseInfo 生成告警基础信息
func (*StrategyMetric) Eval ¶ added in v1.1.0
func (s *StrategyMetric) Eval(ctx context.Context) (map[watch.Indexer]*datasource.Point, error)
Eval 评估策略
func (*StrategyMetric) GetAnnotations ¶ added in v1.1.0
func (s *StrategyMetric) GetAnnotations() map[string]string
GetAnnotations 获取策略注解
func (*StrategyMetric) GetInterval ¶ added in v1.1.0
func (s *StrategyMetric) GetInterval() *types.Duration
GetInterval 获取执行频率
func (*StrategyMetric) GetLabelNotices ¶ added in v1.1.0
func (s *StrategyMetric) GetLabelNotices() []*LabelNotices
GetLabelNotices 获取自定义接收者匹配对象
func (*StrategyMetric) GetReceiverGroupIDs ¶ added in v1.1.0
func (s *StrategyMetric) GetReceiverGroupIDs() []uint32
GetReceiverGroupIDs 获取接收者组ID列表
func (*StrategyMetric) GetStatus ¶ added in v1.1.0
func (s *StrategyMetric) GetStatus() vobj.Status
GetStatus 获取策略状态
func (*StrategyMetric) GetTeamID ¶ added in v1.1.0
func (s *StrategyMetric) GetTeamID() uint32
GetTeamID 获取团队ID
func (*StrategyMetric) IsCompletelyMeet ¶ added in v1.1.0
func (s *StrategyMetric) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
IsCompletelyMeet 判断策略是否完全满足条件
func (*StrategyMetric) Message ¶ added in v1.1.0
func (s *StrategyMetric) Message() *watch.Message
Message 策略转消息
func (*StrategyMetric) String ¶ added in v1.1.0
func (s *StrategyMetric) String() string
String 将策略转换为字符串
type StrategyPing ¶ added in v1.1.0
type StrategyPing struct { // 类型 Type vobj.StrategyType `json:"type,omitempty"` // 策略ID StrategyID uint32 `json:"strategy_id,omitempty"` // 团队ID TeamID uint32 `json:"teamId,omitempty"` // 状态 Status vobj.Status `json:"status,omitempty"` // 策略名称 Alert string `json:"alert,omitempty"` // 执行频率 Interval *types.Duration `json:"interval,omitempty"` // 策略级别ID LevelID uint32 `json:"levelId,omitempty"` // 超时时间 Timeout uint32 `json:"timeout,omitempty"` // 策略标签 Labels *vobj.Labels `json:"labels,omitempty"` // 策略注解 Annotations *vobj.Annotations `json:"annotations,omitempty"` // 接收者 (告警组ID列表) ReceiverGroupIDs []uint32 `json:"receiverGroupIDs,omitempty"` // 域名或IP Address string `json:"address,omitempty"` // 总包数 TotalPackets float64 `json:"totalPackets,omitempty"` // 成功包数 SuccessPackets float64 `json:"successPackets,omitempty"` // 丢包率 LossRate float64 `json:"lossRate,omitempty"` // 最小延迟 MinDelay float64 `json:"minDelay,omitempty"` // 最大延迟 MaxDelay float64 `json:"maxDelay,omitempty"` // 平均延迟 AvgDelay float64 `json:"avgDelay,omitempty"` // 标准差 StdDevDelay float64 `json:"stdDevDelay,omitempty"` }
StrategyPing ping 策略
func (*StrategyPing) BuilderAlarmBaseInfo ¶ added in v1.1.0
func (s *StrategyPing) BuilderAlarmBaseInfo() *Alarm
BuilderAlarmBaseInfo 生成告警基础信息
func (*StrategyPing) Eval ¶ added in v1.1.0
func (s *StrategyPing) Eval(ctx context.Context) (map[watch.Indexer]*datasource.Point, error)
Eval 评估策略
func (*StrategyPing) GetAnnotations ¶ added in v1.1.0
func (s *StrategyPing) GetAnnotations() map[string]string
GetAnnotations 获取策略注解
func (*StrategyPing) GetInterval ¶ added in v1.1.0
func (s *StrategyPing) GetInterval() *types.Duration
GetInterval 获取执行频率
func (*StrategyPing) GetLabelNotices ¶ added in v1.1.0
func (s *StrategyPing) GetLabelNotices() []*LabelNotices
GetLabelNotices 获取自定义接收者匹配对象
func (*StrategyPing) GetReceiverGroupIDs ¶ added in v1.1.0
func (s *StrategyPing) GetReceiverGroupIDs() []uint32
GetReceiverGroupIDs 获取接收者组ID列表
func (*StrategyPing) GetStatus ¶ added in v1.1.0
func (s *StrategyPing) GetStatus() vobj.Status
GetStatus 获取策略状态
func (*StrategyPing) GetTeamID ¶ added in v1.1.0
func (s *StrategyPing) GetTeamID() uint32
GetTeamID 获取团队ID
func (*StrategyPing) IsCompletelyMeet ¶ added in v1.1.0
func (s *StrategyPing) IsCompletelyMeet(values []*datasource.Value) (map[string]any, bool)
IsCompletelyMeet 是否完全满足策略条件
func (*StrategyPing) Message ¶ added in v1.1.0
func (s *StrategyPing) Message() *watch.Message
Message 生成策略消息
func (*StrategyPing) String ¶ added in v1.1.0
func (s *StrategyPing) String() string
String 将策略转换为字符串