monitor

Compare original and translation side by side

🇺🇸

Original

English
🇨🇳

Translation

Chinese

AO Monitor CLI

AO Monitor CLI

A Node.js command-line interface for the AO Task Monitor service. Query system health, view alerts, analyze logs, and monitor AO process performance.
一款用于AO Task Monitor服务的Node.js命令行界面工具。可查询系统健康状态、查看告警信息、分析日志并监控AO进程的性能。

Overview

概述

  • Location:
    skills/monitor/index.mjs
  • Runtime: Node.js 18+
  • Dependencies: None (uses built-in fetch)
  • Default API:
    https://ao-task-monitor.onrender.com
  • 位置
    skills/monitor/index.mjs
  • 运行环境:Node.js 18及以上版本
  • 依赖项:无(使用内置的fetch)
  • 默认API地址
    https://ao-task-monitor.onrender.com

When to Use

使用场景

Use this CLI when you need to:
  • Monitor AO process health and performance
  • Check for system alerts or failing tasks
  • View and filter execution logs
  • Analyze task metrics and success rates
  • Troubleshoot AO process issues
  • Get quick status updates on AO processes
当你需要以下操作时,可使用该CLI工具:
  • 监控AO进程的健康状态与性能
  • 检查系统告警或失败任务
  • 查看并过滤执行日志
  • 分析任务指标与成功率
  • 排查AO进程相关问题
  • 获取AO进程的快速状态更新

Authentication Setup

认证设置

The CLI requires an API key set via environment variable.
该CLI工具需要通过环境变量设置API密钥。

Get Your API Key

获取API密钥

Contact the AO Task Monitor service administrator to obtain your API key.
联系AO Task Monitor服务管理员获取你的API密钥。

Configure Environment

配置环境

For zsh (~/.zshrc):
bash
undefined
适用于zsh(~/.zshrc):
bash
undefined

Add to ~/.zshrc

Add to ~/.zshrc

export AO_MONITOR_KEY="YOUR_KEY_HERE"
export AO_MONITOR_KEY="YOUR_KEY_HERE"

Reload

Reload

source ~/.zshrc

**For bash (~/.bashrc):**
```bash
source ~/.zshrc

**适用于bash(~/.bashrc):**
```bash

Add to ~/.bashrc

Add to ~/.bashrc

export AO_MONITOR_KEY="YOUR_KEY_HERE"
export AO_MONITOR_KEY="YOUR_KEY_HERE"

Reload

Reload

source ~/.bashrc

**Temporary (current session only):**
```bash
export AO_MONITOR_KEY="YOUR_KEY_HERE"
Per-command override:
bash
node skills/monitor/index.mjs summary --token "YOUR_KEY_HERE"
source ~/.bashrc

**临时配置(仅当前会话有效):**
```bash
export AO_MONITOR_KEY="YOUR_KEY_HERE"
单命令覆盖配置:
bash
node skills/monitor/index.mjs summary --token "YOUR_KEY_HERE"

Commands

命令说明

summary

summary(汇总信息)

Get a system-wide overview of all monitored tasks.
bash
node skills/monitor/index.mjs summary
Options:
  • --period <1h|4h|8h|24h|48h>
    - Time window for metrics
  • --include <csv>
    - Fields to include (e.g.,
    counts,kpis,latency
    )
  • --format <json|text>
    - Response format (default: json)
