fix bug
This commit is contained in:
Binary file not shown.
|
Before Width: | Height: | Size: 62 KiB After Width: | Height: | Size: 882 KiB |
@@ -24,7 +24,7 @@ const carouselItem = computed(() => [
|
|||||||
{
|
{
|
||||||
// slogan: t('login.banner.slogan1'),
|
// slogan: t('login.banner.slogan1'),
|
||||||
// subSlogan: t('login.banner.subSlogan1'),
|
// subSlogan: t('login.banner.subSlogan1'),
|
||||||
image: 'https://ops.apinb.com/assets/login-image-CPDtwfmL.png',
|
image: bannerImage,
|
||||||
},
|
},
|
||||||
// {
|
// {
|
||||||
// slogan: t('login.banner.slogan2'),
|
// slogan: t('login.banner.slogan2'),
|
||||||
|
|||||||
@@ -15,11 +15,6 @@ export const columns = [
|
|||||||
title: '名称',
|
title: '名称',
|
||||||
width: 150,
|
width: 150,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
dataIndex: 'host',
|
|
||||||
title: '主机地址',
|
|
||||||
width: 150,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
dataIndex: 'ip_address',
|
dataIndex: 'ip_address',
|
||||||
title: 'IP 地址',
|
title: 'IP 地址',
|
||||||
@@ -30,11 +25,6 @@ export const columns = [
|
|||||||
title: '操作系统',
|
title: '操作系统',
|
||||||
width: 120,
|
width: 120,
|
||||||
},
|
},
|
||||||
{
|
|
||||||
dataIndex: 'os_version',
|
|
||||||
title: '系统版本',
|
|
||||||
width: 120,
|
|
||||||
},
|
|
||||||
{
|
{
|
||||||
dataIndex: 'server_type',
|
dataIndex: 'server_type',
|
||||||
title: '类型',
|
title: '类型',
|
||||||
@@ -63,6 +53,24 @@ export const columns = [
|
|||||||
width: 100,
|
width: 100,
|
||||||
slotName: 'data_collection',
|
slotName: 'data_collection',
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'cpu_state',
|
||||||
|
title: 'CPU使用率',
|
||||||
|
width: 150,
|
||||||
|
slotName: 'cpu',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'memory_state',
|
||||||
|
title: '内存使用率',
|
||||||
|
width: 150,
|
||||||
|
slotName: 'memory',
|
||||||
|
},
|
||||||
|
{
|
||||||
|
dataIndex: 'disk_state',
|
||||||
|
title: '硬盘使用率',
|
||||||
|
width: 150,
|
||||||
|
slotName: 'disk',
|
||||||
|
},
|
||||||
{
|
{
|
||||||
dataIndex: 'status',
|
dataIndex: 'status',
|
||||||
title: '状态',
|
title: '状态',
|
||||||
|
|||||||
@@ -445,9 +445,9 @@ const getAllMetrics = async () => {
|
|||||||
} catch (urlError) {
|
} catch (urlError) {
|
||||||
console.warn(`服务器 ${record.name} 的 agent_config 不是合法的 URL:`, metricsUrl)
|
console.warn(`服务器 ${record.name} 的 agent_config 不是合法的 URL:`, metricsUrl)
|
||||||
// 设置默认值 0
|
// 设置默认值 0
|
||||||
record.cpu_info = { value: 0, total: '', used: '' }
|
record.cpu_state = { value: 0, total: '', used: '' }
|
||||||
record.memory_info = { value: 0, total: '', used: '' }
|
record.memory_state = { value: 0, total: '', used: '' }
|
||||||
record.disk_info = { value: 0, total: '', used: '' }
|
record.disk_state = { value: 0, total: '', used: '' }
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
@@ -458,19 +458,19 @@ const getAllMetrics = async () => {
|
|||||||
|
|
||||||
if (response.data) {
|
if (response.data) {
|
||||||
// 更新记录的监控数据
|
// 更新记录的监控数据
|
||||||
record.cpu_info = {
|
record.cpu_state = {
|
||||||
value: response.data.cpu_usage || 0,
|
value: response.data.cpu_usage || 0,
|
||||||
total: response.data.cpu?.[0]?.cores ? `${response.data.cpu[0].cores}核` : '',
|
total: response.data.cpu?.[0]?.cores ? `${response.data.cpu[0].cores}核` : '',
|
||||||
used: '',
|
used: '',
|
||||||
}
|
}
|
||||||
|
|
||||||
record.memory_info = {
|
record.memory_state = {
|
||||||
value: response.data.mem_usage?.used_percent || 0,
|
value: response.data.mem_usage?.used_percent || 0,
|
||||||
total: response.data.mem_usage?.total ? `${(response.data.mem_usage.total / 1024 / 1024 / 1024).toFixed(1)}GB` : '',
|
total: response.data.mem_usage?.total ? `${(response.data.mem_usage.total / 1024 / 1024 / 1024).toFixed(1)}GB` : '',
|
||||||
used: response.data.mem_usage?.used ? `${(response.data.mem_usage.used / 1024 / 1024 / 1024).toFixed(1)}GB` : '',
|
used: response.data.mem_usage?.used ? `${(response.data.mem_usage.used / 1024 / 1024 / 1024).toFixed(1)}GB` : '',
|
||||||
}
|
}
|
||||||
|
|
||||||
record.disk_info = {
|
record.disk_state = {
|
||||||
value: response.data.disk_usage?.used_percent || 0,
|
value: response.data.disk_usage?.used_percent || 0,
|
||||||
total: response.data.disk_usage?.total ? `${(response.data.disk_usage.total / 1024 / 1024 / 1024).toFixed(0)}GB` : '',
|
total: response.data.disk_usage?.total ? `${(response.data.disk_usage.total / 1024 / 1024 / 1024).toFixed(0)}GB` : '',
|
||||||
used: response.data.disk_usage?.used ? `${(response.data.disk_usage.used / 1024 / 1024 / 1024).toFixed(0)}GB` : '',
|
used: response.data.disk_usage?.used ? `${(response.data.disk_usage.used / 1024 / 1024 / 1024).toFixed(0)}GB` : '',
|
||||||
@@ -479,15 +479,15 @@ const getAllMetrics = async () => {
|
|||||||
} catch (error) {
|
} catch (error) {
|
||||||
console.warn(`获取服务器 ${record.name} 的监控指标失败:`, error)
|
console.warn(`获取服务器 ${record.name} 的监控指标失败:`, error)
|
||||||
// 初始化默认值
|
// 初始化默认值
|
||||||
record.cpu_info = { value: 0, total: '', used: '' }
|
record.cpu_state = { value: 0, total: '', used: '' }
|
||||||
record.memory_info = { value: 0, total: '', used: '' }
|
record.memory_state = { value: 0, total: '', used: '' }
|
||||||
record.disk_info = { value: 0, total: '', used: '' }
|
record.disk_state = { value: 0, total: '', used: '' }
|
||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 没有配置 agent,设置默认值
|
// 没有配置 agent,设置默认值
|
||||||
record.cpu_info = { value: 0, total: '', used: '' }
|
record.cpu_state = { value: 0, total: '', used: '' }
|
||||||
record.memory_info = { value: 0, total: '', used: '' }
|
record.memory_state = { value: 0, total: '', used: '' }
|
||||||
record.disk_info = { value: 0, total: '', used: '' }
|
record.disk_state = { value: 0, total: '', used: '' }
|
||||||
}
|
}
|
||||||
})
|
})
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user