summary refs log tree commit diff
path: root/src/api/routes/-/monitorz.ts
diff options
context:
space:
mode:
Diffstat (limited to 'src/api/routes/-/monitorz.ts')
-rw-r--r--src/api/routes/-/monitorz.ts18
1 files changed, 18 insertions, 0 deletions
diff --git a/src/api/routes/-/monitorz.ts b/src/api/routes/-/monitorz.ts
new file mode 100644
index 00000000..f85cd099
--- /dev/null
+++ b/src/api/routes/-/monitorz.ts
@@ -0,0 +1,18 @@
+import { Router, Response, Request } from "express";
+import { route } from "@fosscord/api";
+import { Session } from "@fosscord/util";
+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),
+		sessions: await Session.count(),
+	})
+})
+
+export default router;
\ No newline at end of file