skywallking 告警配置案例
告警配置# Licensed to the Apache Software Foundation (ASF) under one # or more contributor license agreements. See the NOTICE file # distributed with this work for additional information # regarding copyright ownership. The ASF licenses this file # to you under the Apache License, Version 2.0 (the # License); you may not use this file except in compliance # with the License. You may obtain a copy of the License at # # http://www.apache.org/licenses/LICENSE-2.0 # # Unless required by applicable law or agreed to in writing, software # distributed under the License is distributed on an AS IS BASIS, # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. # See the License for the specific language governing permissions and # limitations under the License. # Sample alarm rules. rules: # Rule unique name, must be ended with _rule. service_resp_time_rule: metrics-name: service_resp_time op: threshold: 1000 period: 10 count: 3 silence-period: 5 message: 实例:{name}\n响应时间在过去10分钟的3分钟内超过1000毫秒. service_sla_rule: # Metrics value need to be long, double or int metrics-name: service_sla op: threshold: 8000 # The length of time to evaluate the metrics period: 10 # How many times after the metrics match the condition, will trigger alarm count: 2 # How many times of checks, the alarm keeps silence after alarm triggered, default as same as period. silence-period: 3 message: 在过去10分钟的2分钟内实例:{name}的成功率低于80%. service_resp_time_percentile_rule: # Metrics value need to be long, double or int metrics-name: service_percentile op: threshold: 1000,1000,1000,1000,1000 period: 10 count: 3 silence-period: 5 message: 由于p501000、p751000、p901000、p951000、p991000的多种情况实例:{name}警报在过去10分钟的3分钟内的百分位响应时间. service_instance_resp_time_rule: metrics-name: service_instance_resp_time op: threshold: 1000 period: 10 count: 2 silence-period: 5 message: 实例:{name}\n响应时间在过去10分钟的2分钟内超过1000毫秒 database_access_resp_time_rule: metrics-name: database_access_resp_time threshold: 1000 op: period: 10 count: 2 message: 数据库访问:{name}\n响应时间在过去10分钟的2分钟内超过1000毫秒 endpoint_relation_resp_time_rule: metrics-name: endpoint_relation_resp_time threshold: 1000 op: period: 10 count: 2 message: 端点关系:{name}\n响应时间在过去10分钟的2分钟内超过1000毫秒 unhealthy_event_rule: metrics-name: Unhealthy # Healthiness check is usually a scheduled task, # they may be unhealthy for the first few times, # and can be unhealthy occasionally due to network jitter, # please adjust the threshold as per your actual situation. threshold: 3 op: period: 5 count: 1 message: 实例:{name}已不正常运行5分钟 instance_jvm_old_gc_count_rule: metrics-name: instance_jvm_old_gc_count threshold: 1 op: period: 10 count: 1 message: 实例:{name}\n 指标:OldGC次数\n 告警:最近10分钟内2 instance_jvm_young_gc_count_rule: metrics-name: instance_jvm_young_gc_count threshold: 1 op: period: 5 count: 1 message: 实例:{name}\n 指标:YoungGC次数\n 告警:最近5分钟内2 # Active endpoint related metrics alarm will cost more memory than service and service instance metrics alarm. # Because the number of endpoint is much more than service and instance. # # endpoint_avg_rule: # metrics-name: endpoint_avg # op: # threshold: 1000 # period: 10 # count: 2 # silence-period: 5 # message: Response time of endpoint {name} is more than 1000ms in 2 minutes of last 10 minutes #webhooks: # - http://127.0.0.1/notify/ # - http://127.0.0.1/go-wechat/ dingtalkHooks: textTemplate: |- { msgtype: text, text: { content: Apache SkyWalking 告警: \n %s. } } webhooks: - url: https://oapi.dingtalk.com/robot/send?access_token钉钉机器人的access_token secret: 钉钉机器人的secret复合规则主要有以下几点规则名称在告警信息中显示的唯一名称必须以_rule结尾。expression指定如何组成规则支持, ||, ()操作符。message该规则触发时发送的通知消息。rules: service_resp_time_rule: metrics-name: service_resp_time op: threshold: 1000 period: 10 count: 2 silence-period: 10 message: 服务【{name}】的平均响应时间在最近10分钟内有2分钟超过1秒 service_sla_rule: metrics-name: service_sla op: threshold: 8000 period: 10 count: 2 silence-period: 10 message: 服务【{name}】的成功率在最近10分钟内有2分钟低于80 composite-rules: comp_rule: expression: service_resp_time_rule service_sla_rule message: 服务【{name}】在最近10分钟内有2分钟超过1秒平均响应时间超过1秒并且成功率低于80