JEECG-BOOT 2.0.2版本发布

This commit is contained in:
zhangdaihao
2019-07-05 15:38:38 +08:00
parent 2917239a9d
commit 31422b1ea8
424 changed files with 34593 additions and 20808 deletions

View File

@ -0,0 +1,49 @@
<template>
<a-card title="磁盘监控">
<a-row>
<template v-if="diskInfo && diskInfo.length>0">
<a-col :span="8" v-for="(item,index) in diskInfo" :key=" 'diskInfo'+index ">
<dash-chart-demo :title="item.name" :datasource="item.restPPT"></dash-chart-demo>
</a-col>
</template>
</a-row>
</a-card>
</template>
<script>
import { getAction } from '@/api/manage'
import DashChartDemo from '@/components/chart/DashChartDemo'
import ARow from 'ant-design-vue/es/grid/Row'
export default {
name: 'DiskMonitoring',
components:{
ARow,
DashChartDemo,
},
data() {
return {
description: '磁盘监控',
//数据集
diskInfo:[],
url:{
queryDiskInfo:'actuator/redis/queryDiskInfo',
}
}
},
created() {
getAction(this.url.queryDiskInfo).then((res)=>{
if(res.success){
for(var i=0;i<res.result.length;i++){
res.result[i].restPPT = res.result[i].restPPT/10;
}
this.diskInfo = res.result;
}
})
}
}
</script>
<style scoped>
</style>

View File

@ -0,0 +1,148 @@
<template>
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
<a-card :bordered="false" class="card-area">
<a-alert type="info" :showIcon="true">
<div slot="message">
共追踪到 {{ dataSource.length }} 条近期HTTP请求记录
<a-divider type="vertical"/>
<a @click="handleClickUpdate">立即刷新</a>
</div>
</a-alert>
<!-- 表格区域 -->
<a-table
:columns="columns"
:dataSource="dataSource"
:pagination="pagination"
:loading="tableLoading"
:scroll="{ x: 900 }"
style="margin-top: 20px;"
@change="handleTableChange">
<template slot="timeTaken" slot-scope="text">
<a-tag v-if="text < 500" color="green">{{ text }} ms</a-tag>
<a-tag v-else-if="text < 1000" color="cyan">{{ text }} ms</a-tag>
<a-tag v-else-if="text < 1500" color="orange">{{ text }} ms</a-tag>
<a-tag v-else color="red">{{ text }} ms</a-tag>
</template>
<template slot="responseStatus" slot-scope="text">
<a-tag v-if="text < 200" color="pink">{{ text }} </a-tag>
<a-tag v-else-if="text < 201" color="green">{{ text }} </a-tag>
<a-tag v-else-if="text < 399" color="cyan">{{ text }} </a-tag>
<a-tag v-else-if="text < 403" color="orange">{{ text }} </a-tag>
<a-tag v-else-if="text < 501" color="red">{{ text }} </a-tag>
<span v-else>{{ text }}</span>
</template>
<template slot="requestMethod" slot-scope="text">
<a-tag v-if="text === 'GET'" color="#87d068">{{ text }}</a-tag>
<a-tag v-else-if="text === 'POST'" color="#2db7f5">{{ text }}</a-tag>
<a-tag v-else-if="text === 'PUT'" color="#ffba5a">{{ text }}</a-tag>
<a-tag v-else-if="text === 'DELETE'" color="#f50">{{ text }}</a-tag>
<span v-else>{{ text }} ms</span>
</template>
</a-table>
</a-card>
</a-skeleton>
</template>
<script>
import moment from 'moment'
import { getAction } from '@/api/manage'
moment.locale('zh-cn')
export default {
data() {
return {
advanced: false,
dataSource: [],
pagination: {
defaultPageSize: 10,
defaultCurrent: 1,
pageSizeOptions: ['10', '20', '30', '40', '100'],
showQuickJumper: true,
showSizeChanger: true,
showTotal: (total, range) => `显示 ${range[0]} ~ ${range[1]} 条记录,共 ${total} 条记录`
},
loading: true,
tableLoading: true
}
},
computed: {
columns() {
return [{
title: '请求时间',
dataIndex: 'timestamp',
customRender(text) {
return moment(text).format('YYYY-MM-DD HH:mm:ss')
}
}, {
title: '请求方法',
dataIndex: 'request.method',
scopedSlots: { customRender: 'requestMethod' },
filters: [
{ text: 'GET', value: 'GET' },
{ text: 'POST', value: 'POST' },
{ text: 'PUT', value: 'PUT' },
{ text: 'DELETE', value: 'DELETE' }
],
filterMultiple: true,
onFilter: (value, record) => record.request.method.includes(value)
}, {
title: '请求URL',
dataIndex: 'request.uri',
customRender(text) {
return text.split('?')[0]
}
}, {
title: '响应状态',
dataIndex: 'response.status',
scopedSlots: { customRender: 'responseStatus' }
}, {
title: '请求耗时',
dataIndex: 'timeTaken',
scopedSlots: { customRender: 'timeTaken' }
}]
}
},
mounted() {
this.fetch()
},
methods: {
handleClickUpdate() {
this.fetch()
},
handleTableChange() {
this.fetch()
},
fetch() {
this.tableLoading = true
getAction('actuator/httptrace').then((data) => {
let filterData = []
for (let d of data.traces) {
if (d.request.method !== 'OPTIONS' && d.request.uri.indexOf('httptrace') === -1) {
filterData.push(d)
}
}
this.dataSource = filterData
}).catch((e) => {
console.error(e)
this.$message.error('获取HTTP信息失败')
}).finally(() => {
this.loading = false
this.tableLoading = false
})
}
}
}
</script>
<style></style>

