monitor
Compare original and translation side by side
🇺🇸
Original
English🇨🇳
Translation
ChineseAO 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
undefinedAdd 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):**
```bashsource ~/.zshrc
**适用于bash(~/.bashrc):**
```bashAdd 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 summaryOptions:
- - Time window for metrics
--period <1h|4h|8h|24h|48h> - - Fields to include (e.g.,
--include <csv>)counts,kpis,latency - - Response format (default: json)
--format <json|text>
Examples:
bash
undefined获取所有受监控任务的系统全局概览。
bash
node skills/monitor/index.mjs summary可选参数:
- - 指标统计的时间窗口
--period <1h|4h|8h|24h|48h> - - 要包含的字段(例如:
--include <csv>)counts,kpis,latency - - 响应格式(默认:json)
--format <json|text>
示例:
bash
undefinedDefault 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
undefinednode skills/monitor/index.mjs summary --include counts,kpis
undefinedtask
task(任务详情)
Get detailed metrics for a specific task.
bash
node skills/monitor/index.mjs task <taskId>Options:
- - Time window for metrics
--period <1h|4h|8h|24h|48h> - - Fields to include
--include <csv> - - Response format
--format <json|text>
Examples:
bash
undefined获取特定任务的详细指标。
bash
node skills/monitor/index.mjs task <taskId>可选参数:
- - 指标统计的时间窗口
--period <1h|4h|8h|24h|48h> - - 要包含的字段
--include <csv> - - 响应格式
--format <json|text>
示例:
bash
undefinedGet 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
undefinednode skills/monitor/index.mjs task ao-token-info --period 48h --format text
undefinedalerts
alerts(告警信息)
View current system alerts and issues.
bash
node skills/monitor/index.mjs alertsOptions:
- - Time window for alerts
--period <1h|4h|8h|24h|48h> - - Response format
--format <json|text>
Examples:
bash
undefined查看当前系统的告警与问题。
bash
node skills/monitor/index.mjs alerts可选参数:
- - 告警统计的时间窗口
--period <1h|4h|8h|24h|48h> - - 响应格式
--format <json|text>
示例:
bash
undefinedCurrent 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
undefinednode skills/monitor/index.mjs alerts --period 4h --format text
undefinedlogs
logs(日志查看)
View execution logs, optionally filtered by task.
bash
undefined查看执行日志,可按任务筛选。
bash
undefinedAll 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:**
```bashnode 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筛选(替代位置参数)
**示例:**
```bashRecent 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
undefinednode skills/monitor/index.mjs logs --limit 100 --offset 100
undefineddocs
docs(文档查看)
Retrieve API documentation from the server.
bash
node skills/monitor/index.mjs docs从服务器获取API文档。
bash
node skills/monitor/index.mjs docsrequest
request(通用请求)
Make a generic API request for endpoints not covered by other commands.
bash
node skills/monitor/index.mjs request <endpoint> <method> [body]Arguments:
- - API path (e.g.,
endpoint)/v1/summary - - HTTP method (GET, POST, PUT, DELETE)
method - - JSON body for POST/PUT requests (optional)
body
Examples:
bash
undefined发送通用API请求,用于其他命令未覆盖的端点。
bash
node skills/monitor/index.mjs request <endpoint> <method> [body]参数说明:
- - API路径(例如:
endpoint)/v1/summary - - HTTP方法(GET, POST, PUT, DELETE)
method - - POST/PUT请求的JSON体(可选)
body
示例:
bash
undefinedGET 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"}'
undefinednode skills/monitor/index.mjs request /v1/api/agent/456 PUT '{"name":"Updated Agent"}'
undefinedGlobal Options
全局可选参数
These options work with all commands:
| Option | Description |
|---|---|
| Override API base URL |
| Override auth token (instead of AO_MONITOR_KEY) |
| Request timeout in milliseconds (default: 30000) |
| Show help message |
Examples:
bash
undefined以下参数可用于所有命令:
| 参数 | 描述 |
|---|---|
| 覆盖API基础地址 |
| 覆盖认证令牌(替代AO_MONITOR_KEY) |
| 请求超时时间(毫秒,默认:30000) |
| 显示帮助信息 |
示例:
bash
undefinedUse 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
undefinednode skills/monitor/index.mjs logs --timeout-ms 60000
undefinedQuery Parameters Reference
查询参数参考
For summary, task, alerts
适用于summary、task、alerts命令
| Parameter | Values | Description |
|---|---|---|
| | Time window for metrics |
| CSV of fields | Fields to include in response |
| | Response format |
Include field options:
- - Execution counts
counts - - Key performance indicators
kpis - - Response time metrics
latency
| 参数 | 可选值 | 描述 |
|---|---|---|
| | 指标统计的时间窗口 |
| 字段的CSV格式字符串 | 响应中要包含的字段 |
| | 响应格式 |
可包含的字段选项:
- - 执行次数统计
counts - - 关键绩效指标
kpis - - 响应时间指标
latency
For logs
适用于logs命令
| Parameter | Type | Description |
|---|---|---|
| integer | Max results (1-1000, default: 100) |
| integer | Pagination offset |
| string | |
| string | Filter by error substring |
| ISO timestamp | Logs after this time |
| ISO timestamp | Logs before this time |
| string | Filter by task ID |
| 参数 | 类型 | 描述 |
|---|---|---|
| 整数 | 最大结果数(1-1000,默认:100) |
| 整数 | 分页偏移量 |
| 字符串 | |
| 字符串 | 按错误子串筛选 |
| ISO时间戳 | 该时间之后的日志 |
| ISO时间戳 | 该时间之前的日志 |
| 字符串 | 按任务ID筛选 |
Common Use Cases
常见使用场景
Check System Health
检查系统健康状态
bash
undefinedbash
undefinedQuick 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
undefinednode skills/monitor/index.mjs alerts
undefinedInvestigate Task Failures
排查任务失败问题
bash
undefinedbash
undefinedSee 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
undefinednode skills/monitor/index.mjs logs --error-type "503" --limit 50
undefinedView Recent Activity
查看近期活动
bash
undefinedbash
undefinedLast 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
undefinednode skills/monitor/index.mjs logs --status success --limit 50
undefinedMonitor Specific Task
监控特定任务
bash
undefinedbash
undefinedTask 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
undefinednode skills/monitor/index.mjs logs ao-token-info --limit 50
undefinedDebug Timeouts
调试超时问题
bash
undefinedbash
undefinedFind 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
undefinednode skills/monitor/index.mjs summary --include latency
undefinedError Handling
错误处理
Missing Authentication
缺少认证信息
If is not set and no provided:
AO_MONITOR_KEY--tokenError: 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--tokenError: 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 is correct
AO_MONITOR_KEY - Check if the key has expired
- Ensure the key has access to the requested resource
出现401 Unauthorized或403 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 existNetwork/Timeout Errors
网络/超时错误
- Default timeout is 30 seconds
- Increase with for slow connections
--timeout-ms - Check network connectivity if requests fail
- 默认超时时间为30秒
- 可通过参数设置更长的超时时间以适配慢速连接
--timeout-ms - 如果请求失败,请检查网络连接
Examples Cheatsheet
示例速查表
bash
undefinedbash
undefinedSystem 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
undefinednode skills/monitor/index.mjs request /v1/summary GET
undefined