mcpField
M
monitor

monitor

github.com/permawebクラウド・DevOps445 回インストール35 週間前に更新
リポジトリ

monitor について

AO Monitor CLIは、AO Task Monitorサービスを照会するNode.js製コマンドラインツールです。AOプロセスの監視やタスクの問題調査に向けて、システム概要、タスク指標、アラート、条件指定可能な実行ログを提供します。

主な機能

  1. 01システムとタスクの指標取得
  2. 02現在のアラート表示
  3. 03実行ログの絞り込みとページング
  4. 04JSONまたはテキスト出力
  5. 05汎用APIリクエスト

活用シーン

  1. 01AOタスクの稼働状況確認
  2. 02失敗やタイムアウトした実行の調査
  3. 03特定タスクの指標とログの確認

インストール

コマンドをコピーしてターミナルで実行します。

$npx skills add https://github.com/permaweb/skills --skill monitor

インストール後、Claude Code で/monitorを入力して読み込まれたか確認します。

同梱ファイルindex.mjs

詳細

AO Monitor CLI

AO Task Monitor サービス用の Node.js コマンドラインインターフェースです。システムの健全性を確認し、アラートを表示し、ログを分析して、AO プロセスのパフォーマンスを監視できます。

概要

  • 場所: skills/monitor/index.mjs
  • ランタイム: Node.js 18+
  • 依存関係: なし(組み込みの fetch を使用)
  • デフォルト API: https://ao-task-monitor.onrender.com

使用するタイミング

次のような場合に、この CLI を使用してください。

  • AO プロセスの健全性とパフォーマンスを監視する
  • システムアラートや失敗したタスクを確認する
  • 実行ログを表示およびフィルタリングする
  • タスクのメトリクスと成功率を分析する
  • AO プロセスの問題をトラブルシューティングする
  • AO プロセスのステータスをすばやく確認する

認証の設定

この CLI を使用するには、環境変数で API キーを設定する必要があります。

API キーを取得する

AO Task Monitor サービスの管理者に連絡して、API キーを取得してください。

環境を設定する

zsh の場合(~/.zshrc):

# Add to ~/.zshrc
export AO_MONITOR_KEY="YOUR_KEY_HERE"

# Reload
source ~/.zshrc

bash の場合(~/.bashrc):

# Add to ~/.bashrc
export AO_MONITOR_KEY="YOUR_KEY_HERE"

# Reload
source ~/.bashrc

一時的な設定(現在のセッションのみ):

export AO_MONITOR_KEY="YOUR_KEY_HERE"

コマンドごとの上書き:

node skills/monitor/index.mjs summary --token "YOUR_KEY_HERE"

コマンド

summary

監視対象のすべてのタスクについて、システム全体の概要を取得します。

node skills/monitor/index.mjs summary

オプション:

  • --period <1h|4h|8h|24h|48h> - メトリクスの時間範囲
  • --include <csv> - 含めるフィールド(例:counts,kpis,latency)
  • --format <json|text> - レスポンス形式(デフォルト:json)

例:

# Default summary
node skills/monitor/index.mjs summary

# Last 24 hours, text format
node skills/monitor/index.mjs summary --period 24h --format text

# Only counts and KPIs
node skills/monitor/index.mjs summary --include counts,kpis
task

特定のタスクの詳細なメトリクスを取得します。

node skills/monitor/index.mjs task <taskId>

オプション:

  • --period <1h|4h|8h|24h|48h> - メトリクスの時間範囲
  • --include <csv> - 含めるフィールド
  • --format <json|text> - レスポンス形式

例:

# Get ao-token-info task details
node skills/monitor/index.mjs task ao-token-info

# With 48-hour window and text output
node skills/monitor/index.mjs task ao-token-info --period 48h --format text
alerts

現在のシステムアラートと問題を表示します。

node skills/monitor/index.mjs alerts

オプション:

  • --period <1h|4h|8h|24h|48h> - アラートの時間範囲
  • --format <json|text> - レスポンス形式

例:

# Current alerts
node skills/monitor/index.mjs alerts

# Last 4 hours, text format
node skills/monitor/index.mjs alerts --period 4h --format text
logs

実行ログを表示します。必要に応じてタスクでフィルタリングできます。

# All logs
node skills/monitor/index.mjs logs

# Task-specific logs
node skills/monitor/index.mjs logs <taskId>

オプション:

  • --limit <n> - 最大結果数(デフォルト:100、最大:1000)
  • --offset <n> - ページネーションのオフセット
  • --status <success|failure|timeout> - 実行ステータスでフィルタリング
  • --error-type <string> - エラーメッセージの部分文字列でフィルタリング
  • --since <isoTimestamp> - この時刻より後のログ
  • --until <isoTimestamp> - この時刻より前のログ
  • --task-id <taskId> - タスク ID でフィルタリング(位置引数の代わりに使用)

例:

# Recent logs
node skills/monitor/index.mjs logs

# Task-specific logs
node skills/monitor/index.mjs logs ao-token-info

# Failed executions only
node skills/monitor/index.mjs logs --status failure

# Logs with 503 errors
node skills/monitor/index.mjs logs --error-type 503

# Last 50 logs since yesterday
node skills/monitor/index.mjs logs --limit 50 --since 2024-01-01T00:00:00Z

# Paginated results
node skills/monitor/index.mjs logs --limit 100 --offset 100
docs

