首页龙虾技能列表 › Prometheus — Prometheus

Prometheus — Prometheus

v1.1.0

Prometheus 监控工具。

2· 2,000·17 当前·17 累计
by @akellacom (Akellacom)·MIT-0
下载技能包
License
MIT-0
最后更新
2026/3/6
安全扫描
VirusTotal
无害
查看报告
OpenClaw
安全
high confidence
The skill's code, runtime instructions, and requested resources are consistent with a Prometheus query CLI — nothing indicates covert or unrelated behavior.
评估建议
This skill appears to do exactly what it says: query Prometheus HTTP APIs for metrics. Before installing, note that the CLI will read and set environment variables from local .env files (workspace and current directory) and will write a config file (prometheus.json) into your OpenClaw workspace (or the path you provide). Don’t point it at untrusted Prometheus endpoints; review the generated prometheus.json to ensure no sensitive credentials are stored there in plaintext. If you keep secrets in a...
详细分析 ▾
用途与能力
Name/description (query Prometheus metrics) align with the files and code: the CLI reads a config or environment, performs Prometheus HTTP API calls, supports multi-instance queries and basic auth — all expected for this purpose.
指令范围
SKILL.md directs running the provided node scripts and storing a config in the OpenClaw workspace; the code also loads optional .env files from the workspace and CWD which could populate process.env. Reading local .env files and allowing PROMETHEUS_* env fallbacks is plausible for convenience, but it means the skill will read local environment files beyond only a single dedicated config file.
安装机制
No install spec; the skill is instruction + Node.js scripts. That is low-risk and consistent with a CLI-style skill.
凭证需求
The skill declares no required env vars, and the code only uses PROMETHEUS_URL/USER/PASSWORD and any entries from a local prometheus.json. However, the loader will parse .env files in the workspace and CWD and set any keys not already present in process.env — this can pull unrelated secrets (if present in .env) into process.env for the process, though they are used only as fallbacks and not exfiltrated by the code.
持久化与权限
always is false and the skill writes only its own config (prometheus.json) under the OpenClaw workspace or a path provided by PROMETHEUS_CONFIG. It does not modify other skills or system-wide agent settings.
安全有层次,运行前请审查代码。

License

MIT-0

可自由使用、修改和再分发,无需署名。

运行时依赖

无特殊依赖

版本

latestv1.1.02026/2/10

Multi-instance support, config file support, .env fallback, interactive init command

● 无害

安装命令 点击复制

官方npx clawhub@latest install prometheus
镜像加速npx clawhub@latest install prometheus --registry https://cn.clawhub-mirror.com

技能文档

Query Prometheus monitoring data from one or multiple instances. Supports federation across multiple Prometheus servers with a single command.

Quick 开始

1. Initial Setup

Run the interactive configuration wizard:

cd ~/.openclaw/workspace/skills/prometheus
node scripts/cli.js init

This will create a prometheus.json config file in your OpenClaw workspace (~/.openclaw/workspace/prometheus.json).

2. 开始 Querying

# Query default instance
node scripts/cli.js query 'up'

# Query all instances at once node scripts/cli.js query 'up' --all

# List configured instances node scripts/cli.js instances

Configuration

配置 File Location

By default, the skill looks for config in your OpenClaw workspace:

~/.openclaw/workspace/prometheus.json

Priority order:

  • Path 从 PROMETHEUS_CONFIG environment 变量
  • ~/.openclaw/workspace/prometheus.json
  • ~/.openclaw/workspace/配置/prometheus.json
  • ./prometheus.json (current directory)
  • ~/.配置/prometheus/配置.json

配置 格式

Create prometheus.json in your workspace (or use node cli.js init):

{
  "instances": [
    {
      "name": "production",
      "url": "https://prometheus.example.com",
      "user": "admin",
      "password": "secret"
    },
    {
      "name": "staging",
      "url": "http://prometheus-staging:9090"
    }
  ],
  "default": "production"
}

