diff --git a/.env.production b/.env.production index db680f3..79bfd58 100644 --- a/.env.production +++ b/.env.production @@ -3,5 +3,5 @@ ENV = 'production' # base api VUE_APP_BASE_API = '/jcc-ks' -VUE_APP_PUBLIC_SOURCE_API = '/monitor' +VUE_APP_PUBLIC_SOURCE_API = '' diff --git a/src/api/top-menu/TotalNum.js b/src/api/top-menu/TotalNum.js index 20351d6..2700dff 100644 --- a/src/api/top-menu/TotalNum.js +++ b/src/api/top-menu/TotalNum.js @@ -70,7 +70,8 @@ export function getEarthDetails(area) { // 整体总负载 平均使用情况 export function getTotalAverage() { return request({ - url: '/jcc-schedule/api/v1/resource/getOverallMetrics', + url: '/pcm/v1/core/getScreenChart', + // url: '/jcc-schedule/api/v1/resource/getOverallMetrics', method: 'get' }) } diff --git a/src/views/monitorSelectPcm/components/ComputingResourceLoad.vue b/src/views/monitorSelectPcm/components/ComputingResourceLoad.vue index 777495e..fa95144 100644 --- a/src/views/monitorSelectPcm/components/ComputingResourceLoad.vue +++ b/src/views/monitorSelectPcm/components/ComputingResourceLoad.vue @@ -18,10 +18,10 @@ export default { } return { day, - ramLoad: [2, 3, 4, 5, 6, 4, 5], // 内存整体负载 - cpuLoad: [1, 2, 3, 4, 5, 3, 4], // CPU整体负载 - cpuAverage: [3, 4, 5, 3, 4, 3, 4], // cpu 平均负载 - ramAverage: [7, 6, 5, 4, 6, 5, 4] // 内存平均负载 + ramLoad: [], // 内存整体负载 + cpuLoad: [], // CPU整体负载 + cpuAverage: [], // cpu 平均负载 + ramAverage: [] // 内存平均负载 } }, computed: { @@ -40,33 +40,38 @@ export default { // 获取资源负载状况 async getAllData() { await getTotalAverage().then(res => { - const data = res.data - // 内存整体负载 (GB) - const ramData = data.find(item => item.metric_name === 'mem_total_usage').data.result[0].values || [] - ramData.forEach(element => { - this.ramLoad.push(((element[1] - 0) / 1024 / 1024 / 1024).toFixed(2)) - // this.date.push(moment(element[0] * 1000).format('MM/DD')) - }) - this.ramLoad = this.ramLoad.slice(0, 7) - // CPU整体负载 (Core) - const cpuLoad = data.find(item => item.metric_name === 'cpu_total_usage').data.result[0].values || [] - cpuLoad.forEach(element => { - this.cpuLoad.push(((element[1] - 0)).toFixed(2)) - }) - this.cpuLoad = this.cpuLoad.slice(0, 7) - // cpu 平均负载 (%) - const cpuData = data.find(item => item.metric_name === 'cpu_avg_usage').data.result[0].values || [] - cpuData.forEach(element => { - this.cpuAverage.push((element[1] - 0).toFixed(2)) - // this.date.push(moment(element[0] * 1000).format('MM/DD')) - }) - this.cpuAverage = this.cpuAverage.slice(0, 7) - // 内存平均负载 (%) - const ramAverage = data.find(item => item.metric_name === 'mem_avg_usage').data.result[0].values || [] - ramAverage.forEach(element => { - this.ramAverage.push(((element[1] - 0) / 1024 / 1024 / 1024).toFixed(2)) - }) - this.ramAverage = this.ramAverage.slice(0, 7) + this.ramLoad = res.data.memoryLoad + this.ramAverage = res.data.memoryAvg + this.cpuLoad = res.data.cpuLoad + this.cpuAverage = res.data.cpuAvg + + // const data = res.data + // // 内存整体负载 (GB) + // const ramData = data.find(item => item.metric_name === 'mem_total_usage').data.result[0].values || [] + // ramData.forEach(element => { + // this.ramLoad.push(((element[1] - 0) / 1024 / 1024 / 1024).toFixed(2)) + // // this.date.push(moment(element[0] * 1000).format('MM/DD')) + // }) + // this.ramLoad = this.ramLoad.slice(0, 7) + // // CPU整体负载 (Core) + // const cpuLoad = data.find(item => item.metric_name === 'cpu_total_usage').data.result[0].values || [] + // cpuLoad.forEach(element => { + // this.cpuLoad.push(((element[1] - 0)).toFixed(2)) + // }) + // this.cpuLoad = this.cpuLoad.slice(0, 7) + // // cpu 平均负载 (%) + // const cpuData = data.find(item => item.metric_name === 'cpu_avg_usage').data.result[0].values || [] + // cpuData.forEach(element => { + // this.cpuAverage.push((element[1] - 0).toFixed(2)) + // // this.date.push(moment(element[0] * 1000).format('MM/DD')) + // }) + // this.cpuAverage = this.cpuAverage.slice(0, 7) + // // 内存平均负载 (%) + // const ramAverage = data.find(item => item.metric_name === 'mem_avg_usage').data.result[0].values || [] + // ramAverage.forEach(element => { + // this.ramAverage.push(((element[1] - 0) / 1024 / 1024 / 1024).toFixed(2)) + // }) + // this.ramAverage = this.ramAverage.slice(0, 7) }) this.initCharts() }, diff --git a/src/views/monitorSelectPcm/components/StorageResourceUsage.vue b/src/views/monitorSelectPcm/components/StorageResourceUsage.vue index c72786a..49334c1 100644 --- a/src/views/monitorSelectPcm/components/StorageResourceUsage.vue +++ b/src/views/monitorSelectPcm/components/StorageResourceUsage.vue @@ -20,17 +20,25 @@ diff --git a/src/views/monitorSelectPcm/index.vue b/src/views/monitorSelectPcm/index.vue index ae1cfb9..df85291 100644 --- a/src/views/monitorSelectPcm/index.vue +++ b/src/views/monitorSelectPcm/index.vue @@ -44,7 +44,7 @@
存储资源用量