LoginSignup
2
2

More than 3 years have passed since last update.

prometheus, grafanaでいい感じに監視を可視化する

Posted at

概要

prometheusと呼ばれる監視ツールと、grafanaというグラフなどを GUIのデータで可視化してくれるフレームワークを利用して、サーバーの監視を行います。

環境構築

基本的にdockerをフル活用します。

docker-compose.yml
version: '3'
services:
  prometheus:
    image: prom/prometheus
    container_name: prometheus
    volumes:
      - /var/app/prometheus/prometheus.yml:/etc/prometheus/prometheus.yml
    ports:
      - 9090:9090
  grafana:
    image: grafana/grafana
    container_name: grafana
    ports:
      - 3000:3000
    env_file:
      - /var/app/prometheus/grafana.env

prometheus

※ golangが必要
方法1: ソースからビルド
注: 少し時間かかる

$ mkdir -p $GOPATH/src/github.com/prometheus
$ cd $GOPATH/src/github.com/prometheus
$ git clone https://github.com/prometheus/prometheus.git
$ cd prometheus
$ make build
$ ./prometheus -config.file=your_config.yml

方法2: 公式からダウンロード
こちらからbuild済みのバイナリーをダウンロードすることも可能です。
https://prometheus.io/download/

$ cd prometheus-2.14.0.darwin-amd64  #macの場合
$ ./prometheus -config.file=your_config.yml

使う時は、your_config.ymlの部分書き換えていきます。



grafana

公式のdocker imageが公開されているので、そちらを使うのが一番楽チンです。

$ docker run -d -p 3000:3000 grafana/grafana

参考

2
2
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
2
2