适用于 Velocity 的现代、对托管友好的系统监控插件
高级 Velocity 监控插件,能够自动适应任何托管环境——从预算共享主机到专用服务器。
? 主要功能
- ✅ 适用于任何托管环境 - 共享主机、VPS、专用服务器或云服务器
- ? 自动检测环境 - 无需配置
- ? 智能回退机制 - 在系统访问受限时使用 JVM 监控
- ⚡ 异步操作 - 零性能影响
- ? 全面监控 - CPU、内存、磁盘、网络、JVM 指标
- ? Discord/Slack 警报 - 实时通知
- ?️ 配置热重载 - 无需重启
? 要求
- Velocity: 3.4.0+
- Java: 21+
? 快速开始
- 下载
BubbleLog-2.0.0.jar
- 放入
plugins/ 文件夹
- 启动服务器 - 完成!
初始命令
/bubblelog env # 检查环境能力
/bubblelog status # 查看监控状态
/bubblelog reload # 重新加载配置
⚙️ 配置
默认配置文件位于 plugins/bubblelog/config.yml:
monitoring:
interval: 30 # 检查间隔秒数
cpu: { enabled: true }
ram: { enabled: true }
disk: { enabled: true }
network: { enabled: true }
jvm: { enabled: true }
alerts:
enabled: true
thresholds:
cpu: 80.0 # CPU 达到 80% 时发出警报
ram: 85.0 # 内存达到 85% 时发出警报
disk: 90.0 # 磁盘达到 90% 时发出警报
discord:
enabled: false
webhook-url: ""
共享主机优化
monitoring:
interval: 60 # 共享主机使用更高的间隔
jvm: { enabled: true } # 始终启用
? 监控内容
| 指标 |
完全访问权限 |
共享主机 |
| CPU |
系统 CPU |
JVM 进程 CPU |
| RAM |
系统内存 |
JVM 堆内存 |
| Disk |
所有磁盘 |
跳过 |
| Network |
玩家统计 |
玩家统计 |
| JVM |
完整指标 |
完整指标 |
? 命令
| 命令 |
描述 |
/bubblelog env |
显示环境能力 |
/bubblelog status |
查看监控状态 |
/bubblelog reload |
热重载配置 |
/bubblelog validate |
检查配置有效性 |
/bubblelog test webhook |
测试 Discord Webhook |
权限:bubblelog.admin
? 故障排除
"检测到系统访问受限"
✅ 在共享主机上很正常! 插件仅使用 JVM 监控即可工作。
性能问题
增加监控间隔:
monitoring:
interval: 120 # 每 2 分钟检查一次
Discord Webhooks
- 在 Discord 服务器设置中创建 Webhook
- 复制 Webhook URL
- 添加到配置:
alerts:
discord:
enabled: true
webhook-url: "https://discord.com/api/webhooks/..."
?️ 构建
.\gradlew.bat shadowJar # Windows
./gradlew shadowJar # Linux/Mac
输出:build/libs/BubbleLog-2.0.0.jar
? 许可证
MIT License - 请参阅 LICENSE 文件
? 支持
- GitHub Issues:用于提交错误报告
- 命令:使用
/bubblelog env 检查您的设置
专为在任何托管环境下运行 Velocity 的服务器管理员打造!?
# 日志文件名
filename: "system-usage.log"
# 同时记录到控制台/服务器日志
console: false
# 日志条目的日期格式
date-format: "yyyy-MM-dd HH:mm:ss"
# 保留的最大日志文件数量(0 = 无限制)
max-files: 7
alerts:
# 启用性能警报
enabled: true
thresholds:
# CPU 使用率警报阈值(百分比)
cpu: 80.0
# 内存使用率警报阈值(百分比)
ram: 85.0
# 磁盘使用率警报阈值(百分比)
disk: 90.0
# 将警报发送到服务器控制台
console: true
# 将警报记录到文件
log-to-file: true
# 相同类型警报之间的冷却时间(秒)
cooldown: 300
discord:
# 启用 Discord Webhook 警报
enabled: false
# 用于警报的 Discord Webhook URL
webhook-url: ""
status-reports:
# 启用定期 Discord 状态报告
enabled: false
# Discord 状态报告间隔(秒)(3600 = 1 小时)
interval: 3600
slack:
# 启用 Slack Webhook 警报
enabled: false
# 用于警报的 Slack Webhook URL
webhook-url: ""
日志格式
插件以以下格式记录全面的系统指标:
[2025-07-10 14:30:00] CPU: 45.67% | RAM: 2.34GB/8.00GB (29.25%) | Disk(C:): 120.5GB/500.0GB (24.10%) | Players: 45/100 (45.0%), Servers: 3/4 | JVM: Heap 67.8%, Threads: 42, GC: 1250ms
包括:
- 系统指标:CPU、内存和磁盘使用率及百分比
- 网络指标:当前/最大玩家数、服务器利用率、后端服务器状态
- JVM 指标:堆利用率、活跃线程数、总 GC 时间
- 时间戳:可配置的日期/时间格式
警报类型
插件可以发送以下类型的警报:
- 高 CPU 使用率:当 CPU 使用率超过配置的阈值时
- 高内存使用率:当内存使用率超过配置的阈值时
- 高磁盘使用率:当任何磁盘超过配置的阈值时
- 关键系统状态:当多种资源同时处于压力状态时
警报目标
- 控制台记录:警报出现在服务器控制台中,带有 ? emoji
- 文件记录:警报保存到 logs 目录中的
alerts.log
- Discord Webhooks:带有彩色警报和时间戳的富嵌入
- Slack Webhooks:带有适当警告颜色的格式化消息
Webhook 设置
对于 Discord Webhooks:
- 在您的 Discord 服务器中创建一个 Webhook
- 复制 Webhook URL
- 设置
alerts.discord.enabled: true 并粘贴 URL
对于 Slack Webhooks:
- 在您的 Slack 工作区中创建一个传入 Webhook
- 复制 Webhook URL
- 设置
alerts.slack.enabled: true 并粘贴 URL
构建
要从源代码构建插件:
- 确保已安装 Java 17 或更高版本
- 克隆此仓库
- 运行
build.bat(Windows)或 ./gradlew shadowJar(Linux/Mac)
- 编译后的插件位于
build/libs/BubbleLog-1.0.0.jar
项目结构
BubbleLog/
├── src/main/java/net/bubblecraft/bubblelog/
│ ├── BubbleLog.java # 主插件类
│ ├── config/ConfigManager.java # 配置处理
│ └── monitor/SystemMonitor.java # 系统监控逻辑
├── build.gradle # 构建配置
├── config-example.yml # 示例配置
├── build.bat # Windows 构建脚本
└── README.md # 本文件
依赖项
许可证
本项目采用 MIT 许可证授权 - 详情请参阅 LICENSE 文件。
支持
如果遇到任何问题或有疑问,请在 GitHub 上提交 Issue。
错误处理与可靠性
BubbleLog 设计了全面的错误处理机制,以确保其绝不会影响服务器性能:
- ✅ 隔离的错误处理:每个监控组件独立失败
- ✅ 优雅降级:即使个别组件失败,仍继续监控
- ✅ 安全默认值:无效数据会被替换为安全回退值
- ✅ 非阻塞操作:文件 I/O 和 webhook 错误不会中断监控
- ✅ 数据验证:所有系统值在使用前均经过验证
- ✅ 恢复机制:在下一个监控周期自动恢复
? Discord 集成
BubbleLog 提供了丰富的 Discord webhook 集成,用于实时服务器监控和警报。
功能
- ? 即时警报:针对 CPU、内存和磁盘使用率的丰富嵌入警报
- ? 状态报告:定期的综合系统状态报告
- ? 丰富格式:带有颜色编码严重程度的专业嵌入样式
- ⚡ 实时性:超过阈值时立即通知
- ? 可配置:自定义阈值和报告间隔
Discord 警报示例
⚡ 高 CPU 使用率
CPU 使用率为 85.23%(阈值:80.0%)
警报类型:高 CPU 使用率
严重程度:⚠️ 警告
服务器:Velocity Proxy
时间戳:2025 年 7 月 10 日下午 2:30
Discord 状态报告示例
✅ 系统状态报告
当前服务器性能指标和健康状况
?️ CPU 使用率:45.32%
? 内存使用率:65.2%(5.2 GB / 8.0 GB)
? 在线玩家:85 / 100(85.0%)
? 磁盘使用率:C:: 68.5%(剩余 15.8 GB)
? 整体健康状态:✅ 健康
快速设置
- 在你的服务器中创建 Discord webhook
- 复制 webhook URL
- 配置 BubbleLog:
alerts:
discord:
enabled: true
webhook-url: "YOUR_WEBHOOK_URL_HERE"
status-reports:
enabled: true
interval: 3600 # 每小时报告
Modern, Hosting-Friendly System Monitoring for Velocity
Advanced Velocity monitoring plugin that automatically adapts to any hosting environment - from budget shared hosting to dedicated servers.
? Key Features
- ✅ Works on ANY hosting - Shared, VPS, dedicated, or cloud
- ? Auto-detects environment - No configuration needed
- ? Smart fallbacks - JVM monitoring when system access is limited
- ⚡ Async operations - Zero performance impact
- ? Comprehensive monitoring - CPU, RAM, Disk, Network, JVM metrics
- ? Discord/Slack alerts - Real-time notifications
- ?️ Hot-reload config - No restart required
? Requirements
- Velocity: 3.4.0+
- Java: 21+
? Quick Start
- Download
BubbleLog-2.0.0.jar
- Place in
plugins/ folder
- Start server - that's it!
First Commands
/bubblelog env # Check environment capabilities
/bubblelog status # View monitoring status
/bubblelog reload # Reload configuration
⚙️ Configuration
Default config at plugins/bubblelog/config.yml:
monitoring:
interval: 30 # Seconds between checks
cpu: { enabled: true }
ram: { enabled: true }
disk: { enabled: true }
network: { enabled: true }
jvm: { enabled: true }
alerts:
enabled: true
thresholds:
cpu: 80.0 # Alert at 80% CPU
ram: 85.0 # Alert at 85% RAM
disk: 90.0 # Alert at 90% disk
discord:
enabled: false
webhook-url: ""
Shared Hosting Optimization
monitoring:
interval: 60 # Higher interval for shared hosting
jvm: { enabled: true } # Always keep enabled
? What Gets Monitored
| Metric |
Full Access |
Shared Hosting |
| CPU |
System CPU |
JVM Process CPU |
| RAM |
System Memory |
JVM Heap |
| Disk |
All Disks |
Skipped |
| Network |
Player stats |
Player stats |
| JVM |
Full metrics |
Full metrics |
? Commands
| Command |
Description |
/bubblelog env |
Show environment capabilities |
/bubblelog status |
View monitoring status |
/bubblelog reload |
Hot-reload configuration |
/bubblelog validate |
Check config validity |
/bubblelog test webhook |
Test Discord webhook |
Permission: bubblelog.admin
? Troubleshooting
"Limited system access detected"
✅ Normal on shared hosting! Plugin works with JVM-only monitoring.
Performance Issues
Increase monitoring interval:
monitoring:
interval: 120 # Check every 2 minutes
Discord Webhooks
- Create webhook in Discord server settings
- Copy webhook URL
- Add to config:
alerts:
discord:
enabled: true
webhook-url: "https://discord.com/api/webhooks/..."
?️ Building
.\gradlew.bat shadowJar # Windows
./gradlew shadowJar # Linux/Mac
Output: build/libs/BubbleLog-2.0.0.jar
? License
MIT License - See LICENSE file
? Support
- GitHub Issues: For bug reports
- Commands:
/bubblelog env to check your setup
Made for server administrators running Velocity on any hosting! ?
# Name of the log file
filename: "system-usage.log"
# Also log to console/server log
console: false
# Date format for log entries
date-format: "yyyy-MM-dd HH:mm:ss"
# Maximum number of log files to keep (0 = unlimited)
max-files: 7
alerts:
# Enable performance alerts
enabled: true
thresholds:
# CPU usage threshold for alerts (percentage)
cpu: 80.0
# RAM usage threshold for alerts (percentage)
ram: 85.0
# Disk usage threshold for alerts (percentage)
disk: 90.0
# Send alerts to server console
console: true
# Log alerts to file
log-to-file: true
# Cooldown between same alert types (seconds)
cooldown: 300
discord:
# Enable Discord webhook alerts
enabled: false
# Discord webhook URL for alerts
webhook-url: ""
status-reports:
# Enable periodic Discord status reports
enabled: false
# Discord status report interval in seconds (3600 = 1 hour)
interval: 3600
slack:
# Enable Slack webhook alerts
enabled: false
# Slack webhook URL for alerts
webhook-url: ""
Log Format
The plugin logs comprehensive system metrics in the following format:
[2025-07-10 14:30:00] CPU: 45.67% | RAM: 2.34GB/8.00GB (29.25%) | Disk(C:): 120.5GB/500.0GB (24.10%) | Players: 45/100 (45.0%), Servers: 3/4 | JVM: Heap 67.8%, Threads: 42, GC: 1250ms
Includes:
- System Metrics: CPU, RAM, and disk usage with percentages
- Network Metrics: Current/max players, server utilization, backend server status
- JVM Metrics: Heap utilization, active threads, total GC time
- Timestamps: Configurable date/time formatting
Alert Types
The plugin can send alerts for:
- High CPU Usage: When CPU usage exceeds the configured threshold
- High RAM Usage: When memory usage exceeds the configured threshold
- High Disk Usage: When any disk exceeds the configured threshold
- Critical System State: When multiple resources are under stress simultaneously
Alert Destinations
- Console Logging: Alerts appear in server console with ? emoji
- File Logging: Alerts are saved to
alerts.log in the logs directory
- Discord Webhooks: Rich embeds with colored alerts and timestamps
- Slack Webhooks: Formatted messages with appropriate warning colors
Webhook Setup
For Discord webhooks:
- Create a webhook in your Discord server
- Copy the webhook URL
- Set
alerts.discord.enabled: true and paste the URL
For Slack webhooks:
- Create an incoming webhook in your Slack workspace
- Copy the webhook URL
- Set
alerts.slack.enabled: true and paste the URL
Building
To build the plugin from source:
- Ensure you have Java 17+ installed
- Clone this repository
- Run
build.bat (Windows) or ./gradlew shadowJar (Linux/Mac)
- The compiled plugin will be in
build/libs/BubbleLog-1.0.0.jar
Project Structure
BubbleLog/
├── src/main/java/net/bubblecraft/bubblelog/
│ ├── BubbleLog.java # Main plugin class
│ ├── config/ConfigManager.java # Configuration handling
│ └── monitor/SystemMonitor.java # System monitoring logic
├── build.gradle # Build configuration
├── config-example.yml # Example configuration
├── build.bat # Windows build script
└── README.md # This file
Dependencies
- OSHI - For system and hardware information
- Configurate - For YAML configuration
License
This project is licensed under the MIT License - see the LICENSE file for details.
Support
If you encounter any issues or have questions, please open an issue on GitHub.
Error Handling & Reliability
BubbleLog is designed with comprehensive error handling to ensure it never affects server performance:
- ✅ Isolated Error Handling: Each monitoring component fails independently
- ✅ Graceful Degradation: Continues monitoring even if individual components fail
- ✅ Safe Defaults: Invalid data is replaced with safe fallback values
- ✅ Non-Blocking Operations: File I/O and webhook errors don't stop monitoring
- ✅ Data Validation: All system values are validated before use
- ✅ Recovery Mechanisms: Automatic recovery on next monitoring cycle
? Discord Integration
BubbleLog provides rich Discord webhook integration for real-time server monitoring and alerts.
Features
- ? Instant Alerts: Rich embed alerts for CPU, RAM, and disk usage
- ? Status Reports: Periodic comprehensive system status reports
- ? Rich Formatting: Professional embeds with color-coded severity levels
- ⚡ Real-time: Immediate notifications when thresholds are exceeded
- ? Configurable: Customizable thresholds and report intervals
Discord Alert Example
⚡ High CPU Usage
CPU usage is 85.23% (threshold: 80.0%)
Alert Type: High CPU Usage
Severity: ⚠️ Warning
Server: Velocity Proxy
Timestamp: July 10, 2025 2:30 PM
Discord Status Report Example
✅ System Status Report
Current server performance metrics and health status
?️ CPU Usage: 45.32%
? Memory Usage: 65.2% (5.2 GB / 8.0 GB)
? Players Online: 85 / 100 (85.0%)
? Disk Usage: C:: 68.5% (15.8 GB free)
? Overall Health: ✅ Healthy
Quick Setup
- Create a Discord webhook in your server
- Copy the webhook URL
- Configure BubbleLog:
alerts:
discord:
enabled: true
webhook-url: "YOUR_WEBHOOK_URL_HERE"
status-reports:
enabled: true
interval: 3600 # Hourly reports
评论 0
登录后参与评分
还没有评论,来抢沙发吧