首页 > 其他分享 >skywalking 实现钉钉告警

skywalking 实现钉钉告警

时间:2022-10-04 16:00:14浏览次数:58  
标签:compose 实现 0.0 告警 tcp docker root skywalking

一、映射本地告警文件到docker-compose

1.1、skywalking告警-指标说明

# cat config/oal/core.oal

  • service_resp_time #服务的响应时间
  • service_sla #服务的http请求成功率SLA,比如99%等。
  • service_cpm #表示每分钟的吞吐量.
  • service_apdex : 应用性能指数是0.8是0.x
  • service_percentile: 指定最近多少数据范围内的响应时间百分比,即p99, p95, p90, p75, p50在内的数据统计结果
  • endpoint_relation_cpm #端点的每分钟的吞吐量
  • endpoint_relation_resp_time #端点的响应时间
  • endpoint_relation_sla #端点的http请求成功率SLA,比如99%等。
  • endpoint_relation_percentile ##端点的最近多少数据范围内的响应时间百分比,即p99、 p95、 p90、 p75、p50在内的数据统计结果

1.2、准备相关文件

准备core.oal、alarm-settings.yml文件,并将其挂载到docker-compose容器

wget https://archive.apache.org/dist/skywalking/8.6.0/apache-skywalking-apm-es7-8.6.0.tar.gz

tar -xf apache-skywalking-apm-es7-8.6.0.tar.gz 

cp apache-skywalking-apm-bin-es7/config/alarm-settings.yml /apps/skywalking-docker-compose

cp apache-skywalking-apm-bin-es7/config/oal/core.oal  /apps/skywalking-docker-compose

[root@skywalking-docker-compose-01 skywalking-docker-compose]# ll -h
total 24K
drwxr-xr-x 2 root root 4.0K Oct  4 06:38 ./
drwxr-xr-x 4 root root 4.0K Oct  1 11:23 ../
-rw-r--r-- 1 root root 3.3K Oct  4 06:38 alarm-settings.yml
-rwxr-xr-x 1 root root 5.1K Oct  4 06:38 core.oal*
-rw-r--r-- 1 root root 1.1K Oct  1 10:22 docker-compose.yaml
[root@skywalking-docker-compose-01 skywalking-docker-compose]#

1.3、停止docker-compose

docker-compose down

[root@skywalking-docker-compose-01 skywalking-docker-compose]# docker-compose down
Stopping skywalking-ui  ... done
Stopping skywalking-oap ... done
Stopping es7            ... done
Removing skywalking-ui  ... done
Removing skywalking-oap ... done
Removing es7            ... done
Removing network skywalking-docker-compose_default
[root@skywalking-docker-compose-01 skywalking-docker-compose]#  
[root@skywalking-docker-compose-01 skywalking-docker-compose]# docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@skywalking-docker-compose-01 skywalking-docker-compose]# 

1.4、编辑docker-compose.yaml

[root@skywalking-docker-compose-01 skywalking-docker-compose]# vi docker-compose.yaml
[root@skywalking-docker-compose-01 skywalking-docker-compose]# cat docker-compose.yaml

version: '3.3'
services:
  es7:
    image: elasticsearch:7.10.1
    container_name: es7
    ports:
      - 9200:9200
      - 9300:9300
    environment:
      - discovery.type=single-node #单机模式
      - bootstrap.memory_lock=true #锁定物理内存地址
      - "ES_JAVA_OPTS=-Xms1048m -Xmx1048m" #堆内存大小
      - TZ=Asia/Shanghai
    ulimits:
      memlock:
        soft: -1
        hard: -1
    volumes:
      - /data/elasticsearch/data:/usr/share/elasticsearch/data
  skywalking-oap:
    image: apache/skywalking-oap-server:8.6.0-es7
    container_name: skywalking-oap
    restart: always
    volumes:
      - ./core.oal:/skywalking/config/oal/core.oal
      - ./alarm-settings.yml:/skywalking/config/alarm-settings.yml
    depends_on:
      - es7
    links:
      - es7
    ports:
      - 11800:11800
      - 12800:12800
    environment:
      TZ: Asia/Shanghai
      SW_STORAGE: elasticsearch7
      SW_STORAGE_ES_CLUSTER_NODES: es7:9200
  skywalking-ui:
    image: apache/skywalking-ui:8.6.0
    container_name: skywalking-ui
    restart: always
    depends_on:
      - skywalking-oap
    links:
      - skywalking-oap
    ports:
      - 8080:8080
    environment:
      TZ: Asia/Shanghai
      SW_OAP_ADDRESS: skywalking-oap:12800

