| ¶Ô±ÈÐÂÎļþ |
| | |
| | | <!--OA模åï¼ç¼åçæ§--> |
| | | <template> |
| | | <div class="app-container"> |
| | | <el-row :gutter="10"> |
| | | <el-col :span="24" class="card-box"> |
| | | <el-card> |
| | | <template #header><Monitor style="width: 1em; height: 1em; vertical-align: middle;" /> <span style="vertical-align: middle;">åºæ¬ä¿¡æ¯</span></template> |
| | | <div class="el-table el-table--enable-row-hover el-table--medium"> |
| | | <table cellspacing="0" style="width: 100%"> |
| | | <tbody> |
| | | <tr> |
| | | <td class="el-table__cell is-leaf"><div class="cell">Redisçæ¬</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.redis_version }}</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell">è¿è¡æ¨¡å¼</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.redis_mode == "standalone" ? "åæº" : "é群" }}</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell">端å£</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.tcp_port }}</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell">客æ·ç«¯æ°</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.connected_clients }}</div></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="el-table__cell is-leaf"><div class="cell">è¿è¡æ¶é´(天)</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.uptime_in_days }}</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell">使ç¨å
å</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.used_memory_human }}</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell">使ç¨CPU</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ parseFloat(cache.info.used_cpu_user_children).toFixed(2) }}</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell">å
åé
ç½®</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.maxmemory_human }}</div></td> |
| | | </tr> |
| | | <tr> |
| | | <td class="el-table__cell is-leaf"><div class="cell">AOFæ¯å¦å¼å¯</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.aof_enabled == "0" ? "å¦" : "æ¯" }}</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell">RDBæ¯å¦æå</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.rdb_last_bgsave_status }}</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell">Keyæ°é</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.dbSize">{{ cache.dbSize }} </div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell">ç½ç»å
¥å£/åºå£</div></td> |
| | | <td class="el-table__cell is-leaf"><div class="cell" v-if="cache.info">{{ cache.info.instantaneous_input_kbps }}kps/{{cache.info.instantaneous_output_kbps}}kps</div></td> |
| | | </tr> |
| | | </tbody> |
| | | </table> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | |
| | | <el-col :span="12" class="card-box"> |
| | | <el-card> |
| | | <template #header><PieChart style="width: 1em; height: 1em; vertical-align: middle;" /> <span style="vertical-align: middle;">å½ä»¤ç»è®¡</span></template> |
| | | <div class="el-table el-table--enable-row-hover el-table--medium"> |
| | | <div ref="commandstats" style="height: 420px" /> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | |
| | | <el-col :span="12" class="card-box"> |
| | | <el-card> |
| | | <template #header><Odometer style="width: 1em; height: 1em; vertical-align: middle;" /> <span style="vertical-align: middle;">å
åä¿¡æ¯</span></template> |
| | | <div class="el-table el-table--enable-row-hover el-table--medium"> |
| | | <div ref="usedmemory" style="height: 420px" /> |
| | | </div> |
| | | </el-card> |
| | | </el-col> |
| | | </el-row> |
| | | </div> |
| | | </template> |
| | | |
| | | <script setup name="Cache"> |
| | | import { getCache } from '@/api/monitor/cache' |
| | | import * as echarts from 'echarts' |
| | | |
| | | const cache = ref([]) |
| | | const commandstats = ref(null) |
| | | const usedmemory = ref(null) |
| | | const { proxy } = getCurrentInstance() |
| | | |
| | | function getList() { |
| | | proxy.$modal.loading("æ£å¨å è½½ç¼åçæ§æ°æ®ï¼è¯·ç¨åï¼") |
| | | getCache().then(response => { |
| | | proxy.$modal.closeLoading() |
| | | cache.value = response.data |
| | | |
| | | const commandstatsIntance = echarts.init(commandstats.value, "macarons") |
| | | commandstatsIntance.setOption({ |
| | | tooltip: { |
| | | trigger: "item", |
| | | formatter: "{a} <br/>{b} : {c} ({d}%)" |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "å½ä»¤", |
| | | type: "pie", |
| | | roseType: "radius", |
| | | radius: [15, 95], |
| | | center: ["50%", "38%"], |
| | | data: response.data.commandStats, |
| | | animationEasing: "cubicInOut", |
| | | animationDuration: 1000 |
| | | } |
| | | ] |
| | | }) |
| | | const usedmemoryInstance = echarts.init(usedmemory.value, "macarons") |
| | | usedmemoryInstance.setOption({ |
| | | tooltip: { |
| | | formatter: "{b} <br/>{a} : " + cache.value.info.used_memory_human |
| | | }, |
| | | series: [ |
| | | { |
| | | name: "å³°å¼", |
| | | type: "gauge", |
| | | min: 0, |
| | | max: 1000, |
| | | detail: { |
| | | formatter: cache.value.info.used_memory_human |
| | | }, |
| | | data: [ |
| | | { |
| | | value: parseFloat(cache.value.info.used_memory_human), |
| | | name: "å
åæ¶è" |
| | | } |
| | | ] |
| | | } |
| | | ] |
| | | }) |
| | | window.addEventListener("resize", () => { |
| | | commandstatsIntance.resize() |
| | | usedmemoryInstance.resize() |
| | | }) |
| | | }) |
| | | } |
| | | |
| | | getList() |
| | | </script> |
| | | |