Quantcast
Channel: Bashタグが付けられた新着記事 - Qiita
Viewing all articles
Browse latest Browse all 2869

grafanaとpostgresを連携してみた【docker-compose】

$
0
0

起動方法

git clone https://github.com/guedim/grafana-postgres.git
docker-compose up -d

grafanaへログイン

ブラウザから http://localhost:3000/へアクセス
user : admin
password: foobar
でログインする。
(grafana-postgres/grafana/dashboard/post.sh にて設定してある)

grafanaのGUIでの設定方法

Add data sourceを押して、postgresを設定する
一番難しいところが以下の設定場所。Host名がlocalhost:5432ではなくて、postgres:5432に設定する

grafana_postres_setting.png
入力後、Save & Testを押してDatabase Connection OKが出れば連携完了。

テーブルを可視化

dashboard > table > edit でsql文を書ける画面が出てくる。
https://github.com/guedim/grafana-postgres.gitには元々データが入っているので、そのデータを表示した。
tableのeditを選んでsql文を書いた.png

postgres のデータをみる

docker-compose exec postgres bash
su postgres
psql
\d#テーブル一覧表示\l#database一覧を表示\d account_metrics #カラム一覧を表示 カラムなのでデータベースを指定してから \q#exit

Viewing all articles
Browse latest Browse all 2869

Trending Articles