Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
static async getServer (ctx) {
// cpu stat
let cpu = osu.cpu
let cpuUsage = await cpu.usage()
let cpuAverage = await cpu.average()
// mem stat
let mem = osu.mem
let memInfo = await mem.info()
ctx.status = 200
ctx.body = {
success: true,
message: "获取服务器信息",
data: {
cpu: {
cpuUsage,
cpuAverage
},
mem: {
memInfo
}
}
}