Check your server status (CPU, Memory, Disk Usage) via nonebot
Project description
nonebot-plugin-status
✨ NoneBot 服务器状态(CPU, Memory, Disk Usage)查看插件 ✨
使用方式
通用:
- 发送 Command
状态
OneBot:
- 向机器人发送戳一戳表情
- 双击机器人头像戳一戳
配置项
warning GitHub 仓库中的文档为最新 DEV 版本,配置方式请参考 PyPI 上的文档。
配置方式:直接在 NoneBot 全局配置文件中添加以下配置项即可。
server_status_enabled
- 类型:
bool
- 默认值:
True
- 说明:是否启用服务器状态查看功能
server_status_only_superusers
- 类型:
bool
- 默认:
True
- 说明: 是否仅允许超级用户使用
超级用户需在配置文件中如下配置:
SUPERUSERS=["your qq id"]
server_status_template
- 类型:
str
- 默认: 请参考示例
- 说明:发送的消息模板,支持的方法、变量以及类型如下:
- relative_time (
Callable[[datetime], timedelta]
): 获取相对时间 - humanize_date (
Callable[[datetime], str]
): 人性化时间 - humanize_delta (
Callable[[timedelta], str]
): 人性化时间差 - cpu_usage (
float
): CPU 使用率 - per_cpu_usage (
List[float]
): 每个 CPU 核心的使用率 - memory_usage (
svmem
): 内存使用情况,包含 total, available, percent, used, free(, active, inactive, buffers, cached, shared) 属性 - swap_usage (
sswap
): 内存使用情况,包含 total, used, free, percent, sin, sout 属性 - disk_usage (
Dict[str, psutil._common.sdiskusage]
): 磁盘使用率,包含 total, used, free, percent 属性 - uptime (
datetime
): 服务器运行时间 - runtime (
datetime
): NoneBot 运行时间 - bot_connect_time (
Dict[str, datetime]
): 机器人连接时间
- relative_time (
配置文件示例(默认模板)
SERVER_STATUS_TEMPLATE='
CPU: {{ "%02d" % cpu_usage }}%
Memory: {{ "%02d" % memory_usage.percent }}%
Runtime: {{ runtime | relative_time | humanize_delta }}
{% if swap_usage.total %}Swap: {{ "%02d" % swap_usage.percent }}%{% endif %}
Disk:
{% for name, usage in disk_usage.items() %}
{{ name }}: {{ "%02d" % usage.percent }}%
{% endfor %}
'
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file nonebot-plugin-status-0.5.0.tar.gz
.
File metadata
- Download URL: nonebot-plugin-status-0.5.0.tar.gz
- Upload date:
- Size: 5.7 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0 CPython/3.10.4 Linux/5.4.0-1090-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 417323acc281957ad3b92ab6caf81359f9a2c59d05418037f66b9400cd393f0d |
|
MD5 | 20ca08a69d078f5a41db864f8715cdec |
|
BLAKE2b-256 | eaccdb567717a4001ffc453ebe842e42c0a405aaa5d2694736ae9abbb11660b8 |
File details
Details for the file nonebot_plugin_status-0.5.0-py3-none-any.whl
.
File metadata
- Download URL: nonebot_plugin_status-0.5.0-py3-none-any.whl
- Upload date:
- Size: 7.3 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: poetry/1.2.0 CPython/3.10.4 Linux/5.4.0-1090-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 21e056a89a6dac128ab24e83f5d96e5de6b6ecf7ef3fbd74299ec4090914c71f |
|
MD5 | 57fcc5fdbef94594b76f69f46dae8f71 |
|
BLAKE2b-256 | 8410c41da629351a3985f91038f00bfce974860d73f6c450cafdc98dee48fd8d |