怎么停止skywalking_SkyWalking 告警设置

版本:7.0.0

简介

告警是基于指标数据驱动的,告警在 config/alarm-settings.yml里面配置,主要包含三种告警配置:

告警规则:声明指标的阈值和条件,当达到阈值时,将触发告警。

WebHooks:web服务列表,当告警规则触发时回调。

gRPCHook:远程gRPC方法的IP和端口,当告警规则触发时回调。

规则

告警规则组成关键字段如下:

Rule name:具有唯一性,展示在告警信息里面,必须以_rule结尾。

Metrics name:oal脚本里面的指标名称,支持long, double, int 类型。

Include names:规则里包含的实体名称,例如:服务名字,端点名字。

Excluse names:规则里排除的实体名称,例如:服务名字,端点名字。

Threshold:目标值(阈值)。对于多值指标(如:百分位),这个阈值是一个数组,格式如:value1,value2,value3,value4,value5。与指标格式一一对应。当不想其中某些指标触发告警时,阈值设置为横杠(-)

OP:操作,目前支持 >,>=,

Period:周期。一个时间窗口,表示告警规则应当被检测多长时间。

Count:在期限窗口时间段内,如果统计次数达到阈值,将触发告警。

Silence Period:静默时间,表示在多长时间内只会触发一次告警。默认值和Period相同,即在一个周期内,只会触发一次告警。rules:

# Rule unique name, must be ended with `_rule`.

endpoint_percent_rule:

# Metrics value need to be long, double or int

metrics-name: endpoint_percent

threshold: 75

op: <

# The length of time to evaluate the metrics

period: 10

# How many times after the metrics match the condition, will trigger alarm

count: 3

# How many times of checks, the alarm keeps silence after alarm triggered, default as same as period.

silence-period: 10

service_percent_rule:

metrics-name: service_percent

# [Optional] Default, match all services in this metrics

include-names:

- service_a

- service_b

exclude-names:

- service_c

# Single value metrics threshold.

threshold: 85

op: <

period: 10

count: 4

service_resp_time_percentile_rule:

# Metrics value need to be long, double or int

metrics-name: service_percentile

op: ">"

# Multiple value metrics threshold. Thresholds for P50, P75, P90, P95, P99.

threshold: 1000,1000,1000,1000,1000

period: 10

count: 3

silence-period: 5

message: Percentile response time of service {name} alarm in 3 minutes of last 10 minutes, due to more than one condition of p50 > 1000, p75 > 1000, p90 > 1000, p95 > 1000, p99 > 1000

默认规则

在发行版中提供了默认的alarm-setting.yml,其中包括以下规则:

最近3分钟内服务平均响应时间超过1秒。

最近2分钟的服务成功率低于80%。

最近3分钟的服务响应时间百分比超过1s。

最近2分钟内服务实例的平均响应时间超过1秒。

最近2分钟内端点平均响应时间超过1秒。

所有默认指标名称的列表

指标名称是在正式的OAL脚本中定义的,可以在Alarm中使用来自Service,Service Instance,Endpoint范围的指标。

Webhook

Webhook要求配置的时一个web容器,告警消息将以application/json格式通过http请求发送,消息格式声明为:List

字段如下:

scopeId, scope: 所有的scope实体在 org.apache.skywalking.oap.server.core.source.DefaultScopeDefine 里面声明。

name. 目标scope实体名称。

id0: scope实体ID,匹配名称。

id1: 不使用。

ruleName: 配置在 alarm-settings.yml 里面的规则名称.

alarmMessage: 告警信息.

startTime:触发告警的时间 示例:[{

"scopeId": 1,

"scope": "SERVICE",

"name": "serviceA",

"id0": 12,

"id1": 0,

"ruleName": "service_resp_time_rule",

"alarmMessage": "alarmMessage xxxx",

"startTime": 1560524171000

}, {

"scopeId": 1,

"scope": "SERVICE",

"name": "serviceB",

"id0": 23,

"id1": 0,

"ruleName": "service_resp_time_rule",

"alarmMessage": "alarmMessage yyy",

"startTime": 1560524171000

}]

gRPCHook

告警消息将以Protobuf类型通过远程方法发送,消息格式被声明在oap-server/server-alarm-plugin/src/main/proto/alarm-hook.proto里面。 示例:

message AlarmMessage {

int64 scopeId = 1;

string scope = 2;

string name = 3;

int64 id0 = 4;

int64 id1 = 5;

string ruleName = 6;

string alarmMessage = 7;

int64 startTime = 8;

}

动态配置

6.5.0版本以后,告警规则支持通过配置中心进行动态配置,动态配置将会覆盖alarm-setting.yml文件里面的配置。

告警规则是否被触发的顺序,SkyWalking将缓存每一个告警规则的指标信息一个时间窗口,当规则的任何属性改变的时候,静默窗口将被销毁并重建,从新开始这个特殊规则的告警统计。

来源:oschina

链接:https://my.oschina.net/u/2344188/blog/4318985

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值