summary refs log tree commit diff
path: root/api/src/routes/-/monitorz.ts
diff options
context:
space:
mode:
Diffstat (limited to 'api/src/routes/-/monitorz.ts')
-rw-r--r--api/src/routes/-/monitorz.ts16
1 files changed, 16 insertions, 0 deletions
diff --git a/api/src/routes/-/monitorz.ts b/api/src/routes/-/monitorz.ts
new file mode 100644
index 00000000..a8f2e3c3
--- /dev/null
+++ b/api/src/routes/-/monitorz.ts
@@ -0,0 +1,16 @@
+import { Router, Response, Request } from "express";
+import { route } from "@fosscord/api";
+import os from "os";
+
+const router = Router();
+
+router.get("/", route({ right: "OPERATOR" }), async (req: Request, res: Response) => {
+	return res.json({
+		load: os.loadavg(),
+		procUptime: process.uptime(),
+		sysUptime: os.uptime(),
+		memPercent: 100 - ((os.freemem() / os.totalmem()) * 100),
+	})
+})
+
+export default router;
\ No newline at end of file