云海的博客
首页
  • 接口
  • 数组
  • slice
  • map
  • 指针
  • 反射
  • Context
  • sync.map
  • 锁
  • 类型和类型指针分析
  • recover
  • 从零实现RPC框架
  • make和new区别
  • channel
  • sync.Once
  • sync.Pool
  • protobuf
  • MongoDB pkg源码-findone
  • MyBatis
  • Maven
  • 解析Laravel框架—路由处理
  • PHP(客户端)与 Golang(服务端)使用grpc+protobuf 通信
  • JAVA(客户端)与 Golang(服务端) 使用grpc+protobuf通信
  • Docker使用笔记-常用命令
  • Docker使用笔记-容器间通讯
  • Docker使用笔记-搭建Redis集群
  • Docker使用笔记-镜像多阶段构建
  • Kubernetes部署golang服务
  • Linux常用命令
  • Docker安装Prometheus与Grafana
  • Protobuf
  • TCP抓包
  • 概述-《TCP/IP详解》读书笔记
  • 索引
  • 事务隔离级别
  • 常识
  • 每日一题(1)
  • 每日一题(2)
  • 每日一题(3)
  • 每日一题(4)
关于
GitHub (opens new window)

云海

服务端研发
首页
  • 接口
  • 数组
  • slice
  • map
  • 指针
  • 反射
  • Context
  • sync.map
  • 锁
  • 类型和类型指针分析
  • recover
  • 从零实现RPC框架
  • make和new区别
  • channel
  • sync.Once
  • sync.Pool
  • protobuf
  • MongoDB pkg源码-findone
  • MyBatis
  • Maven
  • 解析Laravel框架—路由处理
  • PHP(客户端)与 Golang(服务端)使用grpc+protobuf 通信
  • JAVA(客户端)与 Golang(服务端) 使用grpc+protobuf通信
  • Docker使用笔记-常用命令
  • Docker使用笔记-容器间通讯
  • Docker使用笔记-搭建Redis集群
  • Docker使用笔记-镜像多阶段构建
  • Kubernetes部署golang服务
  • Linux常用命令
  • Docker安装Prometheus与Grafana
  • Protobuf
  • TCP抓包
  • 概述-《TCP/IP详解》读书笔记
  • 索引
  • 事务隔离级别
  • 常识
  • 每日一题(1)
  • 每日一题(2)
  • 每日一题(3)
  • 每日一题(4)
关于
GitHub (opens new window)
  • Docker使用笔记-常用命令
  • Docker使用笔记-镜像多阶段构建
  • Docker使用笔记-搭建Redis集群
  • Docker使用笔记-容器间通讯
  • Kubernetes部署golang服务
  • Linux命令
  • 网关浅析
  • Nginx配置
  • Protobuf
  • Docker安装Prometheus与Grafana
  • EFK日志收集系统单机版
  • 微服务
云海
2023-06-12

Docker安装Prometheus与Grafana

# 概述

本文记录,使用docker在Linux机器,安装Prometheus与Grafana。

# 正文

  • 1.新建prometheus.yml文件,内容如下
global:
  scrape_interval:     15s # By default, scrape targets every 15 seconds.

  # Attach these labels to any time series or alerts when communicating with
  # external systems (federation, remote storage, Alertmanager).
  external_labels:
    monitor: 'codelab-monitor'

# A scrape configuration containing exactly one endpoint to scrape:
# Here it's Prometheus itself.
scrape_configs:
  # The job name is added as a label `job=<job_name>` to any timeseries scraped from this config.
  - job_name: 'prometheus'

    # Override the global default and scrape targets from this job every 5 seconds.
    scrape_interval: 5s

    static_configs:
            - targets: ['localhost:9090','192.168.31.162:9100']
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
  • 2.启动prometheus容器
docker run --name=prometheus -d -p 9090:9090 
-v /data/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml 
-v /data/prometheus/rules.yml:/etc/prometheus/rules.yml prom/prometheus 
--config.file=/etc/prometheus/prometheus.yml 
--web.enable-lifecycle
1
2
3
4
5
//重载配置文件命令
curl -X POST http://localhost:9090/-/reload
1
2
  • 3.收集Linux信息
docker run -d -p 9100:9100 \
  -v "/proc:/host/proc:ro" \
  -v "/sys:/host/sys:ro" \
  -v "/:/rootfs:ro" \
  prom/node-exporter
1
2
3
4
5
  • 4.启动Grafana
 docker run -d -p 3001:3000 --name grafana grafana/grafana
1
  • 5.配置模版信息

https://grafana.com/grafana/dashboards/11074

上次更新: 2023/10/07
Protobuf
EFK日志收集系统单机版

← Protobuf EFK日志收集系统单机版→

最近更新
01
函数
04-11
02
面试题
04-11
03
EFK日志收集系统单机版
08-18
更多文章>
Theme by Vdoing | Copyright © 2022-2025 Evan Xu | MIT License
  • 跟随系统
  • 浅色模式
  • 深色模式
  • 阅读模式