惯性聚合 高效追踪和阅读你感兴趣的博客、新闻、科技资讯
阅读原文 在惯性聚合中打开

推荐订阅源

cs.AI updates on arXiv.org
cs.AI updates on arXiv.org
Blog — PlanetScale
Blog — PlanetScale
钛媒体:引领未来商业与生活新知
钛媒体:引领未来商业与生活新知
The Last Watchdog
The Last Watchdog
AI
AI
Recent Announcements
Recent Announcements
Recent Commits to openclaw:main
Recent Commits to openclaw:main
Stack Overflow Blog
Stack Overflow Blog
V
Visual Studio Blog
J
Java Code Geeks
TaoSecurity Blog
TaoSecurity Blog
L
LangChain Blog
Exploit-DB.com RSS Feed
Exploit-DB.com RSS Feed
Project Zero
Project Zero
Microsoft Security Blog
Microsoft Security Blog
量子位
T
Threatpost
CTFtime.org: upcoming CTF events
CTFtime.org: upcoming CTF events
博客园 - Franky
博客园 - 聂微东
L
LINUX DO - 最新话题
Security Archives - TechRepublic
Security Archives - TechRepublic
Hugging Face - Blog
Hugging Face - Blog
T
The Blog of Author Tim Ferriss
P
Proofpoint News Feed
The GitHub Blog
The GitHub Blog
C
Check Point Blog
宝玉的分享
宝玉的分享
G
Google Developers Blog
Spread Privacy
Spread Privacy
Cloudbric
Cloudbric
SecWiki News
SecWiki News
有赞技术团队
有赞技术团队
www.infosecurity-magazine.com
www.infosecurity-magazine.com
W
WeLiveSecurity
Cyber Security Advisories - MS-ISAC
Cyber Security Advisories - MS-ISAC
美团技术团队
V
Vulnerabilities – Threatpost
Cyberwarzone
Cyberwarzone
A
Arctic Wolf
P
Privacy & Cybersecurity Law Blog
P
Palo Alto Networks Blog
H
Help Net Security
cs.CV updates on arXiv.org
cs.CV updates on arXiv.org
Cisco Talos Blog
Cisco Talos Blog
Hacker News - Newest:
Hacker News - Newest: "LLM"
A
About on SuperTechFans
N
Netflix TechBlog - Medium
罗磊的独立博客
月光博客
月光博客

博客园 - 陈惟鲜的博客

AI软件修改脚本与代码,还真不敢完全操作 linux 磁盘满了,排查 Ecelipse 安装 MAT linux 增加新磁盘 redis自身查询很慢 排查redis-benchmark prometheus监控mysql数据库 prometheus监控springboot项目配置 linux 文件属性被替换修改查询并修改 ----i----------- ZonedDateTime 转为 java.util.Date docker 容器查看jvm参数配置 redis 事务处理,一旦异常,则回滚 linux 下安装使用jmeter 执行压测 大批量订单来了由于入库慢,先缓存后通知入库 eclipse 合并错分支代码还原,合并到本分支但未push到库上 mysql 查询jason格式数据 maven打包慢,使用maven-mvnd 打包可以快一半 postman 参数化构建 批量测试 postman 常用参数例子 使用AOP实现+自定义注解 实现 缓存 如何判断redis慢了
监控工具prometheus配置-docker版
陈惟鲜的博客 · 2024-08-13 · via 博客园 - 陈惟鲜的博客

1、安装

直接创建一个docker-compose.yml

内容增加

networks:为了网络在同一个网段,方便通信,增加一个网段。
services:
prometheus:
安装docker镜像的信息配置。定义了镜像来源image,容器名称container_name,重点是吧prometheus.yml放入到容器内的卷映射,对外访问端口ports
grafana:
用于UI展示,能把prometheus中采集的信息用多种图形的方式展示。其官网有很多可以直接引用的模版。
grafana面板资源
https://grafana.com/grafana/dashboards

version: "3"

# 网桥 -> 方便相互通讯
networks:
  prometheus:
    ipam:
      driver: default
      config:
        - subnet: "172.22.0.0/24"

services:
  # 开源的系统监控和报警系统
  prometheus:
    image: prom/prometheus:v2.34.0
    container_name: prometheus
    restart: unless-stopped
    volumes:
      - ./prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
    command: "--config.file=/etc/prometheus/prometheus.yml --storage.tsdb.path=/prometheus"
    ports:
      - "9090:9090"
    depends_on:
      - node-exporter
    networks:
      prometheus:
        ipv4_address: 172.22.0.11

  # 采集服务器层面的运行指标
  node-exporter:
    image: prom/node-exporter:v1.3.1
    container_name: prometheus-node-exporter
    restart: unless-stopped
    ports:
      - "9100:9100"
    networks:
      prometheus:
        ipv4_address: 172.22.0.22

  # 用于UI展示
  # https://grafana.com/docs/grafana/latest/installation/docker
  grafana:
    image: grafana/grafana:8.0.0
    container_name: prometheus-grafana
    restart: unless-stopped
    ports:
      - "3000:3000"
    volumes:
      - "./prometheus/grafana/grafana.ini:/etc/grafana/grafana.ini" # 邮箱配置
    environment:
      GF_EXPLORE_ENABLED: "true"
      GF_SECURITY_ADMIN_PASSWORD: "admin"
      GF_INSTALL_PLUGINS: "grafana-clock-panel,grafana-simple-json-datasource,alexanderzobnin-zabbix-app"
      # 持久化到mysql数据库
      GF_DATABASE_URL: "mysql://root:root@www.zhengqingya.com:3306/grafana" # TODO 修改
    depends_on:
      - prometheus
    networks:
      prometheus:
        ipv4_address: 172.22.0.33

2、配置

配置需要监控的信息prometheus.yml

global:
  scrape_interval: 10s
  scrape_timeout: 10s
  evaluation_interval: 10m
scrape_configs:
  # springboot项目
  - job_name: spring-boot
    scrape_interval: 5s
    scrape_timeout: 5s
    metrics_path: /actuator/prometheus
    scheme: http
    basic_auth:
      username: admin
      password: 123456
    static_configs:
      - targets:
          - 192.168.3.61:16000 # TODO 此处填写SpringBoot应用的IP+端口号

  # prometheus
  - job_name: prometheus
    static_configs:
      - targets: ['prometheus:9090']
        labels:
          instance: prometheus

  # 采集node exporter监控数据,即linux
  - job_name: linux
    static_configs:
      - targets: ['node-exporter:9100']
        labels:
          instance: localhost

3、访问测试

访问prometheus,默认端口没有修改,以及我们的容器地址对外映射的端口是9000。

访问后,我们最关心的是,我们要监控的信息列表在哪里。

此时可以在这里路径下访问:Status---Target

访问地址

http://192.168.3.230:9090/

访问后,就是我们配置的监控列表信息。只有服务连接成功时,状态才是UP。

访问UI配置界面:http://IP:端口

http://192.168.3.230:3000/

进入主页后,信息如此。

此时我们首先需要做的事情是配置数据源。

数据源可以是多样的,目前我们信息数据来自prometheus,所以数据源选择这个。

添加数据,填写prometheus地址url

拉到最下方,选择save and test,如果出现如图的 data source is working 说明数据源添加成功

grafana看板配置:

选择导入模版,目前我们使用的模版是jvm模版

https://grafana.com/grafana/dashboards/4701-jvm-micrometer/

引入模版

 加载成功后,选择数据源,最后点击import

点击import后,得到如下图信息。