1.5、启动docker-compose

docker-compose up -d 

[root@skywalking-docker-compose-01 skywalking-docker-compose]# docker ps -a
CONTAINER ID   IMAGE     COMMAND   CREATED   STATUS    PORTS     NAMES
[root@skywalking-docker-compose-01 skywalking-docker-compose]# docker-compose up -d
Creating network "skywalking-docker-compose_default" with the default driver
Creating es7 ... done
Creating skywalking-oap ... done
Creating skywalking-ui  ... done
[root@skywalking-docker-compose-01 skywalking-docker-compose]# docker ps -a
CONTAINER ID   IMAGE                                    COMMAND                  CREATED          STATUS         PORTS                                                                                                    NAMES
c665206a3c0b   apache/skywalking-ui:8.6.0               "bash docker-entrypo…"   9 seconds ago    Up 7 seconds   0.0.0.0:8080->8080/tcp, :::8080->8080/tcp                                                                skywalking-ui
b4b9e3568a7b   apache/skywalking-oap-server:8.6.0-es7   "bash docker-entrypo…"   9 seconds ago    Up 8 seconds   0.0.0.0:11800->11800/tcp, :::11800->11800/tcp, 1234/tcp, 0.0.0.0:12800->12800/tcp, :::12800->12800/tcp   skywalking-oap
ce7014704924   elasticsearch:7.10.1                     "/tini -- /usr/local…"   10 seconds ago   Up 8 seconds   0.0.0.0:9200->9200/tcp, :::9200->9200/tcp, 0.0.0.0:9300->9300/tcp, :::9300->9300/tcp                     es7
[root@skywalking-docker-compose-01 skywalking-docker-compose]# netstat -tnlp
Active Internet connections (only servers)
Proto Recv-Q Send-Q Local Address           Foreign Address         State       PID/Program name    
tcp        0      0 0.0.0.0:8080            0.0.0.0:*               LISTEN      1338450/docker-prox 
tcp        0      0 0.0.0.0:9200            0.0.0.0:*               LISTEN      1338075/docker-prox 
tcp        0      0 0.0.0.0:9300            0.0.0.0:*               LISTEN      1338052/docker-prox 
tcp        0      0 127.0.0.53:53           0.0.0.0:*               LISTEN      675/systemd-resolve 
tcp        0      0 0.0.0.0:22              0.0.0.0:*               LISTEN      834/sshd: /usr/sbin 
tcp        0      0 0.0.0.0:11800           0.0.0.0:*               LISTEN      1338247/docker-prox 
tcp        0      0 127.0.0.1:44857         0.0.0.0:*               LISTEN      770/containerd      
tcp        0      0 127.0.0.1:6010          0.0.0.0:*               LISTEN      1335264/sshd: root@ 
tcp        0      0 127.0.0.1:6011          0.0.0.0:*               LISTEN      1335684/sshd: root@ 
tcp        0      0 0.0.0.0:12800           0.0.0.0:*               LISTEN      1338217/docker-prox 
tcp6       0      0 :::8080                 :::*                    LISTEN      1338457/docker-prox 
tcp6       0      0 :::9200                 :::*                    LISTEN      1338081/docker-prox 
tcp6       0      0 :::9300                 :::*                    LISTEN      1338057/docker-prox 
tcp6       0      0 :::22                   :::*                    LISTEN      834/sshd: /usr/sbin 
tcp6       0      0 :::11800                :::*                    LISTEN      1338254/docker-prox 
tcp6       0      0 ::1:6010                :::*                    LISTEN      1335264/sshd: root@ 
tcp6       0      0 ::1:6011                :::*                    LISTEN      1335684/sshd: root@ 
tcp6       0      0 :::12800                :::*                    LISTEN      1338223/docker-prox 
[root@skywalking-docker-compose-01 skywalking-docker-compose]# 

二、配置skywalking 钉钉告警

2.1、skywalking 告警简单说明

#vim config/alarm-settings.yml

  • rules: #定义rule规则
  • service_cpm_rule: #唯一的规则名称,必须以_rule结尾
  • metrics-name: service_cpm #指标名称
  • op: ">" #操作符,>, >=, <, <=, ==
  • threshold: 1 #指标阈值
  • period: 2 #评估指标的间隔周期
  • count: 1 #匹配成功多少次就会触发告警
  • silence-period: 2 #触发告警后的静默时间
  • message: dubbo-provider service_cpm 大于1了 #告警信息

2.2、自定义告警规则

