mirror of
https://github.com/snowykami/server-status-client.git
synced 2024-11-22 07:07:58 +08:00
✨ 排除linux下无关分区
This commit is contained in:
parent
89d7fa3145
commit
db7aeabe7b
@ -90,6 +90,9 @@ sudo systemctl start server-status-client
|
|||||||
```shell
|
```shell
|
||||||
git pull
|
git pull
|
||||||
sudo systemctl restart server-status-client
|
sudo systemctl restart server-status-client
|
||||||
|
#
|
||||||
|
git pull
|
||||||
|
systemctl restart server-status-client
|
||||||
```
|
```
|
||||||
|
|
||||||
### 服务端
|
### 服务端
|
||||||
|
@ -6,6 +6,8 @@ from typing import Any
|
|||||||
import psutil
|
import psutil
|
||||||
import requests
|
import requests
|
||||||
|
|
||||||
|
excluded_partition_prefix = ("/var", "/boot", "/run", "/proc", "/sys", "/dev", "/tmp", "/snap")
|
||||||
|
|
||||||
|
|
||||||
def log(*args):
|
def log(*args):
|
||||||
# 在输出前加上时间
|
# 在输出前加上时间
|
||||||
@ -229,6 +231,10 @@ class Client:
|
|||||||
for part in psutil.disk_partitions():
|
for part in psutil.disk_partitions():
|
||||||
try:
|
try:
|
||||||
usage = psutil.disk_usage(part.mountpoint)
|
usage = psutil.disk_usage(part.mountpoint)
|
||||||
|
|
||||||
|
if part.mountpoint.startswith(excluded_partition_prefix):
|
||||||
|
continue
|
||||||
|
|
||||||
self.hardware.disks[part.device] = {
|
self.hardware.disks[part.device] = {
|
||||||
"total": usage.total,
|
"total": usage.total,
|
||||||
"used": usage.used,
|
"used": usage.used,
|
||||||
|
Loading…
Reference in New Issue
Block a user