我试着在Docker(Podman)中在10分钟内搭建了Prometheus和Grafana

环境

Ubuntu 18.04.4 LTS
Podman 1.9.2
Podman-Compose 0.1.5
Ubuntu 18.04.4长期支持版
Podman 1.9.2
Podman-Compose 0.1.5

参考网站

    https://qiita.com/ryuichi1208/items/caf2d32b7a49ce5a39b1

安装Podman

请参考链接来安装Podman。

方式或步驟

创建prometheus.yml文件

$ mkdir prometheus-data

在 Prometheus 数据的子目录下创建以下内容。

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']

创作一个docker-compose.yml文件。

由于Prometheus和Grafana的映像已经发布,所以建立它们非常轻松。

version: '2'
services:
  prometheus:
    image: prom/prometheus
    volumes:
      - ./prometheus-data/prometheus.yml:/etc/prometheus/prometheus.yml
    ports:
      - '9091:9090'
  grafana:
    image: grafana/grafana
    ports:
      - "3000:3000"

制作完成后,上载。

sudo podman-compose up -d

连接到以下

スクリーンショット 2020-06-23 21.48.10.png

我希望能够尝试一下看看这是什么东西。

谢谢

非常感谢您让我参考 @ryuichi1208 先生的网站。

bannerAds