Apache SkyWalking 监控 Linux 实战_skywalking监控服务器内存、cpu使用情况(2)

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:

export UI_IMAGE=apache/skywalking-ui:

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 信息。  
 ![node-exporter-metrics](https://img-blog.csdnimg.cn/direct/614bb2d2a17942908aedb3a77488f143.png#pic_center)


##### 部署 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

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

otel-collector:
image: otel/opentelemetry-collector:0.50.0
container_name: otel-collector
command: [ “–config=/etc/otel-collector-config.yaml” ]
volumes:
- /opt/docker/skywalking/otel-collector-config.yaml:/etc/otel-collector-config.yaml
expose:
- 55678


在 /opt/docker/skywalking 目录(也可以自定义)创建配置文件 otel-collector-config.yaml



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.

receivers:
prometheus:
config:
scrape_configs:
- job_name: “vm-monitoring” # make sure to use this in the vm.yaml to filter only VM metrics
scrape_interval: 10s
static_configs:
- targets: [“192.168.56.102:9100”] # OpenTelemetry Collector 的地址,根据自己的服务器IP进行调整

processors:
batch:

exporters:
otlp:
endpoint: “oap:11800” # The OAP Server address
# The config format of OTEL version prior to 0.34.0, eg. 0.29.0, should be:
# insecure: true
tls:
insecure: true
#insecure: true

Exports data to the console

logging:
loglevel: debug

service:
pipelines:
metrics:
receivers: [prometheus]
processors: [batch]
exporters: [otlp, logging]


docker compose 重新启动

![](https://img-blog.csdnimg.cn/img_convert/9a8cb5f8c0ec69e6499adead0da6e95b.png)



最全的Linux教程,Linux从入门到精通

======================

1.  **linux从入门到精通(第2版)**

2.  **Linux系统移植**

3.  **Linux驱动开发入门与实战**

4.  **LINUX 系统移植 第2版**

5.  **Linux开源网络全栈详解 从DPDK到OpenFlow**



![华为18级工程师呕心沥血撰写3000页Linux学习笔记教程](https://img-blog.csdnimg.cn/img_convert/59742364bb1338737fe2d315a9e2ec54.png)



第一份《Linux从入门到精通》466页

====================

内容简介

====

本书是获得了很多读者好评的Linux经典畅销书**《Linux从入门到精通》的第2版**。本书第1版出版后曾经多次印刷,并被51CTO读书频道评为“最受读者喜爱的原创IT技术图书奖”。本书第﹖版以最新的Ubuntu 12.04为版本,循序渐进地向读者介绍了Linux 的基础应用、系统管理、网络应用、娱乐和办公、程序开发、服务器配置、系统安全等。本书附带1张光盘,内容为本书配套多媒体教学视频。另外,本书还为读者提供了大量的Linux学习资料和Ubuntu安装镜像文件,供读者免费下载。



![华为18级工程师呕心沥血撰写3000页Linux学习笔记教程](https://img-blog.csdnimg.cn/img_convert/9d4aefb6a92edea27b825e59aa1f2c54.png)



**本书适合广大Linux初中级用户、开源软件爱好者和大专院校的学生阅读,同时也非常适合准备从事Linux平台开发的各类人员。**

> 需要《Linux入门到精通》、《linux系统移植》、《Linux驱动开发入门实战》、《Linux开源网络全栈》电子书籍及教程的工程师朋友们劳烦您转发+评论




**网上学习资料一大堆,但如果学到的知识不成体系,遇到问题时只是浅尝辄止,不再深入研究,那么很难做到真正的技术提升。**

**[需要这份系统化的资料的朋友,可以点击这里获取!](https://bbs.csdn.net/topics/618542503)**

**一个人可以走的很快,但一群人才能走的更远!不论你是正从事IT行业的老鸟或是对IT行业感兴趣的新人,都欢迎加入我们的的圈子(技术交流、学习资源、职场吐槽、大厂内推、面试辅导),让我们一起学习成长!**
  • 8
    点赞
  • 6
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值