Examples:
bash
undefined
获取所有受监控任务的系统全局概览。
bash
node skills/monitor/index.mjs summary
可选参数:
  • --period <1h|4h|8h|24h|48h>
    - 指标统计的时间窗口
  • --include <csv>
    - 要包含的字段(例如:
    counts,kpis,latency
  • --format <json|text>
    - 响应格式(默认:json)
示例:
bash
undefined

Default summary

默认汇总信息

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

Last 24 hours, text format

过去24小时的汇总,文本格式

node skills/monitor/index.mjs summary --period 24h --format text
node skills/monitor/index.mjs summary --period 24h --format text

Only counts and KPIs

仅包含统计数和关键绩效指标

node skills/monitor/index.mjs summary --include counts,kpis
undefined
node skills/monitor/index.mjs summary --include counts,kpis
undefined

task

task(任务详情)

Get detailed metrics for a specific task.
bash
node skills/monitor/index.mjs task <taskId>
Options:
  • --period <1h|4h|8h|24h|48h>
    - Time window for metrics
  • --include <csv>
    - Fields to include
  • --format <json|text>
    - Response format
Examples:
bash
undefined
获取特定任务的详细指标。
bash
node skills/monitor/index.mjs task <taskId>
可选参数:
  • --period <1h|4h|8h|24h|48h>
    - 指标统计的时间窗口
  • --include <csv>
    - 要包含的字段
  • --format <json|text>
    - 响应格式
示例:
bash
undefined

Get ao-token-info task details

获取ao-token-info任务的详情

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

With 48-hour window and text output

过去48小时的任务详情,文本格式

node skills/monitor/index.mjs task ao-token-info --period 48h --format text
undefined
node skills/monitor/index.mjs task ao-token-info --period 48h --format text
undefined

alerts

alerts(告警信息)

View current system alerts and issues.
bash
node skills/monitor/index.mjs alerts
Options:
  • --period <1h|4h|8h|24h|48h>
    - Time window for alerts
  • --format <json|text>
    - Response format
Examples:
bash
undefined
查看当前系统的告警与问题。
bash
node skills/monitor/index.mjs alerts
可选参数:
  • --period <1h|4h|8h|24h|48h>
    - 告警统计的时间窗口
  • --format <json|text>
    - 响应格式
示例:
bash
undefined

Current alerts

当前告警信息

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

Last 4 hours, text format

过去4小时的告警,文本格式

node skills/monitor/index.mjs alerts --period 4h --format text
undefined
node skills/monitor/index.mjs alerts --period 4h --format text
undefined

logs

logs(日志查看)

View execution logs, optionally filtered by task.
bash
undefined
查看执行日志,可按任务筛选。
bash
undefined

All logs

所有日志

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

Task-specific logs

特定任务的日志

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

**Options:**
- `--limit <n>` - Maximum results (default: 100, max: 1000)
- `--offset <n>` - Pagination offset
- `--status <success|failure|timeout>` - Filter by execution status
- `--error-type <string>` - Filter by error message substring
- `--since <isoTimestamp>` - Logs after this time
- `--until <isoTimestamp>` - Logs before this time
- `--task-id <taskId>` - Filter by task ID (alternative to positional arg)

**Examples:**
```bash
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筛选(替代位置参数)

**示例:**
```bash

Recent logs

最新日志

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

Task-specific logs

特定任务的日志

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

Failed executions only

仅查看失败的执行日志

node skills/monitor/index.mjs logs --status failure
node skills/monitor/index.mjs logs --status failure

Logs with 503 errors

查看包含503错误的日志

node skills/monitor/index.mjs logs --error-type 503
node skills/monitor/index.mjs logs --error-type 503

Last 50 logs since yesterday

过去50条日志(从昨天开始)

node skills/monitor/index.mjs logs --limit 50 --since 2024-01-01T00:00:00Z
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
undefined
node skills/monitor/index.mjs logs --limit 100 --offset 100
undefined

docs

docs(文档查看)

Retrieve API documentation from the server.
bash
node skills/monitor/index.mjs docs
从服务器获取API文档。
bash
node skills/monitor/index.mjs docs

request

request(通用请求)

Make a generic API request for endpoints not covered by other commands.
bash
node skills/monitor/index.mjs request <endpoint> <method> [body]
Arguments:
  • endpoint
    - API path (e.g.,
    /v1/summary
    )
  • method
    - HTTP method (GET, POST, PUT, DELETE)
  • body
    - JSON body for POST/PUT requests (optional)
Examples:
bash
undefined
发送通用API请求,用于其他命令未覆盖的端点。
bash
node skills/monitor/index.mjs request <endpoint> <method> [body]
参数说明:
  • endpoint
    - API路径(例如:
    /v1/summary
  • method
    - HTTP方法(GET, POST, PUT, DELETE)
  • body
    - POST/PUT请求的JSON体(可选)
示例:
bash
undefined

GET request

GET请求

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

GET with query params

带查询参数的GET请求

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

POST with JSON body

带JSON体的POST请求

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

PUT request

PUT请求

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

Global Options

全局可选参数

These options work with all commands:
OptionDescription
--base-url <url>
Override API base URL
--token <token>
Override auth token (instead of AO_MONITOR_KEY)
--timeout-ms <ms>
Request timeout in milliseconds (default: 30000)
--help, -h
Show help message
Examples:
bash
undefined
以下参数可用于所有命令:
参数描述
--base-url <url>
覆盖API基础地址
--token <token>
覆盖认证令牌(替代AO_MONITOR_KEY)
--timeout-ms <ms>
请求超时时间(毫秒,默认:30000)
--help, -h
显示帮助信息
示例:
bash
undefined

Use different API server

使用不同的API服务器

node skills/monitor/index.mjs summary --base-url https://my-monitor.example.com
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"
node skills/monitor/index.mjs alerts --token "different_key"

Longer timeout for slow connections

为慢速连接设置更长的超时时间

node skills/monitor/index.mjs logs --timeout-ms 60000
undefined
node skills/monitor/index.mjs logs --timeout-ms 60000
undefined

Query Parameters Reference

查询参数参考

For summary, task, alerts

适用于summary、task、alerts命令

ParameterValuesDescription
--period
1h
,
4h
,
8h
,
24h
,
48h
Time window for metrics
--include
CSV of fieldsFields to include in response
--format
json
,
text
Response format
Include field options:
  • counts
    - Execution counts
  • kpis
    - Key performance indicators
  • latency
    - Response time metrics
参数可选值描述
--period
1h
,
4h
,
8h
,
24h
,
48h
指标统计的时间窗口
--include
字段的CSV格式字符串响应中要包含的字段
--format
json
,
text
响应格式
可包含的字段选项:
  • counts
    - 执行次数统计
  • kpis
    - 关键绩效指标
  • latency
    - 响应时间指标

For logs

适用于logs命令

ParameterTypeDescription
--limit
integerMax results (1-1000, default: 100)
--offset
integerPagination offset
--status
string
success
,
failure
, or
timeout
--error-type
stringFilter by error substring
--since
ISO timestampLogs after this time
--until
ISO timestampLogs before this time
--task-id
stringFilter by task ID
参数类型描述
--limit
整数最大结果数(1-1000,默认:100)
--offset
整数分页偏移量
--status
字符串
success
failure
timeout
--error-type
字符串按错误子串筛选
--since
ISO时间戳该时间之后的日志
--until
ISO时间戳该时间之前的日志
--task-id
字符串按任务ID筛选

Common Use Cases

常见使用场景

Check System Health

检查系统健康状态

bash
undefined
bash
undefined

Quick overview

快速概览

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

Check for any alerts

检查是否有告警

node skills/monitor/index.mjs alerts
undefined
node skills/monitor/index.mjs alerts
undefined

Investigate Task Failures

排查任务失败问题

bash
undefined
bash
undefined

See if task has issues

查看任务是否存在问题

node skills/monitor/index.mjs task ao-token-info --period 24h
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
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
undefined
node skills/monitor/index.mjs logs --error-type "503" --limit 50
undefined

View Recent Activity

查看近期活动

bash
undefined
bash
undefined

Last 100 logs

最新100条日志

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

Last hour of logs

过去1小时的日志

node skills/monitor/index.mjs logs --since "$(date -u -v-1H +%Y-%m-%dT%H:%M:%SZ)"
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
undefined
node skills/monitor/index.mjs logs --status success --limit 50
undefined

Monitor Specific Task

监控特定任务

bash
undefined
bash
undefined

Task metrics

任务指标

node skills/monitor/index.mjs task ao-token-info --include counts,kpis,latency
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
undefined
node skills/monitor/index.mjs logs ao-token-info --limit 50
undefined

Debug Timeouts

调试超时问题

bash
undefined
bash
undefined

Find timeout issues

查找超时问题

node skills/monitor/index.mjs logs --status timeout
node skills/monitor/index.mjs logs --status timeout

Check latency metrics

检查延迟指标

node skills/monitor/index.mjs summary --include latency
undefined
node skills/monitor/index.mjs summary --include latency
undefined

Error Handling

错误处理

Missing Authentication

缺少认证信息

If
AO_MONITOR_KEY
is not set and no
--token
provided:
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"
如果未设置
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"

Authentication Failures

认证失败

401 Unauthorized or 403 Forbidden:
  • Verify your
    AO_MONITOR_KEY
    is correct
  • Check if the key has expired
  • Ensure the key has access to the requested resource
出现401 Unauthorized403 Forbidden错误时:
  • 验证你的
    AO_MONITOR_KEY
    是否正确
  • 检查密钥是否已过期
  • 确保密钥有权限访问请求的资源

API Errors

API错误

Non-2xx responses display:
  • HTTP status code
  • Error message from server
Error: Request failed with status 404
Not Found: Task 'invalid-task' does not exist
非2xx响应会显示:
  • HTTP状态码
  • 服务器返回的错误信息
Error: Request failed with status 404
Not Found: Task 'invalid-task' does not exist

Network/Timeout Errors

网络/超时错误

  • Default timeout is 30 seconds
  • Increase with
    --timeout-ms
    for slow connections
  • Check network connectivity if requests fail
  • 默认超时时间为30秒
  • 可通过
    --timeout-ms
    参数设置更长的超时时间以适配慢速连接
  • 如果请求失败,请检查网络连接

Examples Cheatsheet

示例速查表

bash
undefined
bash
undefined

System overview

系统概览

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

Text format summary

文本格式的系统概览

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

Last 24h summary

过去24小时的系统概览

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

Check alerts

检查告警

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

Task details

任务详情

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

Recent logs

最新日志

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

Task logs

特定任务的日志

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

Failed runs

失败的执行记录

node skills/monitor/index.mjs logs --status failure
node skills/monitor/index.mjs logs --status failure

Search errors

搜索错误

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

API docs

API文档

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

Custom request

自定义请求

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