新功能:允许查看服务器地址

This commit is contained in:
CN-JS-HuiBai
2026-04-10 21:27:33 +08:00
parent cf1842f4e5
commit c9784ec48e
5 changed files with 57 additions and 9 deletions

View File

@@ -559,7 +559,9 @@ async function getServerDetails(baseUrl, instance, job) {
sockstatTcpMem: `node_sockstat_TCP_mem{instance="${node}",job="${job}"} * 4096`,
// Get individual partitions (excluding virtual and FUSE mounts)
partitions_size: `node_filesystem_size_bytes{instance="${node}", job="${job}", fstype!~"tmpfs|autofs|proc|sysfs|fuse.*", mountpoint!~"/tmp.*|/var/lib/docker/.*|/run/.*"}`,
partitions_free: `node_filesystem_free_bytes{instance="${node}", job="${job}", fstype!~"tmpfs|autofs|proc|sysfs|fuse.*", mountpoint!~"/tmp.*|/var/lib/docker/.*|/run/.*"}`
partitions_free: `node_filesystem_free_bytes{instance="${node}", job="${job}", fstype!~"tmpfs|autofs|proc|sysfs|fuse.*", mountpoint!~"/tmp.*|/var/lib/docker/.*|/run/.*"}`,
ipv4: `node_network_address_info{instance="${node}", job="${job}", address!~"127\\\\..*|10\\\\..*|172\\\\.(1[6-9]|2[0-9]|3[0-1])\\\\..*|192\\\\.168\\\\..*", address=~"\\\\d+\\\\.\\\\d+\\\\.\\\\d+\\\\.\\\\d+"}`,
ipv6: `node_network_address_info{instance="${node}", job="${job}", address=~".*:.*", address!~"fe80:.*|::1"}`
};
const results = {};
@@ -571,6 +573,8 @@ async function getServerDetails(baseUrl, instance, job) {
mountpoint: r.metric.mountpoint,
value: parseFloat(r.value[1]) || 0
}));
} else if (key === 'ipv4' || key === 'ipv6') {
results[key] = res.map(r => r.metric.address).filter(a => a);
} else {
results[key] = res.length > 0 ? parseFloat(res[0].value[1]) : 0;
}