← Back to Skills Marketplace
lerwee

Lerwee API Skill

by Lerwee · GitHub ↗ · v1.0.2 · MIT-0
cross-platform ⚠ suspicious
813
Downloads
6
Stars
0
Active Installs
3
Versions
Install in OpenClaw
/install lerwee-api
Description
乐维监控系统 API 集成工具。提供完整的 API 签名认证、监控对象管理、告警查询、事件平台等 86+ 个接口的调用能力。
README (SKILL.md)

Lerwee API Skill - 乐维监控系统 API 集成

当前版本: v6.0 | 最后更新: 2026-03-11 | 状态: 与官方文档完全同步

配置

设置 API 凭证和服务器信息:

# 服务器配置
export LERWEE_BASE_URL="http://192.168.1.79:8081/api/v6"
export LERWEE_SECRET=""

API 基础信息

  • Base URL: http://192.168.1.79:8081/api/v6
  • 请求方法: POST
  • Content-Type: application/json
  • 字符编码: UTF-8
  • 时间格式: 北京时间 (UTC+8)
  • 认证方式: 签名验证

签名算法

普通接口签名

所有接口需要在请求参数中包含:

  1. timestamp (long, 必填): Unix 时间戳(秒,北京时间 UTC+8)
  2. sign (string, 必填): 请求签名

签名计算步骤:

import hashlib

def make_sign(params, secret):
    """
    计算签名

    Args:
        params: 请求参数字典
        secret: 密钥

    Returns:
        签名字符串
    """
    # 1. 过滤空值、数组、sign 字段
    filtered = {k: v for k, v in params.items()
                if k != 'sign' and v != "" and v is not None and not isinstance(v, list)}

    # 2. 按键名字典序排序
    sorted_items = sorted(filtered.items())

    # 3. 拼接字符串(不包含键值分隔符)
    str_to_sign = ''.join([f"{k}{v}" for k, v in sorted_items])

    # 4. 计算签名
    sign = hashlib.sha1((secret + str_to_sign).encode('utf-8')).hexdigest().lower()

    return sign

特殊接口签名(事件平台等)

