From e60bfd18ff7aa177bc996f9c3075c9b0bc67df4f Mon Sep 17 00:00:00 2001 From: Alex Holliday Date: Fri, 28 Aug 2026 14:03:27 -0700 Subject: [PATCH] add route --- server/openapi.json | 540 +++++++++++++++++++++++++ server/src/api/routes/monitorRoutes.ts | 3 + 2 files changed, 543 insertions(+) diff --git a/server/openapi.json b/server/openapi.json index c2408b580..de869c314 100644 --- a/server/openapi.json +++ b/server/openapi.json @@ -422,6 +422,9 @@ "secret": { "type": "string" }, + "sshPrivateKey": { + "type": "string" + }, "cpuAlertThreshold": { "type": "number" }, @@ -637,6 +640,9 @@ "secret": { "type": "string" }, + "sshPrivateKey": { + "type": "string" + }, "cpuAlertThreshold": { "type": "number" }, @@ -1648,6 +1654,24 @@ }, "performance": { "type": "number" + }, + "containerSummary": { + "type": "object", + "properties": { + "total": { + "type": "number" + }, + "running": { + "type": "number" + }, + "stopped": { + "type": "number" + }, + "unhealthy": { + "type": "number" + } + }, + "required": ["total", "running", "stopped", "unhealthy"] } }, "required": ["id", "status", "responseTime", "statusCode", "message", "createdAt"], @@ -6936,6 +6960,513 @@ } } }, + "/monitors/docker/details/{monitorId}": { + "get": { + "tags": ["monitors"], + "summary": "Get Docker host details for a monitor", + "security": [ + { + "bearerAuth": [] + } + ], + "parameters": [ + { + "schema": { + "type": "string", + "minLength": 1 + }, + "required": true, + "name": "monitorId", + "in": "path" + }, + { + "schema": { + "type": "string", + "enum": ["recent", "hour", "day", "week", "month", "all"] + }, + "required": false, + "name": "dateRange", + "in": "query" + } + ], + "responses": { + "200": { + "description": "OK", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean", + "enum": [true] + }, + "msg": { + "type": "string" + }, + "data": { + "type": "object", + "properties": { + "monitor": { + "type": "object", + "properties": { + "name": { + "type": "string" + }, + "description": { + "type": "string" + }, + "type": { + "type": "string", + "enum": ["http", "ping", "pagespeed", "hardware", "docker", "port", "game", "grpc", "websocket", "dns", "unknown"] + }, + "url": { + "type": "string" + }, + "port": { + "type": "number" + }, + "isActive": { + "type": "boolean" + }, + "interval": { + "type": "number" + }, + "status": { + "type": "string", + "enum": ["up", "down", "paused", "initializing", "maintenance", "breached"] + }, + "statusWindowSize": { + "type": "number" + }, + "statusWindowThreshold": { + "type": "number" + }, + "ignoreTlsErrors": { + "type": "boolean" + }, + "proxyMode": { + "type": "string", + "enum": ["inherit", "none", "custom"] + }, + "proxyId": { + "type": "string" + }, + "useAdvancedMatching": { + "type": "boolean" + }, + "jsonPath": { + "type": "string" + }, + "expectedValue": { + "type": "string" + }, + "matchMethod": { + "type": "string", + "enum": ["equal", "include", "regex"] + }, + "method": { + "type": "string", + "enum": ["GET", "HEAD"] + }, + "notifications": { + "type": "array", + "items": { + "type": "string" + } + }, + "tags": { + "type": "array", + "items": { + "type": "string" + } + }, + "customUpCodes": { + "type": "array", + "items": { + "type": "number" + } + }, + "secret": { + "type": "string" + }, + "sshPrivateKey": { + "type": "string" + }, + "cpuAlertThreshold": { + "type": "number" + }, + "memoryAlertThreshold": { + "type": "number" + }, + "diskAlertThreshold": { + "type": "number" + }, + "tempAlertThreshold": { + "type": "number" + }, + "selectedDisks": { + "type": "array", + "items": { + "type": "string" + } + }, + "gameId": { + "type": "string" + }, + "grpcServiceName": { + "type": "string" + }, + "group": { + "type": "string", + "nullable": true + }, + "geoCheckEnabled": { + "type": "boolean" + }, + "geoCheckLocations": { + "type": "array", + "items": { + "type": "string", + "enum": ["EU", "NA", "AS", "SA", "AF", "OC"] + } + }, + "geoCheckInterval": { + "type": "number" + }, + "dnsServer": { + "type": "string" + }, + "dnsRecordType": { + "type": "string", + "enum": ["A", "AAAA", "CNAME", "MX", "TXT", "NS"] + }, + "teamId": { + "type": "string" + }, + "userId": { + "type": "string" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + }, + "lastEvaluatedAt": { + "type": "number" + }, + "id": { + "type": "string" + } + }, + "required": [ + "name", + "type", + "url", + "isActive", + "interval", + "status", + "statusWindowSize", + "statusWindowThreshold", + "ignoreTlsErrors", + "proxyMode", + "useAdvancedMatching", + "method", + "notifications", + "tags", + "cpuAlertThreshold", + "memoryAlertThreshold", + "diskAlertThreshold", + "tempAlertThreshold", + "selectedDisks", + "geoCheckEnabled", + "geoCheckLocations", + "geoCheckInterval", + "teamId", + "userId", + "createdAt", + "updatedAt", + "lastEvaluatedAt", + "id" + ], + "additionalProperties": { + "nullable": true + } + }, + "stats": { + "type": "object", + "properties": { + "aggregateData": { + "type": "object", + "properties": { + "totalChecks": { + "type": "number" + } + }, + "required": ["totalChecks"] + }, + "upChecks": { + "type": "object", + "properties": { + "totalChecks": { + "type": "number" + } + }, + "required": ["totalChecks"] + }, + "aggregate": { + "type": "array", + "items": { + "type": "object", + "properties": { + "_id": { + "type": "string" + }, + "avgResponseTime": { + "type": "number", + "nullable": true + }, + "upCount": { + "type": "number" + }, + "totalCount": { + "type": "number" + }, + "avgRunning": { + "type": "number", + "nullable": true + }, + "avgTotal": { + "type": "number", + "nullable": true + }, + "avgUnhealthy": { + "type": "number", + "nullable": true + } + }, + "required": ["_id", "avgResponseTime", "upCount", "totalCount", "avgRunning", "avgTotal", "avgUnhealthy"] + } + }, + "latest": { + "type": "object", + "nullable": true, + "properties": { + "containers": { + "type": "array", + "items": { + "type": "object", + "properties": { + "id": { + "type": "string" + }, + "name": { + "type": "string" + }, + "image": { + "type": "string" + }, + "state": { + "type": "string", + "enum": ["created", "running", "paused", "restarting", "removing", "exited", "dead"] + }, + "status": { + "type": "string" + }, + "health": { + "type": "string", + "enum": ["healthy", "unhealthy", "starting", "none"] + }, + "cpuPct": { + "type": "number" + }, + "memoryUsedBytes": { + "type": "number" + }, + "memoryLimitBytes": { + "type": "number" + }, + "memoryPct": { + "type": "number" + }, + "restartCount": { + "type": "number" + }, + "startedAt": { + "type": "string" + } + }, + "required": ["id", "name", "image", "state", "status", "health"] + } + }, + "summary": { + "type": "object", + "properties": { + "total": { + "type": "number" + }, + "running": { + "type": "number" + }, + "stopped": { + "type": "number" + }, + "unhealthy": { + "type": "number" + } + }, + "required": ["total", "running", "stopped", "unhealthy"] + }, + "checkedAt": { + "type": "string" + } + }, + "required": ["containers", "checkedAt"] + } + }, + "required": ["aggregateData", "upChecks", "aggregate", "latest"] + }, + "monitorStats": { + "type": "object", + "nullable": true, + "properties": { + "id": { + "type": "string" + }, + "monitorId": { + "type": "string" + }, + "avgResponseTime": { + "type": "number" + }, + "maxResponseTime": { + "type": "number" + }, + "totalChecks": { + "type": "number" + }, + "totalUpChecks": { + "type": "number" + }, + "totalDownChecks": { + "type": "number" + }, + "uptimePercentage": { + "type": "number" + }, + "lastCheckTimestamp": { + "type": "number" + }, + "lastResponseTime": { + "type": "number" + }, + "timeOfLastFailure": { + "type": "number" + }, + "createdAt": { + "type": "string" + }, + "updatedAt": { + "type": "string" + } + }, + "required": [ + "id", + "monitorId", + "avgResponseTime", + "maxResponseTime", + "totalChecks", + "totalUpChecks", + "totalDownChecks", + "uptimePercentage", + "lastCheckTimestamp", + "lastResponseTime", + "createdAt", + "updatedAt" + ] + } + }, + "required": ["monitor", "stats", "monitorStats"] + } + }, + "required": ["success", "msg", "data"] + } + } + } + }, + "401": { + "description": "Unauthorized", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean", + "enum": [false] + }, + "msg": { + "type": "string" + }, + "data": { + "nullable": true + } + }, + "required": ["success", "msg"] + } + } + } + }, + "403": { + "description": "Forbidden", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean", + "enum": [false] + }, + "msg": { + "type": "string" + }, + "data": { + "nullable": true + } + }, + "required": ["success", "msg"] + } + } + } + }, + "500": { + "description": "Internal server error", + "content": { + "application/json": { + "schema": { + "type": "object", + "properties": { + "success": { + "type": "boolean", + "enum": [false] + }, + "msg": { + "type": "string" + }, + "data": { + "nullable": true + } + }, + "required": ["success", "msg"] + } + } + } + } + } + } + }, "/monitors/pagespeed/details/{monitorId}": { "get": { "tags": ["monitors"], @@ -7860,6 +8391,9 @@ "secret": { "type": "string" }, + "sshPrivateKey": { + "type": "string" + }, "jsonPath": { "anyOf": [ { @@ -8553,6 +9087,9 @@ "secret": { "type": "string" }, + "sshPrivateKey": { + "type": "string" + }, "cpuAlertThreshold": { "type": "number", "default": 100 @@ -9083,6 +9620,9 @@ "secret": { "type": "string" }, + "sshPrivateKey": { + "type": "string" + }, "ignoreTlsErrors": { "type": "boolean" }, diff --git a/server/src/api/routes/monitorRoutes.ts b/server/src/api/routes/monitorRoutes.ts index 4cd90a9a0..6da47f2a7 100644 --- a/server/src/api/routes/monitorRoutes.ts +++ b/server/src/api/routes/monitorRoutes.ts @@ -18,6 +18,9 @@ export const createMonitorRoutes = (monitorController: IMonitorController): Rout // PageSpeed routes router.get("/pagespeed/details/:monitorId", monitorController.getPageSpeedDetailsById); + // Docker routes + router.get("/docker/details/:monitorId", monitorController.getDockerDetailsById); + // Geo checks routes router.get("/:monitorId/geo-checks", monitorController.getGeoChecksByMonitorId);