This commit is contained in:
jhnine 2024-06-22 17:57:06 +08:00
parent e5c62d102f
commit 6dc92a18ed
5 changed files with 42 additions and 95 deletions

View File

@ -28,7 +28,7 @@ export function getTrainJob(params) {
// 大屏左上角数据返回
export function getComputeArea() {
return request({
url: 'pcm/v1/core/listDomainResource',
url: 'pcm/v1/core/getDomainResource',
method: 'get'
})
}
@ -57,6 +57,13 @@ export function getStorageData() {
})
}
export function getScreenInfo() {
return request({
url: 'pcm/v1/core/getScreenInfo',
method: 'get'
})
}
// 配置图片上传接口
export function uploadImage(data) {
return request({

View File

@ -67,18 +67,6 @@ export function getEarthDetails(area) {
})
}
// CPU平均使用率接口
// export function getCpuAverage(start, end, step) {
// return request({
// url: '/monitoringscreen/api/v1/query_range?query=avg(1%20-%20avg(rate(node_cpu_seconds_total%7Borigin_prometheus%3D~%22%22%2Cjob%3D~%22node-exporter%22%2Cmode%3D%22idle%22%7D%5B2m%5D))%20by%20(instance))%20*%20100' + '&start=' + start + '&end=' + end + '&step=' + step + '&_=1642578431700',
// method: 'get',
// data: JSON,
// headers: {
// 'Content-Type': 'application/json'
// }
// })
// }
// 整体总负载 平均使用情况
export function getTotalAverage() {
return request({
@ -87,54 +75,6 @@ export function getTotalAverage() {
})
}
// 计量计费接口总价格
export function getMeasure(start, end, step) {
return request({
url: process.env.VUE_APP_BASE_API + '/kapis/clusters/host/metering.kubesphere.io/v1alpha1/cluster' + '?start=' + start + '&end=' + end + '&step=' + step + 's&metrics_filter=meter_cluster_cpu_usage%7Cmeter_cluster_memory_usage%7Cmeter_cluster_net_bytes_transmitted%7Cmeter_cluster_net_bytes_received%7Cmeter_cluster_pvc_bytes_total&resources_filter=host',
method: 'get',
data: JSON,
headers: {
'Content-Type': 'application/json'
}
})
}
// // 内存整体负载接口
// export function getRamLoad(start, end, step) {
// return request({
// url: '/monitoringscreen/api/v1/query_range?query=sum(node_memory_MemTotal_bytes%7Borigin_prometheus%3D~%22%22%2Cjob%3D~%22node-exporter%22%7D%20-%20node_memory_MemAvailable_bytes%7Borigin_prometheus%3D~%22%22%2Cjob%3D~%22node-exporter%22%7D)&start=' + start + '&end=' + end + '&step=' + step + '&_=1642669327729',
// method: 'get',
// data: JSON,
// headers: {
// 'Content-Type': 'application/json'
// }
// })
// }
// 计量计费列表接口
export function getMeteringList(start, end, step) {
return request({
url: process.env.VUE_APP_BASE_API + '/kapis/clusters/host/metering.kubesphere.io/v1alpha1/cluster' + '?start=' + start + '&end=' + end + '&step=' + step + 's&metrics_filter=meter_cluster_cpu_usage%7Cmeter_cluster_memory_usage%7Cmeter_cluster_net_bytes_transmitted%7Cmeter_cluster_net_bytes_received%7Cmeter_cluster_pvc_bytes_total&resources_filter=host',
method: 'get',
data: JSON,
headers: {
'Content-Type': 'application/json'
}
})
}
// // CPU整体负载接口
// export function getCpuAllload(start, end) {
// return request({
// url: '/monitoringscreen/api/v1/query_range?query=node_load15%7Binstance%3D~%22k8s-master%22%7D&start=' + start + '&end=' + end + '&step=900&_=1645409802467',
// method: 'get',
// data: JSON,
// headers: {
// 'Content-Type': 'application/json'
// }
// })
// }
// 累计任务情况接口
export function getTaskList() {
return request({

View File

@ -5,7 +5,7 @@
<el-col :span="10"><div class="img" /></el-col>
<el-col :span="14">
<div class="text">
<el-carousel direction="vertical" :autoplay="false" @change="changeItem">
<el-carousel direction="vertical" :autoplay="true" @change="changeItem">
<el-carousel-item v-for="(item, index) in areaItem" :key="'areaItem' + index" class="areaList">
<div class="area">{{ item.domainName || 'DomainName' }}</div>
<table>

View File

@ -12,24 +12,40 @@
<script>
export default {
props: {
data: {
type: Object,
default: () => ({})
}
},
data() {
return {
dataArray: [
{
name: '算力中心总数(计算域)',
value: 34
value: '-'
},
{
name: '已接入算力 POps@FP16',
value: '112.06'
value: '-'
},
{
name: '接入集群数',
value: '48'
value: '-'
}
]
}
},
watch: {
data: {
handler(newValue, oldValue) {
this.dataArray[0].value = newValue.centerCount
this.dataArray[1].value = newValue.computingPower
this.dataArray[2].value = newValue.clusterCount
},
deep: true
}
},
methods: {
}

View File

@ -49,7 +49,7 @@
</div>
</div>
<div class="middle">
<ComputingPowerTotal />
<ComputingPowerTotal :data="powerData" />
</div>
<Earth :key="resizeKey" :center="{name: monitorSettingForm.center, longitude: Number(monitorSettingForm.centerPosition.split(',')[0]), latitude: Number(monitorSettingForm.centerPosition.split(',')[1])}" />
</div>
@ -77,7 +77,7 @@
</template>
<script>
import moment from 'moment'
// import moment from 'moment'
import ComputeDomain from './components/ComputeDomain.vue'
import ComputingPowerTotal from './components/ComputingPowerTotal.vue'
import CumulativeTasks from './components/CumulativeTasks.vue'
@ -86,7 +86,7 @@ import ComputingPowerTrend from './components/ComputingPowerTrend.vue'
import ComputingResourceLoad from './components/ComputingResourceLoad.vue'
import ComputingPowerUse from './components/ComputingPowerUse.vue'
import Earth from '@/views/prometheusMonitor/earth'
import { getComputePower, getCPUsage } from '@/api/container/monitorSelect.js'
import { getComputePower, getCPUsage, getScreenInfo } from '@/api/container/monitorSelect.js'
import { getTaskCount, createScheduleTask } from '@/api/top-menu/TotalNum'
import { order } from '@/utils/data-process'
import { getMonitorSetting } from '@/api/container/monitorSelect'
@ -113,6 +113,7 @@ export default {
fileList: [],
pageSize: 100,
taskData: {},
powerData: {},
currentDate: '',
tendData: { used: [], xData: [] },
centerData: { used: [], unused: [], xData: [] },
@ -129,6 +130,7 @@ export default {
this.$nextTick(() => {
this.getTend()
this.getPower()
this.getAccrueCenter()
})
@ -178,36 +180,22 @@ export default {
document.documentElement.style.fontSize = `${14 * scale}px`
}
},
getPower() {
getScreenInfo().then((res) => {
this.powerData = res.data
})
},
getTend() {
getComputePower().then((res) => {
this.tendData = { used: [], xData: [] }
if (res.dailyComputerPowers !== null) {
const timeArr = []// 12
for (let i = 0; i < 180; i++) {
timeArr.push(
`${moment(new Date()).subtract(i, 'days').format('YYYY-MM-DD')}`
)
}
timeArr.reverse()//
const arr = [] //
for (let i = 0; i < timeArr.length; i++) {
arr.push({ date: timeArr[i], computerPower: 0 })
// arr
for (let j = 0; j < res.dailyComputerPowers.length; j++) {
if (res.dailyComputerPowers[j].date === timeArr[i]) {
arr[i] = { date: res.dailyComputerPowers[j].date, computerPower: res.dailyComputerPowers[j].computerPower }
}
}
}
const arr = res.data?.chart?.thirtyDayData //
if (arr !== null) {
arr.forEach((item) => {
this.tendData.used.push(item.computerPower.toFixed(1))
this.tendData.xData.push(item.date)
this.tendData.used.push(item.cardTime)
this.tendData.xData.push(item.perDay)
})
}
})
// this.tendData.used = [59688.1, 59252.5, 59189.0, 55766.5, 55537.2, 54804.4, 52764.9]
// this.tendData.xData = ['2022-06-30', '2022-07-31', '2022-07-31', '2022-08-31', '2022-09-30', '2022-10-31', '2022-11-30']
},
getAccrueCenter() {
getCPUsage().then((res) => {
@ -236,10 +224,6 @@ export default {
})
}
})
// this.centerData.used = [12, 22, 3, 55, 66, 77, 44, 32]
// this.centerData.unused = [12, 22, 3, 55, 66, 77, 44, 32]
// this.centerData.xData = ['2/1', '2/2', '2/3', '2/4', '2/5', '2/6', '2/7', '2/8']
},
getTrainJob() {
getTaskCount().then(e => {