1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

prometheusとgrafanaをdocker(podman)で10分で構築してみた。

Last updated at Posted at 2020-06-23

#環境
ubuntu 18.04.4 LTS
podman 1.9.2
podman-compose 0.1.5
#参考サイト

#podmanインストール
podmanインストールはリンクを参照

#手順

##1.prometheus.ymlを作成

$ mkdir prometheus-data

prometheus-dataの配下に以下を作成

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

##2.docker-compose.ymlを作成

prometheusもgrafanaもイメージが公開されているので構築は楽ちんです。

docker-compose.yml
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"

作成後、upする。

sudo podman-compose up -d

以下に接続する

こんな感じの画面が表示されます。
スクリーンショット 2020-06-23 21.48.10.png

どんなもんか試していきたいと思います。

お礼

@ryuichi1208さんのサイトを参考にさせていただきました。ありがとうございました。

1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?