ops-monitor について
ops-monitorは、Datadog、New Relic、OpenTelemetryのバックエンドを確認する監視運用向けスキルです。設定、ヘルスとアラートの集約、バックエンドの絞り込み、定期ポーリングに対応します。
主な機能
- 01監視バックエンドの認証情報設定
- 02ヘルス状態とアラートの確認
- 03バックエンド別の結果表示
- 0460秒ごとのアラート変化確認
活用シーン
- 01複数の監視バックエンドの状態確認
- 02新規・解決済みアラートの追跡
- 03監視接続の設定と検証
インストール
コマンドをコピーしてターミナルで実行します。
npx skills add https:/ / github.com/ davepoon/ buildwithclaude --skill ops-monitorインストール後、Claude Code で/ops-monitorを入力して読み込まれたか確認します。
詳細
ランタイムコンテキスト
PREFS="${CLAUDE_PLUGIN_DATA_DIR:-$HOME/.claude/plugins/data/ops-ops-marketplace}/preferences.json"
DD_API_KEY=$(jq -r '.datadog_api_key // empty' "$PREFS" 2>/dev/null)
NR_API_KEY=$(jq -r '.newrelic_api_key // empty' "$PREFS" 2>/dev/null)
OTEL_ENDPOINT=$(jq -r '.otel_endpoint // empty' "$PREFS" 2>/dev/null)
$ARGUMENTS のモードを判定します:
--setupを含む → セットアップフローを実行--watchを含む → 監視モードを実行- それ以外 → デフォルトのヘルスチェックを実行
OPS ► MONITOR
セットアップフロー(--setup)
設定するバックエンドを尋ねます:
Which monitoring backends would you like to configure?
[Datadog] [New Relic] [OpenTelemetry] [All three]
選択したバックエンドごとに、AskUserQuestion の自由入力を使って認証情報を収集します(1回につき1つ、呼び出しあたり最大4項目):
Datadog:
datadog_api_key— app.datadoghq.com/organization-settings/api-keys にある API Keydatadog_app_key— app.datadoghq.com/organization-settings/application-keys にある Application Key
New Relic:
newrelic_api_key— one.newrelic.com/api-keys にある User API Keynewrelic_account_id— New Relic 管理ポータルにある数値の Account ID
OpenTelemetry:
otel_endpoint— OTEL 互換バックエンドのベース URL(例:https://otlp.grafana.net)
各認証情報を、アトミックな一時ファイルの入れ替えを使って preferences.json に書き込みます:
tmp=$(mktemp)
jq --arg k "$KEY" --arg v "$VALUE" '.[$k] = $v' "$PREFS" > "$tmp" && mv "$tmp" "$PREFS"
保存後にスモークテストを実行します:
- Datadog:
curl -sf -H "DD-API-KEY: $DD_API_KEY" -H "DD-APPLICATION-KEY: $DD_APP_KEY" "https://api.datadoghq.com/api/v1/validate"→{"valid": true}が返ることを確認 - New Relic:
curl -sf -H "Api-Key: $NR_API_KEY" "https://api.newrelic.com/graphql" -d '{"query":"{ actor { user { name } } }"}'→data.actor.userが返ることを確認 - OTEL:
curl -sf "$OTEL_ENDPOINT/healthz"→ HTTP 200 が返ることを確認
各バックエンドのステータスを ✅ または ❌ で報告します。
Agent Teams のサポート
CLAUDE_CODE_EXPERIMENTAL_AGENT_TEAMS=1 が設定されている場合、複数のバックエンドを同時に照会するときは Agent Teams を使用します。これにより、次のことが可能になります:
- バックエンドのプローブを共有コンテキストで並列実行できます(例:Datadog エージェントがレイテンシの急増を検出すると、OTEL エージェントがトレースとの相関を確認できます)
- 「まず Datadog アラートに注目し、その後 New Relic と相互参照する」といった指示ができます
- リアルタイムで進捗を確認できます:結果が届くたびに、エージェントがバックエンドごとに報告します
チームのセットアップ(フラグが有効で、複数のバックエンドが設定されている場合のみ):
TeamCreate("monitor-probes")
Agent(team_name="monitor-probes", name="datadog-probe", subagent_type="ops:monitor-agent", ...)
Agent(team_name="monitor-probes", name="newrelic-probe", subagent_type="ops:monitor-agent", ...)
Agent(team_name="monitor-probes", name="otel-probe", subagent_type="ops:monitor-agent", ...)
フラグが設定されていない場合、またはバックエンドが1つしか設定されていない場合は、単一の monitor-agent サブエージェントを使用します。
デフォルトのヘルスチェック(フラグなし)
Agent ツール経由で monitor-agent を起動します。結果を整形されたダッシュボードとして表示します:
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
OPS ► MONITOR [<timestamp>]
━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
DATADOG ✅ healthy (0 alerts)
NEW RELIC 🔴 2 critical entities
OTEL ✅ healthy
──────────────────────────────────────────────────────
Total alerts: 2 Severity: CRITICAL
ステータスアイコン:
✅— 正常(アラートなし/設定済みで到達可能)⚠️— 警告(警告レベルのアラートあり)🔴— 重大(重大なアラート、または到達不能)⬜— 未設定
各アラートまたは重大なエンティティについて、サービス名、アラート名、該当するダッシュボードへのリンクを表示します。
バックエンドが1つも設定されていない場合は、セットアップを促すメッセージを表示します:
No monitoring backends configured. Run /ops:monitor --setup to add Datadog, New Relic, or OTEL.
監視モード(--watch)
60秒ごとにポーリングします。各ポーリング時に:
while true; do
RESULT=$(# spawn monitor-agent and capture JSON output)
# Diff against previous tick
# Print: timestamp, changed items only
# 🆕 new alert: <name>
# ✅ resolved: <name>
sleep 60
done
Ctrl-C で終了します。
--backend フィルター
--backend datadog|newrelic|otel が指定されている場合、そのバックエンドのみを照会して表示します。
CLI/API リファレンス
| バックエンド | 認証ヘッダー | ベース URL | ヘルスエンドポイント |
|---|---|---|---|
| Datadog | DD-API-KEY: $key + DD-APPLICATION-KEY: $app_key | https://api.datadoghq.com | /api/v1/validate |
| New Relic | Api-Key: $key | https://api.newrelic.com/graphql | POST GraphQL クエリ |
| OTEL | バックエンドによって異なります | $OTEL_ENDPOINT | /healthz |
# Datadog — active alerts
curl -sf \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" \
"https://api.datadoghq.com/api/v1/monitor?monitor_tags=*&with_downtimes=false" \
| jq '[.[] | select(.overall_state == "Alert" or .overall_state == "Warn")]'
# New Relic — critical entities (GraphQL)
curl -sf \
-H "Api-Key: ${NR_API_KEY}" \
-H "Content-Type: application/json" \
-d '{"query":"{ actor { entitySearch(queryBuilder: {alertSeverity: CRITICAL}) { results { entities { name alertSeverity entityType } } } } }"}' \
"https://api.newrelic.com/graphql"
# OTEL — health check
curl -sf "${OTEL_ENDPOINT}/healthz"