mirror of
https://github.com/benphelps/homepage.git
synced 2025-12-21 22:29:44 +01:00
first public source commit
This commit is contained in:
14
src/pages/api/widgets/resources.js
Normal file
14
src/pages/api/widgets/resources.js
Normal file
@@ -0,0 +1,14 @@
|
||||
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(),
|
||||
});
|
||||
}
|
||||
Reference in New Issue
Block a user