部分接口(如 /aialert/*)使用 JSON 序列化的 data 字段:

import json
import time

def make_data_params(data_dict, appid, token):
    """
    生成 data 参数和签名

    Args:
        data_dict: data 参数内容
        appid: 应用 ID
        token: 应用 token

    Returns:
        (data_json, timestamp, sign)
    """
    # 1. 添加 appid 和 token
    data_dict['appid'] = appid
    data_dict['token'] = token

    # 2. JSON 序列化
    data_json = json.dumps(data_dict, separators=(',', ':'))

    # 3. 生成时间戳
    timestamp = int(time.time())

    # 4. 计算签名
    sign_str = token + data_json + str(timestamp)
    sign = hashlib.sha1(sign_str.encode('utf-8')).hexdigest().lower()

    return data_json, timestamp, sign

API 模块索引

1. 监控中心 (Monitor)

  • 监控对象管理(列表、创建、更新、删除)
  • 监控对象详情、指标、宏
  • 监控类型和配置

📄 详细参数: references/api_details_monitor.md

2. 设备探测 (Device Detection)

  • Agent 列表、创建、安装、卸载
  • Agent 状态检查
  • 批量操作

📄 详细参数: references/api_details_device.md

3. 告警管理 (Alert)

  • 告警列表、问题列表
  • 告警统计、确认
  • 告警历史查询

📄 详细参数: references/api_details_alert.md

4. 事件平台 (Event Platform)

  • 事件列表、详情、关闭
  • 事件数据接收
  • 告警处理状态更新
  • 第三方告警恢复

📄 详细参数: references/api_details_alert.md

5. 事件平台告警 (AI Alert)

  • 告警列表、状态更新
  • 告警关闭
  • 第三方推送告警恢复(特殊签名)

📄 详细参数: references/api_details_alert.md

6. 业务视图 (Business View)

  • 组织树、业务树
  • 业务列表、告警、主机
  • 业务统计

📄 详细参数: references/api_details_business.md

7. 链路监控 (Link Monitor)

  • 链路列表、详情
  • 链路添加、更新、删除

📄 详细参数: references/api_details_business.md

8. 网络拓扑 (Network Topology)

  • 拓扑图列表、详情
  • 拓扑图添加、更新、删除
  • 节点和连线管理

📄 详细参数: references/api_details_business.md

9. 用户管理 (User Management)

  • 用户列表、创建、更新、删除
  • 部门管理
  • 角色管理

📄 详细参数: references/api_details_user.md

10. 自动化运维 (Automation)

  • 脚本执行
  • 执行结果查询

📄 详细参数: references/api_details_user.md

11. 虚拟化管理 (Virtualization)

  • 虚拟中心管理
  • 虚拟机列表

📄 详细参数: references/api_details_user.md

12. 网络管理 (Network)

  • IP 地址段管理
  • IP 地址管理

📄 详细参数: references/api_details_user.md

13. 资产管理 (Asset)

  • 资产列表、添加、更新、删除

📄 详细参数: references/api_details_user.md

14. 知识库 (Knowledge)

  • 知识列表、添加、更新、删除

📄 详细参数: references/api_details_user.md

返回格式

所有接口返回统一的 JSON 格式:

{
    "code": 0,
    "message": "",
    "data": {
        // 具体数据内容
    }
}
  • code: 状态码(0 表示成功,非 0 表示失败)
  • message: 消息说明
  • data: 返回数据(成功时存在)

错误码

常见错误码:

  • 0: 成功
  • 403: 签名异常或认证失败
  • 404: 接口不存在
  • 500: 服务器内部错误

📄 详细错误码: references/error_codes.md

使用示例

Python 示例

import requests
import json
import hashlib
import time

base_url = "http://192.168.1.79:8081/api/v6"
secret = ""

def make_sign(params):
    sorted_items = sorted(params.items())
    str_to_sign = ''.join([f"{k}{v}" for k, v in sorted_items
                          if k != 'sign' and v != "" and v is not None
                          and not isinstance(v, list)])
    return hashlib.sha1((secret + str_to_sign).encode('utf-8')).hexdigest().lower()

# 调用监控对象列表
params = {
    "page": 1,
    "pageSize": 20,
    "keyword": "linux"
}
params["timestamp"] = int(time.time())
params["sign"] = make_sign(params)

response = requests.post(f"{base_url}/monitor/host-list", json=params)
print(response.json())

cURL 示例

# 获取监控对象列表
curl -X POST "http://192.168.1.79:8081/api/v6/monitor/host-list" \
  -H "Content-Type: application/json" \
  -d '{
    "page": 1,
    "pageSize": 20,
    "keyword": "linux",
    "timestamp": 1678838400,
    "sign": " computed_signature_here "
  }'

参考文档

快速查询

  • references/api_endpoints.md - 完整 API 端点列表(按模块分类)

详细参数

  • references/api_details_monitor.md - 监控中心详细参数
  • references/api_details_device.md - 设备探测详细参数
  • references/api_details_alert.md - 告警与事件详细参数
  • references/api_details_business.md - 业务视图与拓扑详细参数
  • references/api_details_user.md - 用户管理与其他模块详细参数

参考数据

  • references/monitoring_types.md - 监控类型对照表
  • references/error_codes.md - 错误码详解

注意事项

  1. 时间格式: 所有时间戳使用 Unix 时间戳(秒),时区为北京时间 (UTC+8)
  2. 历史数据时间: 返回的历史数据中,graph.data 为毫秒级时间戳,text.data.clock 为秒级时间戳,显示时需转换为北京时间 (UTC+8)
  3. 请求方法: 所有接口使用 POST 方法
  4. 签名计算: 必须跳过 sign 字段本身、空值和数组类型参数
  5. 特殊接口: 事件平台相关接口使用 JSON 序列化的 data 字段
  6. 分页参数: 列表类接口通常使用 pagepageSize 参数

时间转换示例(北京时间):

from datetime import datetime, timezone, timedelta

beijing_tz = timezone(timedelta(hours=8))

# 秒级时间戳
dt = datetime.fromtimestamp(clock, beijing_tz)
print(dt.strftime('%Y-%m-%d %H:%M:%S'))  # 2026-03-11 18:41:32

# 毫秒级时间戳
dt = datetime.fromtimestamp(timestamp_ms / 1000, beijing_tz)

脚本工具

  • scripts/lerwee_api.py - Python API 客户端封装
  • scripts/sign_test.py - 签名算法测试工具

版本历史

  • v6.0 (2026-03-11): 与官方文档完全同步,覆盖 86+ 个接口
  • v5.0 (2025-12-01): 初始版本

支持与反馈

如有问题,请联系系统管理员。

Usage Guidance
What to check before installing or using this skill: - The skill will make HTTP requests to whatever base URL you configure. SKILL.md suggests environment variables LERWEE_BASE_URL and LERWEE_SECRET — but the registry metadata did not declare them. Expect to provide a secret if you want the client to work. - Do NOT supply production or high-privilege credentials until you trust the code: review scripts/lerwee_api.py and scripts/sign_test.py yourself. The client code performs signing and POSTs JSON to the configured base_url. - README includes an example admin password (ITIM_p@ssw0rd). Treat this as a placeholder—change any default credentials and never reuse real admin secrets when testing. - The default base_url in docs points to a private IP (192.168.1.79). Confirm that target host is the intended internal service; avoid pointing the skill at unknown or public endpoints. - If you must run the bundled scripts, run them in an isolated environment (test VM or container) and audit network traffic to ensure no unexpected endpoints are contacted. - If you want the platform to show correct required credentials, ask the publisher/maintainer to update metadata to declare LERWEE_BASE_URL and LERWEE_SECRET (or remove embedded secrets/examples).
Capability Analysis
Type: OpenClaw Skill Name: lerwee-api Version: 1.0.2 The skill bundle provides a comprehensive API integration for the Lerwee (乐维) IT monitoring system, including a Python client (lerwee_api.py) and extensive documentation. It contains high-risk capabilities such as remote script execution on monitored hosts (/devops/run-script), file distribution, and the handling of SSH credentials for automated agent installation (/detection/agent-batchinstall). While these features are consistent with the stated purpose of an enterprise monitoring and automation platform, they represent a significant attack surface for remote code execution and credential exposure. No evidence of intentional malice, data exfiltration, or prompt injection was found.
Capability Assessment
Purpose & Capability
Name, description, documentation and included Python client code align: the files implement an API client for the Lerwee monitoring platform and expose the documented endpoints. That capability justifies the included code and reference docs.
Instruction Scope
SKILL.md and README instruct only how to configure base URL/secret, generate signatures and call the platform endpoints. The runtime instructions do not ask the agent to read unrelated system files, exfiltrate data, or call external endpoints other than the configured base_url.
Install Mechanism
This is instruction-only (no install spec). Code files are bundled but no installer or remote download is declared — lowest install risk. The package does include Python scripts which would run if you execute them, so they should be reviewed before running.
Credentials
Registry metadata declares no required env vars or primary credential, but SKILL.md (and README) clearly expect LERWEE_BASE_URL and LERWEE_SECRET (and README shows a config.json with an admin username/password example). That mismatch (undeclared required secrets + an example admin password 'ITIM_p@ssw0rd' in docs) is disproportionate and ambiguous: the skill will need credentials to operate but the metadata does not advertise this, and the presence of a plaintext example admin password is a red flag for accidental credential leakage or misuse.
Persistence & Privilege
Skill is not always-enabled and does not request elevated or persistent platform privileges. It does not modify other skills' configs according to provided files.
How to Use
  1. Make sure OpenClaw is installed (local or Docker)
  2. Run the install command in chat: /install lerwee-api
  3. After installation, invoke the skill by name or use /lerwee-api
  4. Provide required inputs per the skill's parameter spec and get structured output
Version History
v1.0.2
- Added structured frontmatter with skill name and description to improve discoverability. - Clarified skill capabilities in the description, highlighting API integration, signature authentication, and support for 86+ interfaces. - No functional changes to usage steps, API details, or code examples. - The rest of the documentation content remains in sync with the previous version.
v1.0.1
- No changes detected in this release. - Version number incremented to 1.0.1 with no file modifications or documentation updates.
v1.0.0
Lerwee API Skill v1.0.0 - Initial release with complete integration of the 乐维监控系统 API v7.0, fully synchronized with official documentation as of 2026-03-11. - Comprehensive documentation provided, covering API configuration, authentication (signature algorithm), error codes, return format, usage examples (Python, cURL), and key implementation notes. - Detailed index of supported modules: monitoring, device detection, alert/event management, business view, topology, user/asset management, automation, virtualization, and more. - Included ready-to-use code samples and tools for Python clients and signature verification. - Supports 86+ API endpoints, with cross-references to in-depth parameter and error code documentation.
Metadata
Slug lerwee-api
Version 1.0.2
License MIT-0
All-time Installs 0
Active Installs 0
Total Versions 3
Frequently Asked Questions

What is Lerwee API Skill?

乐维监控系统 API 集成工具。提供完整的 API 签名认证、监控对象管理、告警查询、事件平台等 86+ 个接口的调用能力。 It is an AI Agent Skill for Claude Code / OpenClaw, with 813 downloads so far.

How do I install Lerwee API Skill?

Run "/install lerwee-api" in the OpenClaw or Claude Code chat to install it in one step — no extra setup required.

Is Lerwee API Skill free?

Yes, Lerwee API Skill is completely free, licensed under MIT-0. You can download, install and use it at no cost.

Which platforms does Lerwee API Skill support?

Lerwee API Skill is cross-platform and runs anywhere OpenClaw / Claude Code is available (cross-platform).

Who created Lerwee API Skill?

It is built and maintained by Lerwee (@lerwee); the current version is v1.0.2.

💬 Comments