[root@skywalking-docker-compose-01 skywalking-docker-compose]# vi alarm-settings.yml
[root@skywalking-docker-compose-01 skywalking-docker-compose]# cat alarm-settings.yml

rules:
  service_cpm_rule:
    metrics-name: service_cpm
    op: ">"
    threshold: 1
    period: 1
    count: 1
    silence-period: 1
    message: dubbo-provider的当前指标service_cpm,请求值大于5000了!!!!
dingtalkHooks:
  textTemplate: |-
    {
      "msgtype": "text",
      "text": {
      "content": "Apache SkyWalking Alarm: \n %s."
      }  
    }
  webhooks:
    - url: https://oapi.dingtalk.com/robot/send?access_token=abxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxc5d

2.3、钉钉加上告警关键字

2.4、重建docker-compose

[root@skywalking-docker-compose-01 skywalking-docker-compose]# docker-compose down
Stopping skywalking-ui  ... done
Stopping skywalking-oap ... done
Stopping es7            ... done
Removing skywalking-ui  ... done
Removing skywalking-oap ... done
Removing es7            ... done
Removing network skywalking-docker-compose_default
[root@skywalking-docker-compose-01 skywalking-docker-compose]# 
[root@skywalking-docker-compose-01 skywalking-docker-compose]# docker-compose up -d
Creating network "skywalking-docker-compose_default" with the default driver
Creating es7 ... done
Creating skywalking-oap ... done
Creating skywalking-ui  ... done
[root@skywalking-docker-compose-01 skywalking-docker-compose]# 

2.5、测试告警

不断刷新页面,让其访问值超过1

skywalking server端也显示发送的告警信息

 

标签:compose,实现,0.0,告警,tcp,docker,root,skywalking
From: https://www.cnblogs.com/cyh00001/p/16753736.html

相关文章

  • Python 实现Tracert追踪TTL值
    Tracert命令跟踪路由原理是IP路由每经过一个路由节点TTL值会减一,假设TTL值=0时数据包还没有到达目标主机,那么该路由则会回复给目标主机一个数据包不可达,由此我们就可以获......
  • 快速排序-C语言实现
    快速排序排序思想1.选定Pivot中心轴2.将大于Pivot的数字放在Pivot的右边3.将小于Pivot的数字放在Pivot的左边4.分别对左右子序列(此时有左右2个子表),重复前三步操......
  • 如何使用Sentry通过视图实现Impala的行级授权
    温馨提示:要看高清无码套图,请使用手机打开并单击图片放大查看。Fayson的github:https://github.com/fayson/cdhproject提示:代码块部分可以左右滑动查看噢1.文档编写目的在CDH......
  • 0766-6.3.3-如何实现Kafka跨网络访问
    文档说明在使用Kafka时会遇到内外网的场景,即Kafka集群使用内网搭建,在内网和外网均有客户端需要消费Kafka的消息,同时在集群内由于使用内网环境通信,因此不必太过考虑通信的加......
  • skywalking 实现收集基于python的Django项目链路追踪案例
    一、python3环境设置1.1、安装python3apt-getupdateaptinstallpython3-pip-ypipinstall"apache-skywalking"[root@skywalking-agent-07~]#pipinstall"apache-s......
  • 【Web开发】Python实现Web服务器(Bottle框架)
    Django-TheWebframeworkforperfectionistswithdeadlines.Flask-ThePythonmicroframeworkforbuildingwebapplications.Tornado-TornadoisaPythonw......
  • 配置Django实现数据库读写分离
    配置Django实现数据库读写分离django在进行数据库操作的时候,读取数据与写数据(增、删、改)可以分别从不同的数据库进行操作。1.在配置文件中增加slave数据库的配置DATABA......
  • 同时多个axios请求怎么实现无痛刷新token
    需求最近遇到个需求:前端登录后,后端返回token和token有效时间,当token过期时要求用旧token去获取新的token,前端需要做到无痛刷新token,即请求刷新token时要做到用户无感知。......
  • 底部栏的三种实现方式
    将bar固定在底部是一个非常常见的需求,比如分页器。于是,今天就来说一说有哪些方法能够将bar固定在底部。fixed法这是最简单的,但同时缺陷也最大,因为fixed元素的百分比宽度......
  • 实现可拖拽侧边栏
    效果演示图可拖拽侧边栏的使用情况非常多啊,博客园后台管理左侧边栏就可以拖拽哟!废话不多说,本随笔实现的可拖拽侧边栏效果演示图如下:HTML代码<divclass="container">......