fix: modify
parent
40d690697a
commit
5d3c797e5a
|
@ -18,6 +18,7 @@ export default {
|
|||
const chartDom = document.getElementById('RealTimeUsed')
|
||||
this.myChart = echarts.init(chartDom)
|
||||
this.getRealTimeUesdView()
|
||||
this.getRealTimeData()
|
||||
this.timer = setInterval(() => {
|
||||
this.getRealTimeData()
|
||||
}, 10000)
|
||||
|
@ -29,8 +30,9 @@ export default {
|
|||
// 平台实用利用率
|
||||
async getRealTimeData() {
|
||||
const res = await getRealTimeUtilization()
|
||||
if (res.status !== 'success') return
|
||||
this.used = (res.data?.result?.[0]?.value[1] || 25.7).toFixed(2)
|
||||
if (res?.status !== 'success') return
|
||||
const value = res.data?.result?.[0]?.value[1] * 100 || 0
|
||||
this.used = value.toFixed(2)
|
||||
},
|
||||
getRealTimeUesdView() {
|
||||
let angle = 0
|
||||
|
@ -59,7 +61,7 @@ export default {
|
|||
name: 'ring5',
|
||||
type: 'custom',
|
||||
coordinateSystem: 'none',
|
||||
renderItem: function(params, api) {
|
||||
renderItem: function (params, api) {
|
||||
return {
|
||||
type: 'arc',
|
||||
shape: {
|
||||
|
@ -83,7 +85,7 @@ export default {
|
|||
name: 'ring5',
|
||||
type: 'custom',
|
||||
coordinateSystem: 'none',
|
||||
renderItem: function(params, api) {
|
||||
renderItem: function (params, api) {
|
||||
return {
|
||||
type: 'arc',
|
||||
shape: {
|
||||
|
@ -107,7 +109,7 @@ export default {
|
|||
name: 'ring5',
|
||||
type: 'custom',
|
||||
coordinateSystem: 'none',
|
||||
renderItem: function(params, api) {
|
||||
renderItem: function (params, api) {
|
||||
return {
|
||||
type: 'arc',
|
||||
shape: {
|
||||
|
@ -131,7 +133,7 @@ export default {
|
|||
name: 'ring5',
|
||||
type: 'custom',
|
||||
coordinateSystem: 'none',
|
||||
renderItem: function(params, api) {
|
||||
renderItem: function (params, api) {
|
||||
return {
|
||||
type: 'arc',
|
||||
shape: {
|
||||
|
@ -155,7 +157,7 @@ export default {
|
|||
name: 'ring5',
|
||||
type: 'custom',
|
||||
coordinateSystem: 'none',
|
||||
renderItem: function(params, api) {
|
||||
renderItem: function (params, api) {
|
||||
const x0 = api.getWidth() / 2
|
||||
const y0 = api.getHeight() / 2
|
||||
const r = (Math.min(api.getWidth(), api.getHeight()) / 2) * 0.65
|
||||
|
@ -180,7 +182,7 @@ export default {
|
|||
name: 'ring5', // 绿点
|
||||
type: 'custom',
|
||||
coordinateSystem: 'none',
|
||||
renderItem: function(params, api) {
|
||||
renderItem: function (params, api) {
|
||||
const x0 = api.getWidth() / 2
|
||||
const y0 = api.getHeight() / 2
|
||||
const r = (Math.min(api.getWidth(), api.getHeight()) / 2) * 0.65
|
||||
|
|
|
@ -76,7 +76,7 @@ export default {
|
|||
// 平台实用利用率
|
||||
async getQueryRangeData() {
|
||||
const res = await getAverageUtilizationTrend()
|
||||
if (res.status !== 'success') return
|
||||
if (res?.status !== 'success') return
|
||||
this.tableData7 = res.data?.result?.[0]?.values?.map((v) => {
|
||||
return {
|
||||
name: v[0],
|
||||
|
|
|
@ -89,20 +89,28 @@ export const getHelp = () =>
|
|||
console.log(error)
|
||||
})
|
||||
// 实时利用率
|
||||
const query = 'avg(1 - avg(rate(node_cpu_seconds_total{mode="idle"}[2m])) by (instance)) * 100'
|
||||
export const getRealTimeUtilization = () =>
|
||||
axios
|
||||
.get('/prometheus/api/v1/query?query=avg(1 - avg(rate(node_cpu_seconds_total{mode="idle"}[2m])) by (instance)) * 100')
|
||||
.get(`/prometheus/api/v1/query?query=${encodeURIComponent(query)}`)
|
||||
.then(function (response) {
|
||||
return response.data
|
||||
})
|
||||
.catch(function (error) {
|
||||
console.log(error)
|
||||
})
|
||||
|
||||
const query2 = 'avg(1 - avg(rate(node_cpu_seconds_total{mode="idle"}[2m]))) * 100'
|
||||
const todayTimestamp = new Date().getTime()
|
||||
const oneYearAgo = new Date()
|
||||
oneYearAgo.setFullYear(oneYearAgo.getFullYear() - 1)
|
||||
const oneYearAgoTimestamp = oneYearAgo.getTime()
|
||||
const start = Math.floor(oneYearAgoTimestamp / 1000)
|
||||
const end = Math.floor(todayTimestamp / 1000)
|
||||
const step = '1036800'
|
||||
// 平均利用率趋势
|
||||
export const getAverageUtilizationTrend = () =>
|
||||
axios
|
||||
.get('/prometheus/api/v1/query_range')
|
||||
.get(`/prometheus/api/v1/query_range?query=${encodeURIComponent(query2)}&start=${start}&end=${end}&step=${step}`)
|
||||
.then(function (response) {
|
||||
return response.data
|
||||
})
|
||||
|
|
|
@ -229,13 +229,12 @@ export default {
|
|||
if (item.keyName === 'userNum') {
|
||||
state.introItems[0].value = item.numValue
|
||||
}
|
||||
if (item.keyName === 'softNum') {
|
||||
if (item.keyName === 'orgNum') {
|
||||
state.introItems[1].value = item.numValue
|
||||
}
|
||||
if (item.keyName === 'orgNum') {
|
||||
if (item.keyName === 'softNum') {
|
||||
state.introItems[2].value = item.numValue
|
||||
}
|
||||
|
||||
if (item.keyName === 'timeSum') {
|
||||
state.introItems[3].value = item.numValue
|
||||
}
|
||||
|
|
|
@ -27,25 +27,6 @@ module.exports = {
|
|||
errors: true
|
||||
},
|
||||
proxy: {
|
||||
'/api/sms/messageService': {
|
||||
target: 'ws://' + proxyUrl,
|
||||
changeOrigin: true,
|
||||
ws: false
|
||||
},
|
||||
'/api': {
|
||||
target: httpType + proxyUrl,
|
||||
changeOrigin: true,
|
||||
ws: false
|
||||
},
|
||||
'/config-files': {
|
||||
target: httpType + proxyUrl
|
||||
},
|
||||
'/scr-web/static/img': {
|
||||
target: 'http://localhost:8083',
|
||||
pathRewrite: {
|
||||
'^/scr-web/static/img': '/static/img' // rewrite path
|
||||
}
|
||||
},
|
||||
'/screen_server': {
|
||||
target: 'http://gn.api.aipow.cn:8080',
|
||||
changeOrigin: true,
|
||||
|
|
Loading…
Reference in New Issue