api
This commit is contained in:
parent
f084bb4311
commit
d3622e132e
|
@ -3,5 +3,5 @@ ENV = 'production'
|
||||||
|
|
||||||
# base api
|
# base api
|
||||||
VUE_APP_BASE_API = '/jcc-ks'
|
VUE_APP_BASE_API = '/jcc-ks'
|
||||||
VUE_APP_PUBLIC_SOURCE_API = '/monitor'
|
VUE_APP_PUBLIC_SOURCE_API = ''
|
||||||
|
|
||||||
|
|
|
@ -70,7 +70,8 @@ export function getEarthDetails(area) {
|
||||||
// 整体总负载 平均使用情况
|
// 整体总负载 平均使用情况
|
||||||
export function getTotalAverage() {
|
export function getTotalAverage() {
|
||||||
return request({
|
return request({
|
||||||
url: '/jcc-schedule/api/v1/resource/getOverallMetrics',
|
url: '/pcm/v1/core/getScreenChart',
|
||||||
|
// url: '/jcc-schedule/api/v1/resource/getOverallMetrics',
|
||||||
method: 'get'
|
method: 'get'
|
||||||
})
|
})
|
||||||
}
|
}
|
||||||
|
|
|
@ -18,10 +18,10 @@ export default {
|
||||||
}
|
}
|
||||||
return {
|
return {
|
||||||
day,
|
day,
|
||||||
ramLoad: [2, 3, 4, 5, 6, 4, 5], // 内存整体负载
|
ramLoad: [], // 内存整体负载
|
||||||
cpuLoad: [1, 2, 3, 4, 5, 3, 4], // CPU整体负载
|
cpuLoad: [], // CPU整体负载
|
||||||
cpuAverage: [3, 4, 5, 3, 4, 3, 4], // cpu 平均负载
|
cpuAverage: [], // cpu 平均负载
|
||||||
ramAverage: [7, 6, 5, 4, 6, 5, 4] // 内存平均负载
|
ramAverage: [] // 内存平均负载
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
computed: {
|
computed: {
|
||||||
|
@ -40,33 +40,38 @@ export default {
|
||||||
// 获取资源负载状况
|
// 获取资源负载状况
|
||||||
async getAllData() {
|
async getAllData() {
|
||||||
await getTotalAverage().then(res => {
|
await getTotalAverage().then(res => {
|
||||||
const data = res.data
|
this.ramLoad = res.data.memoryLoad
|
||||||
// 内存整体负载 (GB)
|
this.ramAverage = res.data.memoryAvg
|
||||||
const ramData = data.find(item => item.metric_name === 'mem_total_usage').data.result[0].values || []
|
this.cpuLoad = res.data.cpuLoad
|
||||||
ramData.forEach(element => {
|
this.cpuAverage = res.data.cpuAvg
|
||||||
this.ramLoad.push(((element[1] - 0) / 1024 / 1024 / 1024).toFixed(2))
|
|
||||||
// this.date.push(moment(element[0] * 1000).format('MM/DD'))
|
// const data = res.data
|
||||||
})
|
// // 内存整体负载 (GB)
|
||||||
this.ramLoad = this.ramLoad.slice(0, 7)
|
// const ramData = data.find(item => item.metric_name === 'mem_total_usage').data.result[0].values || []
|
||||||
// CPU整体负载 (Core)
|
// ramData.forEach(element => {
|
||||||
const cpuLoad = data.find(item => item.metric_name === 'cpu_total_usage').data.result[0].values || []
|
// this.ramLoad.push(((element[1] - 0) / 1024 / 1024 / 1024).toFixed(2))
|
||||||
cpuLoad.forEach(element => {
|
// // this.date.push(moment(element[0] * 1000).format('MM/DD'))
|
||||||
this.cpuLoad.push(((element[1] - 0)).toFixed(2))
|
// })
|
||||||
})
|
// this.ramLoad = this.ramLoad.slice(0, 7)
|
||||||
this.cpuLoad = this.cpuLoad.slice(0, 7)
|
// // CPU整体负载 (Core)
|
||||||
// cpu 平均负载 (%)
|
// const cpuLoad = data.find(item => item.metric_name === 'cpu_total_usage').data.result[0].values || []
|
||||||
const cpuData = data.find(item => item.metric_name === 'cpu_avg_usage').data.result[0].values || []
|
// cpuLoad.forEach(element => {
|
||||||
cpuData.forEach(element => {
|
// this.cpuLoad.push(((element[1] - 0)).toFixed(2))
|
||||||
this.cpuAverage.push((element[1] - 0).toFixed(2))
|
// })
|
||||||
// this.date.push(moment(element[0] * 1000).format('MM/DD'))
|
// this.cpuLoad = this.cpuLoad.slice(0, 7)
|
||||||
})
|
// // cpu 平均负载 (%)
|
||||||
this.cpuAverage = this.cpuAverage.slice(0, 7)
|
// const cpuData = data.find(item => item.metric_name === 'cpu_avg_usage').data.result[0].values || []
|
||||||
// 内存平均负载 (%)
|
// cpuData.forEach(element => {
|
||||||
const ramAverage = data.find(item => item.metric_name === 'mem_avg_usage').data.result[0].values || []
|
// this.cpuAverage.push((element[1] - 0).toFixed(2))
|
||||||
ramAverage.forEach(element => {
|
// // this.date.push(moment(element[0] * 1000).format('MM/DD'))
|
||||||
this.ramAverage.push(((element[1] - 0) / 1024 / 1024 / 1024).toFixed(2))
|
// })
|
||||||
})
|
// this.cpuAverage = this.cpuAverage.slice(0, 7)
|
||||||
this.ramAverage = this.ramAverage.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()
|
this.initCharts()
|
||||||
},
|
},
|
||||||
|
|
|
@ -20,17 +20,25 @@
|
||||||
</template>
|
</template>
|
||||||
|
|
||||||
<script>
|
<script>
|
||||||
import { getStorageData } from '@/api/container/monitorSelect'
|
|
||||||
export default {
|
export default {
|
||||||
|
props: {
|
||||||
|
data: {
|
||||||
|
type: Object,
|
||||||
|
default: () => ({})
|
||||||
|
}
|
||||||
|
},
|
||||||
data() {
|
data() {
|
||||||
return {
|
return {
|
||||||
storageData: {}
|
storageData: {}
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
mounted() {
|
watch: {
|
||||||
getStorageData().then(e => {
|
data: {
|
||||||
this.storageData = e
|
handler(newValue, oldValue) {
|
||||||
})
|
this.storageData = newValue
|
||||||
|
},
|
||||||
|
deep: true
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
</script>
|
</script>
|
||||||
|
|
|
@ -44,7 +44,7 @@
|
||||||
</div>
|
</div>
|
||||||
<div class="right_3">
|
<div class="right_3">
|
||||||
<div class="title"><p>存储资源用量</p></div>
|
<div class="title"><p>存储资源用量</p></div>
|
||||||
<StorageResourceUsage />
|
<StorageResourceUsage :data="powerData" />
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
</div>
|
</div>
|
||||||
|
|
Loading…
Reference in New Issue