View File

@ -0,0 +1,169 @@
<template>
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
<a-card :bordered="false">
<a-alert type="info" :showIcon="true">
<div slot="message">
上次更新时间{{ this.time }}
<a-divider type="vertical"/>
<a @click="handleClickUpdate">立即更新</a>
</div>
</a-alert>
<a-table
rowKey="id"
size="middle"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="tableLoading"
style="margin-top: 20px;">
<template slot="param" slot-scope="text, record">
<a-tag :color="textInfo[record.param].color">{{ text }}</a-tag>
</template>
<template slot="text" slot-scope="text, record">
{{ textInfo[record.param].text }}
</template>
<template slot="value" slot-scope="text, record">
{{ text }} {{ textInfo[record.param].unit }}
</template>
</a-table>
</a-card>
</a-skeleton>
</template>
<script>
import moment from 'moment'
import { getAction } from '@/api/manage'
moment.locale('zh-cn')
export default {
data() {
return {
time: '',
loading: true,
tableLoading: true,
columns: [{
title: '参数',
width: '30%',
dataIndex: 'param',
scopedSlots: { customRender: 'param' }
}, {
title: '描述',
width: '40%',
dataIndex: 'text',
scopedSlots: { customRender: 'text' }
}, {
title: '当前值',
width: '30%',
dataIndex: 'value',
scopedSlots: { customRender: 'value' }
}],
dataSource: [],
// 列表通过 textInfo 渲染出颜色、描述和单位
textInfo: {
'jvm.memory.max': { color: 'purple', text: 'JVM 最大内存', unit: 'MB' },
'jvm.memory.committed': { color: 'purple', text: 'JVM 可用内存', unit: 'MB' },
'jvm.memory.used': { color: 'purple', text: 'JVM 已用内存', unit: 'MB' },
'jvm.buffer.memory.used': { color: 'cyan', text: 'JVM 缓冲区已用内存', unit: 'MB' },
'jvm.buffer.count': { color: 'cyan', text: '当前缓冲区数量', unit: '个' },
'jvm.threads.daemon': { color: 'green', text: 'JVM 守护线程数量', unit: '个' },
'jvm.threads.live': { color: 'green', text: 'JVM 当前活跃线程数量', unit: '个' },
'jvm.threads.peak': { color: 'green', text: 'JVM 峰值线程数量', unit: '个' },
'jvm.classes.loaded': { color: 'orange', text: 'JVM 已加载 Class 数量', unit: '个' },
'jvm.classes.unloaded': { color: 'orange', text: 'JVM 未加载 Class 数量', unit: '个' },
'jvm.gc.memory.allocated': { color: 'pink', text: 'GC , 年轻代分配的内存空间', unit: 'MB' },
'jvm.gc.memory.promoted': { color: 'pink', text: 'GC , 老年代分配的内存空间', unit: 'MB' },
'jvm.gc.max.data.size': { color: 'pink', text: 'GC , 老年代的最大内存空间', unit: 'MB' },
'jvm.gc.live.data.size': { color: 'pink', text: 'FullGC , 老年代的内存空间', unit: 'MB' },
'jvm.gc.pause.count': { color: 'blue', text: '系统启动以来GC 次数', unit: '次' },
'jvm.gc.pause.totalTime': { color: 'blue', text: '系统启动以来GC 总耗时', unit: '秒' }
},
// 当一条记录中需要取出多条数据的时候需要配置该字段
moreInfo: {
'jvm.gc.pause': ['.count', '.totalTime']
}
}
},
mounted() {
this.loadTomcatInfo()
},
methods: {
handleClickUpdate() {
this.loadTomcatInfo()
},
loadTomcatInfo() {
this.tableLoading = true
this.time = moment().format('YYYY年MM月DD日 HH时mm分ss秒')
Promise.all([
getAction('actuator/metrics/jvm.memory.max'),
getAction('actuator/metrics/jvm.memory.committed'),
getAction('actuator/metrics/jvm.memory.used'),
getAction('actuator/metrics/jvm.buffer.memory.used'),
getAction('actuator/metrics/jvm.buffer.count'),
getAction('actuator/metrics/jvm.threads.daemon'),
getAction('actuator/metrics/jvm.threads.live'),
getAction('actuator/metrics/jvm.threads.peak'),
getAction('actuator/metrics/jvm.classes.loaded'),
getAction('actuator/metrics/jvm.classes.unloaded'),
getAction('actuator/metrics/jvm.gc.memory.allocated'),
getAction('actuator/metrics/jvm.gc.memory.promoted'),
getAction('actuator/metrics/jvm.gc.max.data.size'),
getAction('actuator/metrics/jvm.gc.live.data.size'),
getAction('actuator/metrics/jvm.gc.pause')
]).then((res) => {
let info = []
res.forEach((value, id) => {
let more = this.moreInfo[value.name]
if (!(more instanceof Array)) {
more = ['']
}
more.forEach((item, idx) => {
let param = value.name + item
let val = value.measurements[idx].value
if (param === 'jvm.memory.max'
|| param === 'jvm.memory.committed'
|| param === 'jvm.memory.used'
|| param === 'jvm.buffer.memory.used'
|| param === 'jvm.gc.memory.allocated'
|| param === 'jvm.gc.memory.promoted'
|| param === 'jvm.gc.max.data.size'
|| param === 'jvm.gc.live.data.size'
) {
val = this.convert(val, Number)
}
info.push({ id: param + id, param, text: 'false value', value: val })
})
})
this.dataSource = info
}).catch((e) => {
console.error(e)
this.$message.error('获取JVM信息失败')
}).finally(() => {
this.loading = false
this.tableLoading = false
})
},
convert(value, type) {
if (type === Number) {
return Number(value / 1048576).toFixed(3)
} else if (type === Date) {
return moment(value * 1000).format('YYYY-MM-DD HH:mm:ss')
}
return value
}
}
}
</script>
<style></style>

