diff --git a/ProbeIngest/API/ServerMonitor.ts b/ProbeIngest/API/ServerMonitor.ts index 38cf68e6938..9d188578539 100644 --- a/ProbeIngest/API/ServerMonitor.ts +++ b/ProbeIngest/API/ServerMonitor.ts @@ -16,6 +16,7 @@ import MonitorResourceUtil from "Common/Server/Utils/Monitor/MonitorResource"; import Response from "Common/Server/Utils/Response"; import Monitor from "Common/Models/DatabaseModels/Monitor"; import OneUptimeDate from "Common/Types/Date"; +import ProjectService from "Common/Server/Services/ProjectService"; const router: ExpressRouter = Express.getRouter(); @@ -39,6 +40,9 @@ router.get( query: { serverMonitorSecretKey: new ObjectID(monitorSecretKeyAsString), monitorType: MonitorType.Server, + project: { + ...ProjectService.getActiveProjectStatusQuery(), + }, }, select: { _id: true, @@ -78,6 +82,10 @@ router.post( query: { serverMonitorSecretKey: new ObjectID(monitorSecretKeyAsString), monitorType: MonitorType.Server, + ...MonitorService.getEnabledMonitorQuery(), + project: { + ...ProjectService.getActiveProjectStatusQuery(), + }, }, select: { _id: true, diff --git a/Worker/Jobs/ServerMonitor/CheckOnlineStatus.ts b/Worker/Jobs/ServerMonitor/CheckOnlineStatus.ts index 73d87cc98ce..4601aaa6808 100644 --- a/Worker/Jobs/ServerMonitor/CheckOnlineStatus.ts +++ b/Worker/Jobs/ServerMonitor/CheckOnlineStatus.ts @@ -10,6 +10,7 @@ import QueryHelper from "Common/Server/Types/Database/QueryHelper"; import logger from "Common/Server/Utils/Logger"; import MonitorResourceUtil from "Common/Server/Utils/Monitor/MonitorResource"; import Monitor from "Common/Models/DatabaseModels/Monitor"; +import ProjectService from "Common/Server/Services/ProjectService"; RunCron( "ServerMonitor:CheckOnlineStatus", @@ -23,6 +24,10 @@ RunCron( monitorType: MonitorType.Server, serverMonitorRequestReceivedAt: QueryHelper.lessThanEqualToOrNull(threeMinsAgo), + ...MonitorService.getEnabledMonitorQuery(), + project: { + ...ProjectService.getActiveProjectStatusQuery(), + }, }, props: { isRoot: true,