然后将转换后的数据发送给 SkyWalking MAL 处理。
方式一:Prometheus + OpenTelemetry,处理流程如下:
- Prometheus Node Exporter 从主机收集 metrics 数据.
- OpenTelemetry Collector 通过 Prometheus Receiver 从 Node Exporters 抓取 metrics 数据, 然后将 metrics 推送的到 SkyWalking OAP Server.
- SkyWalking OAP Server 通过 MAL 引擎去分析、计算、聚合和存储,处理规则位于 /config/otel-oc-rules/vm.yaml 文件.
- 用户可以通过 SkyWalking WebUI dashboard 查看监控数据。
方式二:通过 Telegraf receiver 具体参考官网文档的部署方式 https://skywalking.apache.org/docs/main/next/en/setup/backend/backend-vm-monitoring 。
下面让我们一起开始部署吧
部署 SkyWalking
之前的文章都是默认大家会部署 SkyWalking 的,这里我也提供下平时测试用的部署方式,我这里采用 docker compose 部署,主要是参考官网提供的部署配置,
SkyWalking 提供的部署基础配置在代码目录中,链接地址 https://github.com/apache/skywalking/tree/master/docker 。
docker-compose.yml
# 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.
version: '3.8'
services:
elasticsearch:
image: docker.elastic.co/elasticsearch/elasticsearch-oss:${ES_VERSION}
container\_name: elasticsearch
ports:
- "9200:9200"
healthcheck:
test: [ "CMD-SHELL", "curl --silent --fail localhost:9200/\_cluster/health || exit 1" ]
interval: 30s
timeout: 10s
retries: 3
start\_period: 10s
environment:
- discovery.type=single-node
- bootstrap.memory_lock=true
- "ES\_JAVA\_OPTS=-Xms512m -Xmx512m"
ulimits:
memlock:
soft: -1
hard: -1
oap:
image: ${OAP_IMAGE}
container\_name: oap
depends\_on:
elasticsearch:
condition: service_healthy
links:
- elasticsearch
ports:
- "11800:11800"
- "12800:12800"
healthcheck:
test: [ "CMD-SHELL", "/skywalking/bin/swctl ch" ]
interval: 30s
timeout: 10s
retries: 3
start\_period: 10s
environment:
SW\_STORAGE: elasticsearch
SW\_STORAGE\_ES\_CLUSTER\_NODES: elasticsearch:9200
SW\_HEALTH\_CHECKER: default
SW\_TELEMETRY: prometheus
JAVA\_OPTS: "-Xms2048m -Xmx2048m"
ui:
image: ${UI_IMAGE}
container\_name: ui
depends\_on:
oap:
condition: service_healthy
links:
- oap
ports:
- "8080:8080"
environment:
SW\_OAP\_ADDRESS: http://oap:12800
SW\_ZIPKIN\_ADDRESS: http://oap:9412
.env
用于镜像版本,这里使用 SkyWalking 9.7.0 版本,也是当前最新的版本
# The docker-compose.yml file is meant to be used locally for testing only after a local build, if you want to use it
# with officially released Docker images, please modify the environment variables on your command line interface.
# i.e.:
# export OAP_IMAGE=apache/skywalking-oap-server:<tag>
# export UI_IMAGE=apache/skywalking-ui:<tag>
# docker compose up
ES_VERSION=7.4.2
OAP_IMAGE=apache/skywalking-oap-server:9.7.0
UI_IMAGE=apache/skywalking-ui:9.7.0
启动 SkyWalking
docker compose up
启动完成后,访问 http://IP:8080 就可以正常打开 dashboard 页面了,当然这个时候还看不到监控数据。
部署 Prometheus node-exporter
node-exporter 官方文档 ,下载地址 https://prometheus.io/download/#node_exporter
这里下载 1.7.0 版本
wget https://github.com/prometheus/node_exporter/releases/download/v1.7.0/node_exporter-1.7.0.linux-amd64.tar.gz
tar xvfz node_exporter-1.7.0.linux-amd64.tar.gz
cd node_exporter-1.7.0.linux-amd64
./node_exporter
启动成功后访问 http://IP:9100/metrics 可以看到采集到的 metrics 信息。
部署 OpenTelemetry Collector
OpenTelemetry Collector 官方文档
这里将 otel-collector
和 skywalking 一起通过 docker compose 部署,完整配置如下:
# 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
**自我介绍一下,小编13年上海交大毕业,曾经在小公司待过,也去过华为、OPPO等大厂,18年进入阿里一直到现在。**
**深知大多数Linux运维工程师,想要提升技能,往往是自己摸索成长或者是报班学习,但对于培训机构动则几千的学费,着实压力不小。自己不成体系的自学效果低效又漫长,而且极易碰到天花板技术停滞不前!**
**因此收集整理了一份《2024年Linux运维全套学习资料》,初衷也很简单,就是希望能够帮助到想自学提升又不知道该从何学起的朋友,同时减轻大家的负担。**
![img](https://img-blog.csdnimg.cn/img_convert/10cb6c520bcad3d260355155537d30e5.png)
![img](https://img-blog.csdnimg.cn/img_convert/18939b256139bbb1ded94650da793861.png)
![img](https://img-blog.csdnimg.cn/img_convert/ba3430e567f61cbd2c7e2589562a37d3.png)
![img](https://img-blog.csdnimg.cn/img_convert/75b0269fd8f4be6f39b20c39a888b4c1.png)
![img](https://img-blog.csdnimg.cn/img_convert/79bb7692d8a08f7a0b185b483b4f2c39.png)
**既有适合小白学习的零基础资料,也有适合3年以上经验的小伙伴深入学习提升的进阶课程,基本涵盖了95%以上Linux运维知识点,真正体系化!**
**由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新**
**如果你觉得这些内容对你有帮助,可以添加VX:vip1024b (备注Linux运维获取)**
![img](https://img-blog.csdnimg.cn/img_convert/4fb1104567d208f455b50ae121a5979f.jpeg)
盖了95%以上Linux运维知识点,真正体系化!**
**由于文件比较大,这里只是将部分目录大纲截图出来,每个节点里面都包含大厂面经、学习笔记、源码讲义、实战项目、讲解视频,并且后续会持续更新**
**如果你觉得这些内容对你有帮助,可以添加VX:vip1024b (备注Linux运维获取)**
[外链图片转存中...(img-th1EoJQO-1712646240790)]