You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
homepage/src/pages/api/widgets/resources.js

15 lines
315 B

import { cpu, drive, mem, netstat } from "node-os-utils";
export default async function handler(req, res) {
const { disk } = req.query;
res.send({
cpu: {
usage: await cpu.usage(),
load: cpu.loadavgTime(5),
},
drive: await drive.info(disk || "/"),
memory: await mem.info(),
});
}