360 Secure SkillHub
360 安全技能中心

Pilot Metrics

核心功能:收集Pilot代理的节点信息、peer列表、连接数据,订阅自定义指标,可跨集群聚合指标并导出至监控系统。典型场景:单代理健康监控、集群代理性能汇总。通过pilotctl命令行操作,输出JSON格式数据。需依赖pilot-protocol、jq及运行的daemon,不适合应用级指标、持久存储、实时告警场景。

teoslayer
teoslayer
热度 45.09
最近更新 2026-05-11 17:41:32
分类:数据依赖:代码执行 / 读写文件 / 第三方 API应用场景:数据处理 / 报告撰写 / 自动化脚本 / DevOps

安装技能

复制下面的话术发给你的 Agent,它会通过 secure-skills 检索并安装该技能。

执行命令安装此 skill: npx secure-skills-cli add pilot-metrics
Metadata
name
pilot-metrics
description
Collect and aggregate agent metrics from connections, peers, and custom events. Use this skill when: 1. You need to monitor agent health and performance 2. You need to aggregate metrics across a fleet of agents 3. You need to track connection counts, RTT, throughput 4. You need to export metrics to monitoring systems Do NOT use this skill when: - You need application-level metrics (publish custom events instead) - You need persistent storage (use pilot-event-log for raw data) - You need real-time alerting (use pilot-alert instead)
tags
["pilot-protocol","metrics","monitoring","observability"]
license
AGPL-3.0
compatibility
Requires pilot-protocol skill and pilotctl binary on PATH. The daemon must be running (pilotctl daemon start). Requires jq for JSON processing.
metadata
{"author":"vulture-labs","version":"1.0","openclaw":{"requires":{"bins":["pilotctl","jq"]},"homepage":"https://pilotprotocol.network"}}
allowed-tools
["Bash"]

Pilot Metrics

Collect and aggregate metrics from Pilot Protocol agents.

Commands

Get agent info

pilotctl --json info

Returns node ID, address, hostname, uptime, polo score.

Get peer list

pilotctl --json peers

Lists connected peers with connection time.

Get connections

pilotctl --json connections

Lists active connections with state, ports, bytes sent/received.

Subscribe to custom metrics

pilotctl --json subscribe <source-hostname> "metrics.*" [--timeout <seconds>]

Workflow Example

Fleet health dashboard:

#!/bin/bash
OUTPUT_FILE="/tmp/fleet-metrics-$(date +%Y%m%d-%H%M%S).json"

echo '{"timestamp":"'$(date -u +%Y-%m-%dT%H:%M:%SZ)'","agents":[]}' > "$OUTPUT_FILE"

agents=$(pilotctl --json trust 2>/dev/null | jq -r '.data.trusted[].hostname')

for agent in $agents; do
  ping_result=$(pilotctl --json ping "$agent" 2>/dev/null)
  rtt_ms=$(echo "$ping_result" | jq -r '.data.results[0].rtt_ms // null')

  agent_data=$(jq -n --arg hostname "$agent" --arg rtt "$rtt_ms" \
    '{hostname: $hostname, rtt_ms: ($rtt | tonumber), status: "online"}')

  jq --argjson agent "$agent_data" '.agents += [$agent]' "$OUTPUT_FILE" > "${OUTPUT_FILE}.tmp"
  mv "${OUTPUT_FILE}.tmp" "$OUTPUT_FILE"
done

Dependencies

Requires pilot-protocol skill, jq, and a running daemon.