View File

@ -0,0 +1,189 @@
<template>
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
<a-card>
<!-- Radis 信息实时监控 -->
<a-row :gutter="8">
<a-col :sm="24" :xl="12">
<area-chart-ty v-bind="memory"/>
</a-col>
<a-col :sm="24" :xl="12">
<area-chart-ty v-bind="key"/>
</a-col>
</a-row>
<h3>Redis 详细信息</h3>
<a-table
:loading="tableLoading"
:columns="columns"
:dataSource="redisInfo"
:pagination="false"/>
</a-card>
</a-skeleton>
</template>
<script>
import moment from 'moment'
import { getAction } from '@/api/manage'
import AreaChartTy from '@/components/chart/AreaChartTy'
export default {
name: 'RedisInfo',
components: {
AreaChartTy
},
data() {
return {
loading: true,
tableLoading: true,
// 定时器ID
timer: null,
// 定时器周期
millisec: 3000,
// Key 实时数量
key: {
title: 'Radis Key 实时数量',
dataSource: [],
y: '数量',
height: 340,
min: 0,
max: 100,
color: '#FF6987',
lineSize: 8,
lineColor: '#DC143C'
},
// 内存实时占用情况
memory: {
title: 'Radis 内存实时占用情况KB',
dataSource: [],
y: '内存KB',
min: 0,
max: 3000,
height: 340,
lineSize: 8
},
redisInfo: [],
columns: [{
title: 'Key',
align: 'center',
dataIndex: 'key'
}, {
title: 'Description',
align: 'left',
dataIndex: 'description'
}, {
title: 'Value',
align: 'center',
dataIndex: 'value'
}],
url: {
keysSize: '/actuator/redis/keysSize',
memoryInfo: '/actuator/redis/memoryInfo',
info: '/actuator/redis/info'
},
path: '/monitor/redis/info'
}
},
mounted() {
this.openTimer()
this.loadRedisInfo()
setTimeout(() => {
this.loadData()
}, 1000)
},
beforeDestroy() {
this.closeTimer()
},
methods: {
/** 开启定时器 */
openTimer() {
this.loadData()
this.closeTimer()
this.timer = setInterval(() => {
if (this.$route.path === this.path) {
this.loadData()
}
}, this.millisec)
},
/** 关闭定时器 */
closeTimer() {
if (this.timer) clearInterval(this.timer)
},
/** 查询数据 */
loadData() {
Promise.all([
getAction(this.url.keysSize),
getAction(this.url.memoryInfo)
]).then((res) => {
let time = moment().format('hh:mm:ss')
let [{ dbSize: currentSize }, memoryInfo] = res
let currentMemory = memoryInfo.used_memory / 1000
// push 数据
this.key.dataSource.push({ x: time, y: currentSize })
this.memory.dataSource.push({ x: time, y: currentMemory })
// 最大长度为6
if (this.key.dataSource.length > 6) {
this.key.dataSource.splice(0, 1)
this.memory.dataSource.splice(0, 1)
}
// 计算 Key 最大最小值
let keyPole = this.getMaxAndMin(this.key.dataSource, 'y')
this.key.max = Math.floor(keyPole[0]) + 10
this.key.min = Math.floor(keyPole[1]) - 10
if (this.key.min < 0) this.key.min = 0
// 计算 Memory 最大最小值
let memoryPole = this.getMaxAndMin(this.memory.dataSource, 'y')
this.memory.max = Math.floor(memoryPole[0]) + 100
this.memory.min = Math.floor(memoryPole[1]) - 100
if (this.memory.min < 0) this.memory.min = 0
}).catch((e) => {
console.error(e)
this.closeTimer()
this.$message.error('获取 Redis 信息失败')
}).finally(() => {
this.loading = false
})
},
// 获取一组数据中最大和最小的值
getMaxAndMin(dataSource, field) {
let maxValue = null, minValue = null
dataSource.forEach(item => {
let value = Number.parseInt(item[field])
// max
if (maxValue == null) {
maxValue = value
} else if (value > maxValue) {
maxValue = value
}
// min
if (minValue == null) {
minValue = value
} else if (value < minValue) {
minValue = value
}
})
return [maxValue, minValue]
},
loadRedisInfo() {
this.tableLoading = true
getAction(this.url.info).then((res) => {
this.redisInfo = res.result
}).finally(() => {
this.tableLoading = false
})
}
}
}
</script>
<style></style>

