Skip to content

Grafana チートシート

メトリクスのためのオープンソース分析・可視化プラットフォーム。

01

はじめに

データソース

Grafana は多くのデータソースに対応しています。

grafana
Prometheus, InfluxDB, Elasticsearch, MySQL, PostgreSQL, Loki, Jaeger

ダッシュボード JSON

ダッシュボードは JSON としてシリアライズできます。

grafana
{
  "panels": [{
    "type": "graph",
    "title": "CPU Usage",
    "datasource": "Prometheus",
    "targets": [{ "expr": "rate(cpu_seconds[5m])" }]
  }]
}
02

主な機能

変数

ダッシュボード変数で動的なフィルタリングができます。

grafana
query: label_values(node_uname_info, job)

アノテーション

アノテーションでグラフ上にイベントを記録します。

grafana
{
  "name": "Deploys",
  "datasource": "Prometheus",
  "expr": "changes(deploy_total[1m]) > 0"
}

アラート

通知チャネルと組み合わせたアラート機能。

grafana
- Rule: avg(rate(http_requests[5m])) > 100
- For: 10m
- Notification: Slack #alerts

Was this helpful?