diff --git a/CommonServer/Utils/Probe/ProbeMonitorResponse.ts b/CommonServer/Utils/Probe/ProbeMonitorResponse.ts index 7a20769ba4..663412f487 100644 --- a/CommonServer/Utils/Probe/ProbeMonitorResponse.ts +++ b/CommonServer/Utils/Probe/ProbeMonitorResponse.ts @@ -913,20 +913,36 @@ export default class ProbeMonitorResponseService { return null; // if true then return null. } - if (input.monitor.monitorType === MonitorType.Server) { + if (input.monitor.monitorType === MonitorType.Server && (input.dataToProcess as ServerMonitorResponse).onlyCheckRequestReceivedAt) { + + const lastCheckTime: Date = ( + input.dataToProcess as ServerMonitorResponse + ).requestReceivedAt; + + const differenceInMinutes: number = + OneUptimeDate.getDifferenceInMinutes( + lastCheckTime, + OneUptimeDate.getCurrentDate() + ); + + + const offlineIfNotCheckedInMinutes: number = 2; + if ( input.criteriaFilter.checkOn === CheckOn.IsOnline && - input.criteriaFilter.filterType === FilterType.True + input.criteriaFilter.filterType === FilterType.True && differenceInMinutes <= offlineIfNotCheckedInMinutes ) { + if ((input.dataToProcess as ProbeMonitorResponse).isOnline) { return 'Monitor is online.'; } + return null; } if ( input.criteriaFilter.checkOn === CheckOn.IsOnline && - input.criteriaFilter.filterType === FilterType.False + input.criteriaFilter.filterType === FilterType.False && differenceInMinutes > offlineIfNotCheckedInMinutes ) { if (!(input.dataToProcess as ProbeMonitorResponse).isOnline) { return 'Monitor is offline.'; diff --git a/Ingestor/Middleware/TelemetryIngest.ts b/Ingestor/Middleware/TelemetryIngest.ts index bb2d2610d7..2ecf3830c0 100644 --- a/Ingestor/Middleware/TelemetryIngest.ts +++ b/Ingestor/Middleware/TelemetryIngest.ts @@ -50,6 +50,7 @@ export default class TelemetryIngest { 'service-token', serviceTokenInHeader as string ); + const serviceProjectId: string | null = await GlobalCache.getString( 'service-project-id', serviceTokenInHeader as string