View File

@ -0,0 +1,13 @@
<template>
<div>
<div>Redis终端</div>
</div>
</template>
<script>
export default {
name: 'RedisTerminal'
}
</script>
<style>
</style>

View File

@ -0,0 +1,137 @@
<template>
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
<a-card :bordered="false">
<a-alert type="info" :showIcon="true">
<div slot="message">
上次更新时间{{ this.time }}
<a-divider type="vertical"/>
<a @click="handleClickUpdate">立即更新</a>
</div>
</a-alert>
<a-table
rowKey="id"
size="middle"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="tableLoading"
style="margin-top: 20px;">
<template slot="param" slot-scope="text, record">
<a-tag :color="textInfo[record.param].color">{{ text }}</a-tag>
</template>
<template slot="text" slot-scope="text, record">
{{ textInfo[record.param].text }}
</template>
<template slot="value" slot-scope="text, record">
{{ text }} {{ textInfo[record.param].unit }}
</template>
</a-table>
</a-card>
</a-skeleton>
</template>
<script>
import moment from 'moment'
import { getAction } from '@/api/manage'
moment.locale('zh-cn')
export default {
data() {
return {
time: '',
loading: true,
tableLoading: true,
columns: [{
title: '参数',
width: '30%',
dataIndex: 'param',
scopedSlots: { customRender: 'param' }
}, {
title: '描述',
width: '40%',
dataIndex: 'text',
scopedSlots: { customRender: 'text' }
}, {
title: '当前值',
width: '30%',
dataIndex: 'value',
scopedSlots: { customRender: 'value' }
}],
dataSource: [],
// 列表通过 textInfo 渲染出颜色、描述和单位
textInfo: {
'system.cpu.count': { color: 'green', text: 'CPU 数量', unit: '核' },
'system.cpu.usage': { color: 'green', text: '系统 CPU 使用率', unit: '%' },
'process.start.time': { color: 'purple', text: '应用启动时间点', unit: '' },
'process.uptime': { color: 'purple', text: '应用已运行时间', unit: '秒' },
'process.cpu.usage': { color: 'purple', text: '当前应用 CPU 使用率', unit: '%' }
},
// 当一条记录中需要取出多条数据的时候需要配置该字段
moreInfo: {}
}
},
mounted() {
this.loadTomcatInfo()
},
methods: {
handleClickUpdate() {
this.loadTomcatInfo()
},
loadTomcatInfo() {
this.tableLoading = true
this.time = moment().format('YYYY年MM月DD日 HH时mm分ss秒')
Promise.all([
getAction('actuator/metrics/system.cpu.count'),
getAction('actuator/metrics/system.cpu.usage'),
getAction('actuator/metrics/process.start.time'),
getAction('actuator/metrics/process.uptime'),
getAction('actuator/metrics/process.cpu.usage')
]).then((res) => {
let info = []
res.forEach((value, id) => {
let more = this.moreInfo[value.name]
if (!(more instanceof Array)) {
more = ['']
}
more.forEach((item, idx) => {
let param = value.name + item
let val = value.measurements[idx].value
if (param === 'system.cpu.usage' || param === 'process.cpu.usage') {
val = this.convert(val, Number)
}
if (param === 'process.start.time') {
val = this.convert(val, Date)
}
info.push({ id: param + id, param, text: 'false value', value: val })
})
})
this.dataSource = info
}).catch((e) => {
console.error(e)
this.$message.error('获取服务器信息失败')
}).finally(() => {
this.loading = false
this.tableLoading = false
})
},
convert(value, type) {
if (type === Number) {
return Number(value * 100).toFixed(2)
} else if (type === Date) {
return moment(value * 1000).format('YYYY-MM-DD HH:mm:ss')
}
return value
}
}
}
</script>
<style></style>