Fields:

  • name — unique identifier 对于 instance
  • url — Prometheus server URL
  • 用户 / 密码 — 可选 HTTP Basic Auth credentials
  • 默认 — 哪个 instance 到 使用 当...时 无 specified

Environment Variables (Legacy)

For single-instance setups, you can use environment variables:

export PROMETHEUS_URL=https://prometheus.example.com
export PROMETHEUS_USER=admin        # optional
export PROMETHEUS_PASSWORD=secret   # optional

Usage

Global Flags

FlagDescription
-c, --config Path to config file
-i, --instance Target specific instance
-a, --allQuery all configured instances

Commands

Setup

# Interactive configuration wizard
node scripts/cli.js init

查询 Metrics

cd ~/.openclaw/workspace/skills/prometheus

# Query default instance node scripts/cli.js query 'up'

# Query specific instance node scripts/cli.js query 'up' -i staging

# Query ALL instances at once node scripts/cli.js query 'up' --all

# Custom config file node scripts/cli.js query 'up' -c /path/to/config.json

Common Queries

Disk space usage:

node scripts/cli.js query '100 - (node_filesystem_avail_bytes / node_filesystem_size_bytes  100)' --all

CPU usage:

node scripts/cli.js query '100 - (avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[5m]))  100)' --all

Memory usage:

node scripts/cli.js query '(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes  100' --all

加载 平均值:

node scripts/cli.js query 'node_load1' --all

列表 Configured Instances

node scripts/cli.js instances

Output:

{
  "default": "production",
  "instances": [
    { "name": "production", "url": "https://prometheus.example.com", "hasAuth": true },
    { "name": "staging", "url": "http://prometheus-staging:9090", "hasAuth": false }
  ]
}

其他 Commands

# List all metrics matching pattern
node scripts/cli.js metrics 'node_memory_'

# Get label names node scripts/cli.js labels --all

# Get values for a label node scripts/cli.js label-values instance --all

# Find time series node scripts/cli.js series '{__name__=~"node_cpu_.", instance=~".:9100"}' --all

# Get active alerts node scripts/cli.js alerts --all

# Get scrape targets node scripts/cli.js targets --all

Multi-Instance 输出 格式

When using --all, results include data from all instances:

{
  "resultType": "vector",
  "results": [
    {
      "instance": "production",
      "status": "success",
      "resultType": "vector",
      "result": [...]
    },
    {
      "instance": "staging",
      "status": "success",
      "resultType": "vector",
      "result": [...]
    }
  ]
}

Errors on individual instances don't fail the entire query — they appear with "status": "error" in the results array.

Common Queries Reference

MetricPromQL Query
Disk free %node_filesystem_avail_bytes / node_filesystem_size_bytes 100
Disk used %100 - (node_filesystem_avail_bytes / node_filesystem_size_bytes 100)
CPU idle %avg by (instance) (irate(node_cpu_seconds_total{mode="idle"}[5m])) 100
Memory used %(node_memory_MemTotal_bytes - node_memory_MemAvailable_bytes) / node_memory_MemTotal_bytes 100
Network RXrate(node_network_receive_bytes_total[5m])
Network TXrate(node_network_transmit_bytes_total[5m])
Uptimenode_time_seconds - node_boot_time_seconds
Service upup

Notes

  • 时间 range defaults 到 最后的 1 hour 对于 instant queries
  • 使用 range queries [5m] 对于 rate calculations
  • 所有 queries return JSON 带有 data.结果 containing results
  • Instance labels typically show host:port 格式
  • 当...时 使用 --所有, queries run 在...中 parallel 对于 faster results
  • 配置 stored outside skill directory 所以 persists 穿过 skill updates
数据来源:ClawHub ↗ · 中文优化:龙虾技能库
OpenClaw 技能定制 / 插件定制 / 私有工作流定制

免费技能或插件可能存在安全风险,如需更匹配、更安全的方案,建议联系付费定制

了解定制服务