aapanel/btpanel/SKILL.md
宝塔面板(BT-Panel)运维监控技能,提供服务器资源监控、网站状态检查、服务状态检查、SSH安全审计、计划任务管理、日志读取等功能
npx skillsauth add openclaw/skills btpanelInstall this skill globally with one command. Works with Claude Code, Cursor, and Windsurf.
3 of 9 scanners reported clean
Some scanners were skipped, did not run, or reported a non-clean status. Review each row below.
宝塔面板服务器的全方位运维监控工具,支持多服务器管理、资源监控、网站状态检查、服务状态检查、SSH安全审计、计划任务管理等功能。
技能包提供以下图标文件,可在生成报告时引用:
| 文件 | 格式 | 用途 |
|------|------|------|
| icon/bt-logo.svg | SVG | 矢量图标,适合缩放 |
使用示例(生成报告时):
# 服务器巡检报告

## 概述
...
本技能用于查询和展示服务器状态数据,AI应遵循以下原则:
执行流程示例:
AI: 我将为您执行以下操作:
1. 获取服务器系统资源状态(CPU、内存、磁盘)
2. 检查网站运行状态
3. 检查服务运行状态
正在获取数据,请稍候...
[执行命令]
[展示结果和分析]
重要: 没有服务器信息时需要添加
使用配置工具管理服务器:
# 查看帮助
python3 {baseDir}/scripts/bt-config.py -h
# 添加服务器
python3 {baseDir}/scripts/bt-config.py add -n prod-01 -H https://panel.example.com:8888 -t YOUR_TOKEN
# 列出服务器
python3 {baseDir}/scripts/bt-config.py list
# 设置阈值
python3 {baseDir}/scripts/bt-config.py threshold --cpu 75 --memory 80
当用户第一次使用本技能时,需要先配置服务器连接信息:
# 添加服务器(需要面板地址和API Token)
python3 {baseDir}/scripts/bt-config.py add -n prod-01 -H https://panel.example.com:8888 -t YOUR_API_TOKEN
# 查看已配置的服务器
python3 {baseDir}/scripts/bt-config.py list
获取API Token的方法:
用户意图识别:
当用户需要了解所有服务器的整体运行状态时:
# 查看所有服务器的资源使用情况
python3 {baseDir}/scripts/monitor.py --format table
# 查看所有服务器的网站状态汇总
python3 {baseDir}/scripts/sites.py
# 查看所有服务器的服务状态
python3 {baseDir}/scripts/services.py
用户意图识别:
当用户需要对单台服务器进行全面检查时:
# 指定服务器名称进行各项检查
python3 {baseDir}/scripts/monitor.py --server prod-01 --format table
python3 {baseDir}/scripts/sites.py --server prod-01
python3 {baseDir}/scripts/services.py --server prod-01
python3 {baseDir}/scripts/ssh.py --status --server prod-01
python3 {baseDir}/scripts/crontab.py --backup-only --server prod-01
用户意图识别:
当用户关心SSL证书是否即将过期时:
# 查看SSL即将过期的网站
python3 {baseDir}/scripts/sites.py --filter ssl-warning
# 查看SSL已过期的网站
python3 {baseDir}/scripts/sites.py --filter ssl-expired
用户意图识别:
当用户需要进行安全检查时:
# 查看SSH登录失败记录
python3 {baseDir}/scripts/ssh.py --logs --filter failed
# 搜索特定IP的登录记录
python3 {baseDir}/scripts/ssh.py --logs --search 192.168.1.100
# 查看SSH服务状态
python3 {baseDir}/scripts/ssh.py --status
用户意图识别:
当某个服务出现问题时:
# 查看服务状态
python3 {baseDir}/scripts/services.py --server prod-01
# 查看服务错误日志
python3 {baseDir}/scripts/logs.py --server prod-01 --service nginx --lines 200
python3 {baseDir}/scripts/logs.py --server prod-01 --service redis
用户意图识别:
当用户关心备份是否正常时:
# 查看所有备份任务
python3 {baseDir}/scripts/crontab.py --backup-only
# 查看特定备份任务的执行日志
python3 {baseDir}/scripts/crontab.py --logs --task-id 11
用户意图识别:
# 查看帮助
python3 {baseDir}/scripts/monitor.py -h
# 监控所有服务器
python3 {baseDir}/scripts/monitor.py
# 监控指定服务器
python3 {baseDir}/scripts/monitor.py --server prod-01
# JSON格式输出
python3 {baseDir}/scripts/monitor.py --format json
# 表格格式输出
python3 {baseDir}/scripts/monitor.py --format table
# 输出到文件
python3 {baseDir}/scripts/monitor.py --output report.json
# 查看帮助
python3 {baseDir}/scripts/sites.py -h
# 检查所有服务器的网站状态
python3 {baseDir}/scripts/sites.py
# 检查指定服务器
python3 {baseDir}/scripts/sites.py --server prod-01
# 只显示停止的网站
python3 {baseDir}/scripts/sites.py --filter stopped
# 只显示SSL即将过期的网站(30天内)
python3 {baseDir}/scripts/sites.py --filter ssl-warning
# 只显示SSL已过期的网站
python3 {baseDir}/scripts/sites.py --filter ssl-expired
# JSON格式输出
python3 {baseDir}/scripts/sites.py --format json
# 输出到文件
python3 {baseDir}/scripts/sites.py --output sites.json
# 查看帮助
python3 {baseDir}/scripts/services.py -h
# 检查所有服务器的服务状态
python3 {baseDir}/scripts/services.py
# 检查指定服务器
python3 {baseDir}/scripts/services.py --server prod-01
# 只检查特定服务
python3 {baseDir}/scripts/services.py --service nginx --service redis
# JSON格式输出
python3 {baseDir}/scripts/services.py --format json
# 输出到文件
python3 {baseDir}/scripts/services.py --output services.json
# 查看帮助
python3 {baseDir}/scripts/logs.py -h
# 查看Nginx错误日志
python3 {baseDir}/scripts/logs.py --service nginx
# 查看Redis日志
python3 {baseDir}/scripts/logs.py --service redis
# 查看Apache错误日志
python3 {baseDir}/scripts/logs.py --service apache
# 查看MySQL错误日志
python3 {baseDir}/scripts/logs.py --service mysql
# 查看MySQL慢查询日志
python3 {baseDir}/scripts/logs.py --service mysql --log-type slow
# 查看PostgreSQL日志(需要插件)
python3 {baseDir}/scripts/logs.py --service pgsql
# 查看PostgreSQL慢日志
python3 {baseDir}/scripts/logs.py --service pgsql --log-type slow
# 指定服务器和行数
python3 {baseDir}/scripts/logs.py --server prod-01 --service nginx --lines 200
# JSON格式输出
python3 {baseDir}/scripts/logs.py --service nginx --format json
# 查看帮助
python3 {baseDir}/scripts/ssh.py -h
# 查看SSH服务状态
python3 {baseDir}/scripts/ssh.py --status
# 查看SSH登录日志
python3 {baseDir}/scripts/ssh.py --logs
# 只查看失败的登录日志
python3 {baseDir}/scripts/ssh.py --logs --filter failed
# 只查看成功的登录日志
python3 {baseDir}/scripts/ssh.py --logs --filter success
# 搜索特定IP的登录记录
python3 {baseDir}/scripts/ssh.py --logs --search 192.168.1.1
# 指定服务器
python3 {baseDir}/scripts/ssh.py --status --server prod-01
# JSON格式输出
python3 {baseDir}/scripts/ssh.py --logs --format json
# 查看帮助
python3 {baseDir}/scripts/crontab.py -h
# 查看所有计划任务
python3 {baseDir}/scripts/crontab.py
# 只查看备份任务
python3 {baseDir}/scripts/crontab.py --backup-only
# 查看指定服务器
python3 {baseDir}/scripts/crontab.py --server prod-01
# 查看备份任务日志
python3 {baseDir}/scripts/crontab.py --logs --task-id 11
# JSON格式输出
python3 {baseDir}/scripts/crontab.py --format json
| 参数 | 说明 | 默认值 |
|------|------|--------|
| --server, -s | 指定服务器名称 | 所有服务器 |
| --format, -f | 输出格式 (json/table) | json |
| --output, -o | 输出文件路径 | 标准输出 |
| --config, -c | 配置文件路径 | 自动查找 |
| 参数 | 说明 | 默认值 |
|------|------|--------|
| --server, -s | 指定服务器名称 | 所有服务器 |
| --format, -f | 输出格式 (json/table) | table |
| --output, -o | 输出文件路径 | 标准输出 |
| --filter | 过滤条件 (stopped/ssl-warning/ssl-expired) | 无 |
| --config, -c | 配置文件路径 | 自动查找 |
| 参数 | 说明 | 默认值 |
|------|------|--------|
| --server, -s | 指定服务器名称 | 所有服务器 |
| --format, -f | 输出格式 (json/table) | table |
| --output, -o | 输出文件路径 | 标准输出 |
| --service | 指定要检查的服务(可多次指定) | 默认服务列表 |
| --config, -c | 配置文件路径 | 自动查找 |
| 参数 | 说明 | 默认值 |
|------|------|--------|
| --server, -s | 指定服务器名称 | 所有服务器 |
| --service | 服务名称 (nginx/apache/redis/mysql/pgsql) | 必填 |
| --log-type | 日志类型 (error/slow) | error |
| --lines, -n | 返回最后N行日志 | 100 |
| --format, -f | 输出格式 (json/table) | table |
| --output, -o | 输出文件路径 | 标准输出 |
| --config, -c | 配置文件路径 | 自动查找 |
注意:只有已安装的服务才能获取日志,尝试获取未安装服务的日志会返回错误。
| 参数 | 说明 | 默认值 |
|------|------|--------|
| --server, -s | 指定服务器名称 | 所有服务器 |
| --status | 查看SSH服务状态 | 否 |
| --logs | 查看SSH登录日志 | 否 |
| --filter | 日志过滤 (ALL/success/failed) | ALL |
| --search | 搜索关键字(IP或用户名) | 无 |
| --limit, -n | 返回日志条数 | 50 |
| --format, -f | 输出格式 (json/table) | table |
| --output, -o | 输出文件路径 | 标准输出 |
| --config, -c | 配置文件路径 | 自动查找 |
| 参数 | 说明 | 默认值 |
|------|------|--------|
| --server, -s | 指定服务器名称 | 所有服务器 |
| --backup-only | 只显示备份任务 | 否 |
| --logs | 查看任务日志 | 否 |
| --task-id | 任务ID(配合--logs使用) | 无 |
| --days | 日志查询天数 | 7 |
| --format, -f | 输出格式 (json/table) | table |
| --output, -o | 输出文件路径 | 标准输出 |
| --config, -c | 配置文件路径 | 自动查找 |
通过单一API接口获取完整的系统监控数据:
支持多种项目类型:
| 类型 | 进程信息 | 运行状态判断 | |------|----------|--------------| | PHP | 无 | status==1 && stop为空 | | Java | pid_info | pid > 0 | | Node | load_info | run==true | | Go | load_info | run==true | | Python | pids | run==true | | .NET | load_info | run==true | | Proxy(反代) | 无 | status==1 | | HTML(静态) | 无 | status==1 | | Other(其他) | load_info | run==true |
检查项目:
支持检查的服务:
| 服务 | 状态检查 | 日志支持 | |------|----------|----------| | Nginx | ✓ | ✓ 错误日志 | | Apache | ✓ | ✓ 错误日志 | | MySQL | ✓ | ✓ 错误日志/慢日志 | | Redis | ✓ | ✓ 日志文件 | | Memcached | ✓ | ✗ | | Pure-FTPD | ✓ | ✗ | | PHP (多版本) | ✓ | ✗ | | PostgreSQL | ✓ | ✓ 错误日志/慢日志 |
服务状态字段说明:
| 字段 | 说明 |
|------|------|
| installed (setup) | 服务是否已安装 |
| status | 服务是否正在运行 |
| version | 已安装的版本号 |
| pid | 主进程ID(运行中时) |
重要区别:
installed=false:服务未安装,无法获取日志installed=true, status=false:服务已安装但未运行installed=true, status=true:服务已安装且正在运行PHP多版本共存说明:
php-X.X(如 php-8.2、php-7.4)检查项目:
支持的日志类型:
| 日志类型 | 服务 | 获取方式 | |----------|------|----------| | 错误日志 | nginx | 文件: /www/server/nginx/logs/error.log | | 错误日志 | apache | 文件: /www/wwwlogs/error_log | | 日志文件 | redis | 文件: /www/server/redis/redis.log | | 错误日志 | mysql | 接口: /database?action=GetErrorLog | | 慢日志 | mysql | 接口: /database?action=GetSlowLogs | | 错误日志 | pgsql | 插件接口: pgsql_manager | | 慢日志 | pgsql | 插件接口: pgsql_manager |
注意事项:
installed=true)的服务才能获取日志检查项目:
登录日志字段:
任务类型:
检查项目:
| 剩余天数 | 告警级别 | |----------|----------| | 已过期 | critical | | ≤ 7 天 | critical | | ≤ 30 天 | warning |
可在配置文件中设置告警阈值:
global:
thresholds:
cpu: 80 # CPU使用率告警阈值(%)
memory: 85 # 内存使用率告警阈值(%)
disk: 90 # 磁盘使用率告警阈值(%)
tools
Use when the user wants to connect to, test, or use the McDonalds service at mcp.mcd.cn, including checking authentication, probing MCP endpoints, listing tools, or calling McDonalds MCP tools through a reusable local CLI.
development
Web scraping platform — Twitter/X data, Vinted marketplace, and general web scraping API
development
SlowMist AI Agent Security Review — comprehensive security framework for skills, repositories, URLs, on-chain addresses, and products (Claude Code version)
data-ai
去除中文文本中的 AI 写作痕迹,使其读起来自然。基于维基百科 AI 写作特征指南,检测 24 种 AI 模式。触发词:humanizer-cn、去除 AI 痕迹、去除 AI 写作痕迹、中文文本人性化。