View File

@ -0,0 +1,149 @@
<template>
<a-skeleton active :loading="loading" :paragraph="{rows: 17}">
<a-card :bordered="false">
<a-alert type="info" :showIcon="true">
<div slot="message">
上次更新时间{{ this.time }}
<a-divider type="vertical"/>
<a @click="handleClickUpdate">立即更新</a>
</div>
</a-alert>
<a-table
rowKey="id"
size="middle"
:columns="columns"
:dataSource="dataSource"
:pagination="false"
:loading="tableLoading"
style="margin-top: 20px;">
<template slot="param" slot-scope="text, record">
<a-tag :color="textInfo[record.param].color">{{ text }}</a-tag>
</template>
<template slot="text" slot-scope="text, record">
{{ textInfo[record.param].text }}
</template>
<template slot="value" slot-scope="text, record">
{{ text }} {{ textInfo[record.param].unit }}
</template>
</a-table>
</a-card>
</a-skeleton>
</template>
<script>
import moment from 'moment'
import { getAction } from '@/api/manage'
moment.locale('zh-cn')
export default {
data() {
return {
time: '',
loading: true,
tableLoading: true,
columns: [{
title: '参数',
width: '30%',
dataIndex: 'param',
scopedSlots: { customRender: 'param' }
}, {
title: '描述',
width: '40%',
dataIndex: 'text',
scopedSlots: { customRender: 'text' }
}, {
title: '当前值',
width: '30%',
dataIndex: 'value',
scopedSlots: { customRender: 'value' }
}],
dataSource: [],
// 列表通过 textInfo 渲染出颜色、描述和单位
textInfo: {
'tomcat.sessions.created': { color: 'green', text: 'tomcat 已创建 session ', unit: '个' },
'tomcat.sessions.expired': { color: 'green', text: 'tomcat 已过期 session ', unit: '个' },
'tomcat.sessions.active.current': { color: 'green', text: 'tomcat 当前活跃 session ', unit: '个' },
'tomcat.sessions.active.max': { color: 'green', text: 'tomcat 活跃 session 数峰值', unit: '个' },
'tomcat.sessions.rejected': { color: 'green', text: '超过session 最大配置后拒绝的 session 个数', unit: '个' },
'tomcat.global.sent': { color: 'purple', text: '发送的字节数', unit: 'bytes' },
'tomcat.global.request.max': { color: 'purple', text: 'request 请求最长耗时', unit: '秒' },
'tomcat.global.request.count': { color: 'purple', text: '全局 request 请求次数', unit: '次' },
'tomcat.global.request.totalTime': { color: 'purple', text: '全局 request 请求总耗时', unit: '秒' },
'tomcat.servlet.request.max': { color: 'cyan', text: 'servlet 请求最长耗时', unit: '秒' },
'tomcat.servlet.request.count': { color: 'cyan', text: 'servlet 总请求次数', unit: '次' },
'tomcat.servlet.request.totalTime': { color: 'cyan', text: 'servlet 请求总耗时', unit: '秒' },
'tomcat.threads.current': { color: 'pink', text: 'tomcat 当前线程数包括守护线程', unit: '个' },
'tomcat.threads.config.max': { color: 'pink', text: 'tomcat 配置的线程最大数', unit: '个' }
},
// 当一条记录中需要取出多条数据的时候需要配置该字段
moreInfo: {
'tomcat.global.request': ['.count', '.totalTime'],
'tomcat.servlet.request': ['.count', '.totalTime']
}
}
},
mounted() {
this.loadTomcatInfo()
},
methods: {
handleClickUpdate() {
this.loadTomcatInfo()
},
loadTomcatInfo() {
this.tableLoading = true
this.time = moment().format('YYYY年MM月DD日 HH时mm分ss秒')
Promise.all([
getAction('actuator/metrics/tomcat.sessions.created'),
getAction('actuator/metrics/tomcat.sessions.expired'),
getAction('actuator/metrics/tomcat.sessions.active.current'),
getAction('actuator/metrics/tomcat.sessions.active.max'),
getAction('actuator/metrics/tomcat.sessions.rejected'),
getAction('actuator/metrics/tomcat.global.sent'),
getAction('actuator/metrics/tomcat.global.request.max'),
getAction('actuator/metrics/tomcat.global.request'),
// 2.1.3.RELEASE 无此API
//getAction('actuator/metrics/tomcat.servlet.request'),
// getAction('actuator/metrics/tomcat.servlet.request.max'),
getAction('actuator/metrics/tomcat.threads.current'),
getAction('actuator/metrics/tomcat.threads.config.max')
]).then((res) => {
let tomcatInfo = []
res.forEach((value, id) => {
let more = this.moreInfo[value.name]
if (!(more instanceof Array)) {
more = ['']
}
more.forEach((item, idx) => {
let param = value.name + item
tomcatInfo.push({
id: param + id, param,
text: 'false value',
value: value.measurements[idx].value
})
})
})
this.dataSource = tomcatInfo
}).catch((e) => {
console.error(e)
this.$message.error('获取Tomcat信息失败')
}).finally(() => {
this.loading = false
this.tableLoading = false
})
}
}
}
</script>
<style></style>