サーバーから API ドキュメントを取得します。

node skills/monitor/index.mjs docs
request

ほかのコマンドでカバーされないエンドポイントに対して、汎用 API リクエストを送信します。

node skills/monitor/index.mjs request <endpoint> <method> [body]

引数:

  • endpoint - API パス(例:/v1/summary)
  • method - HTTP メソッド(GET、POST、PUT、DELETE)
  • body - POST/PUT リクエスト用の JSON ボディ(省略可能)

例:

# GET request
node skills/monitor/index.mjs request /v1/summary GET

# GET with query params
node skills/monitor/index.mjs request "/v1/summary?format=text" GET

# POST with JSON body
node skills/monitor/index.mjs request /v1/api/agent POST '{"task_id":"123","status":"running"}'

# PUT request
node skills/monitor/index.mjs request /v1/api/agent/456 PUT '{"name":"Updated Agent"}'

グローバルオプション

以下のオプションはすべてのコマンドで使用できます。

オプション説明
--base-url <url>API のベース URL を上書きします
--token <token>認証トークンを上書きします(AO_MONITOR_KEY の代わりに使用)
--timeout-ms <ms>リクエストのタイムアウト(ミリ秒、デフォルト:30000)
--help, -hヘルプメッセージを表示します

例:

# Use different API server
node skills/monitor/index.mjs summary --base-url https://my-monitor.example.com

# Override token for single request
node skills/monitor/index.mjs alerts --token "different_key"

# Longer timeout for slow connections
node skills/monitor/index.mjs logs --timeout-ms 60000

クエリパラメーターのリファレンス

summary、task、alerts の場合
パラメーター値説明
--period1h、4h、8h、24h、48hメトリクスの時間範囲
--includeフィールドの CSVレスポンスに含めるフィールド
--formatjson、textレスポンス形式

include フィールドのオプション:

  • counts - 実行回数
  • kpis - 重要業績評価指標
  • latency - 応答時間のメトリクス
logs の場合
パラメーター型説明
--limit整数最大結果数(1~1000、デフォルト:100)
--offset整数ページネーションのオフセット
--status文字列success、failure、または timeout
--error-type文字列エラーの部分文字列でフィルタリング
--sinceISO タイムスタンプこの時刻より後のログ
--untilISO タイムスタンプこの時刻より前のログ
--task-id文字列タスク ID でフィルタリング

よくある使用例

システムの健全性を確認する
# Quick overview
node skills/monitor/index.mjs summary --format text

# Check for any alerts
node skills/monitor/index.mjs alerts
タスクの失敗を調査する
# See if task has issues
node skills/monitor/index.mjs task ao-token-info --period 24h

# Get recent failures
node skills/monitor/index.mjs logs ao-token-info --status failure --limit 20

# Search for specific error
node skills/monitor/index.mjs logs --error-type "503" --limit 50
最近のアクティビティを表示する
# Last 100 logs
node skills/monitor/index.mjs logs

# Last hour of logs
node skills/monitor/index.mjs logs --since "$(date -u -v-1H +%Y-%m-%dT%H:%M:%SZ)"

# Successful runs only
node skills/monitor/index.mjs logs --status success --limit 50
特定のタスクを監視する
# Task metrics
node skills/monitor/index.mjs task ao-token-info --include counts,kpis,latency

# Task logs
node skills/monitor/index.mjs logs ao-token-info --limit 50
タイムアウトをデバッグする
# Find timeout issues
node skills/monitor/index.mjs logs --status timeout

# Check latency metrics
node skills/monitor/index.mjs summary --include latency

エラー処理

認証情報がない場合

AO_MONITOR_KEY が設定されておらず、--token も指定されていない場合:

Error: No authentication token provided.

Set the AO_MONITOR_KEY environment variable:
  export AO_MONITOR_KEY="your_key_here"

Or use the --token flag:
  node skills/monitor/index.mjs summary --token "your_key_here"
認証エラー

401 Unauthorized または 403 Forbidden:

  • AO_MONITOR_KEY が正しいことを確認してください
  • キーの有効期限が切れていないか確認してください
  • キーが要求されたリソースにアクセスできることを確認してください
API エラー

2xx 以外のレスポンスには、以下が表示されます:

  • HTTP ステータスコード
  • サーバーからのエラーメッセージ
Error: Request failed with status 404
Not Found: Task 'invalid-task' does not exist
ネットワーク/タイムアウトエラー
  • デフォルトのタイムアウトは 30 秒です
  • 接続が遅い場合は --timeout-ms で延長してください
  • リクエストに失敗する場合は、ネットワーク接続を確認してください

使用例の早見表

# System overview
node skills/monitor/index.mjs summary

# Text format summary
node skills/monitor/index.mjs summary --format text

# Last 24h summary
node skills/monitor/index.mjs summary --period 24h

# Check alerts
node skills/monitor/index.mjs alerts

# Task details
node skills/monitor/index.mjs task ao-token-info

# Recent logs
node skills/monitor/index.mjs logs

# Task logs
node skills/monitor/index.mjs logs ao-token-info

# Failed runs
node skills/monitor/index.mjs logs --status failure

# Search errors
node skills/monitor/index.mjs logs --error-type "503"

# API docs
node skills/monitor/index.mjs docs

# Custom request
node skills/monitor/index.mjs request /v1/summary GET

コメント