grafana-dashboards について
アプリケーション、インフラ、ビジネス指標向けの Grafana ダッシュボードを設計・管理するスキルです。パネル構成、監視パターン、変数、プロビジョニングを扱い、対象 Grafana バージョンでの検証も促します。
主な機能
- 01ダッシュボード設計ガイド
- 02RED・USE監視パターン
- 03パネルと変数の例
- 04TerraformまたはAnsibleによるプロビジョニング
- 05検証とデプロイの確認
活用シーン
- 01Prometheusメトリクスの可視化
- 02SLOまたはインフラダッシュボードの作成
- 03アプリケーションやビジネス指標の追跡
インストール
コマンドをコピーしてターミナルで実行します。
$
npx skills add https:/ / github.com/ sickn33/ agentic-awesome-skills --skill grafana-dashboardsインストール後、Claude Code で/grafana-dashboardsを入力して読み込まれたか確認します。
同梱ファイルreferences/dashboard-design.mdresources/implementation-playbook.md
詳細
Grafana ダッシュボード
包括的なシステム可観測性を実現する、本番環境ですぐに使える Grafana ダッシュボードを作成・管理します。
このスキルを使用しない場合
- タスクが Grafana ダッシュボードに関係しない場合
- このスコープ外の別のドメインやツールが必要な場合
手順
- 目標、制約、必要な入力を明確にします。
- 関連するベストプラクティスを適用し、結果を検証します。
- 実行可能な手順と検証方法を提示します。
- 詳細な例が必要な場合は、
resources/implementation-playbook.mdを開きます。
目的
アプリケーション、インフラストラクチャ、ビジネスメトリクスを監視するための、効果的な Grafana ダッシュボードを設計します。
このスキルを使用する場合
- Prometheus メトリクスを可視化する
- カスタムダッシュボードを作成する
- SLO ダッシュボードを実装する
- インフラストラクチャを監視する
- ビジネス KPI を追跡する
ダッシュボードの設計原則
1. 情報の階層
┌─────────────────────────────────────┐
│ Critical Metrics (Big Numbers) │
├─────────────────────────────────────┤
│ Key Trends (Time Series) │
├─────────────────────────────────────┤
│ Detailed Metrics (Tables/Heatmaps) │
└─────────────────────────────────────┘
2. RED メソッド(サービス)
- Rate - 1 秒あたりのリクエスト数
- Errors - エラー率
- Duration - レイテンシ/応答時間
3. USE メソッド(リソース)
- Utilization - リソースがビジー状態にある時間の割合
- Saturation - キューの長さ/待ち時間
- Errors - エラー数
ダッシュボードの構成
API 監視ダッシュボード
以下の JSON は、旧式のグラフパネルと埋め込みのアラートフィールドを使用しています。これはクエリの意図を示すものであり、移植可能な現行のプロビジョニング成果物ではありません。対象の Grafana バージョンからサポートされているパネル JSON をエクスポートし、サポートされているアラートインターフェースを通じてアラートルールを別途設定してください。トラフィックが欠落またはゼロの場合をテストし、デプロイ前にデータソース UID を検証してください。
{
"dashboard": {
"title": "API Monitoring",
"tags": ["api", "production"],
"timezone": "browser",
"refresh": "30s",
"panels": [
{
"title": "Request Rate",
"type": "graph",
"targets": [
{
"expr": "sum(rate(http_requests_total[5m])) by (service)",
"legendFormat": "{{service}}"
}
],
"gridPos": {"x": 0, "y": 0, "w": 12, "h": 8}
},
{
"title": "Error Rate %",
"type": "graph",
"targets": [
{
"expr": "(sum(rate(http_requests_total{status=~\"5..\"}[5m])) / sum(rate(http_requests_total[5m]))) * 100",
"legendFormat": "Error Rate"
}
],
"alert": {
"conditions": [
{
"evaluator": {"params": [5], "type": "gt"},
"operator": {"type": "and"},
"query": {"params": ["A", "5m", "now"]},
"type": "query"
}
]
},
"gridPos": {"x": 12, "y": 0, "w": 12, "h": 8}
},
{
"title": "P95 Latency",
"type": "graph",
"targets": [
{
"expr": "histogram_quantile(0.95, sum(rate(http_request_duration_seconds_bucket[5m])) by (le, service))",
"legendFormat": "{{service}}"
}
],
"gridPos": {"x": 0, "y": 8, "w": 24, "h": 8}
}
]
}
}
参考: インラインの例を参照してください。
パネルの種類
1. スタットパネル(単一の値)
{
"type": "stat",
"title": "Total Requests",
"targets": [{
"expr": "sum(http_requests_total)"
}],
"options": {
"reduceOptions": {
"values": false,
"calcs": ["lastNotNull"]
},
"orientation": "auto",
"textMode": "auto",
"colorMode": "value"
},
"fieldConfig": {
"defaults": {
"thresholds": {
"mode": "absolute",
"steps": [
{"value": 0, "color": "green"},
{"value": 80, "color": "yellow"},
{"value": 90, "color": "red"}
]
}
}
}
}
2. 時系列グラフ
{
"type": "graph",
"title": "CPU Usage",
"targets": [{
"expr": "100 - (avg by (instance) (rate(node_cpu_seconds_total{mode=\"idle\"}[5m])) * 100)"
}],
"yaxes": [
{"format": "percent", "max": 100, "min": 0},
{"format": "short"}
]
}
3. テーブルパネル
{
"type": "table",
"title": "Service Status",
"targets": [{
"expr": "up",
"format": "table",
"instant": true
}],
"transformations": [
{
"id": "organize",
"options": {
"excludeByName": {"Time": true},
"indexByName": {},
"renameByName": {
"instance": "Instance",
"job": "Service",
"Value": "Status"
}
}
}
]
}
4. ヒートマップ
{
"type": "heatmap",
"title": "Latency Heatmap",
"targets": [{
"expr": "sum(rate(http_request_duration_seconds_bucket[5m])) by (le)",
"format": "heatmap"
}],
"dataFormat": "tsbuckets",
"yAxis": {
"format": "s"
}
}
変数
クエリ変数
{
"templating": {
"list": [
{
"name": "namespace",
"type": "query",
"datasource": "Prometheus",
"query": "label_values(kube_pod_info, namespace)",
"refresh": 1,
"multi": false
},
{
"name": "service",
"type": "query",
"datasource": "Prometheus",
"query": "label_values(kube_service_info{namespace=\"$namespace\"}, service)",
"refresh": 1,
"multi": true
}
]
}
}
クエリで変数を使用する
sum(rate(http_requests_total{namespace="$namespace", service=~"$service"}[5m]))
ダッシュボードのアラート
{
"alert": {
"name": "High Error Rate",
"conditions": [
{
"evaluator": {
"params": [5],
"type": "gt"
},
"operator": {"type": "and"},
"query": {
"params": ["A", "5m", "now"]
},
"reducer": {"type": "avg"},
"type": "query"
}
],
"executionErrorState": "alerting",
"for": "5m",
"frequency": "1m",
"message": "Error rate is above 5%",
"noDataState": "no_data",
"notifications": [
{"uid": "slack-channel"}
]
}
}
ダッシュボードのプロビジョニング
dashboards.yml:
apiVersion: 1
providers:
- name: 'default'
orgId: 1
folder: 'General'
type: file
disableDeletion: false
updateIntervalSeconds: 10
allowUiUpdates: true
options:
path: /etc/grafana/dashboards
一般的なダッシュボードのパターン
インフラストラクチャダッシュボード
主要なパネル:
- ノードごとの CPU 使用率
- ノードごとのメモリ使用量
- ディスク I/O
- ネットワークトラフィック
- 名前空間ごとの Pod 数
- ノードのステータス
参考: インラインの例を参照してください。
データベースダッシュボード
主要なパネル:
- 1 秒あたりのクエリ数
- コネクションプールの使用状況
- クエリレイテンシ(P50、P95、P99)
- アクティブな接続数
- データベースのサイズ
- レプリケーション遅延
- 低速なクエリ
参考: インラインの例を参照してください。
アプリケーションダッシュボード
主要なパネル:
- リクエスト率
- エラー率
- 応答時間(パーセンタイル)
- アクティブなユーザー/セッション数
- キャッシュヒット率
- キューの長さ
ベストプラクティス
- テンプレートから始める(Grafana コミュニティダッシュボード)
- パネルと変数には一貫した命名規則を使う
- 関連するメトリクスを行ごとにグループ化する
- 適切な時間範囲を設定する(デフォルト:過去 6 時間)
- 柔軟性を高めるために変数を使う
- 背景情報を示すパネルの説明を追加する
- 単位を正しく設定する
- 色分けには意味のあるしきい値を設定する
- ダッシュボード間で一貫した色を使う
- 異なる時間範囲でテストする
コードとしてのダッシュボード
Terraform によるプロビジョニング
resource "grafana_dashboard" "api_monitoring" {
config_json = file("${path.module}/dashboards/api-monitoring.json")
folder = grafana_folder.monitoring.id
}
resource "grafana_folder" "monitoring" {
title = "Production Monitoring"
}
Ansible によるプロビジョニング
- name: Deploy Grafana dashboards
copy:
src: "{{ item }}"
dest: /etc/grafana/dashboards/
with_fileglob:
- "dashboards/*.json"
notify: restart grafana
参考ファイル
- インラインの例 - API 監視ダッシュボード
- インラインの例 - インフラストラクチャダッシュボード
- インラインの例 - データベース監視ダッシュボード
references/dashboard-design.md- ダッシュボード設計ガイド
関連スキル
prometheus-configuration- メトリクス収集用slo-implementation- SLO ダッシュボード用
制限事項
- 上記で説明したスコープにタスクが明確に該当する場合にのみ、このスキルを使用してください。
- 出力を、環境固有の検証、テスト、専門家によるレビューの代替として扱わないでください。
- 必要な入力、権限、安全上の境界、または成功基準が不足している場合は、作業を中断して確認してください。
コメント
Markdown 対応