mirror of
https://github.com/fosrl/pangolin.git
synced 2026-05-28 11:43:03 +00:00
@@ -9,7 +9,7 @@ export async function fireHealthCheckHealthyAlert(
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
export async function fireHealthCheckNotHealthyAlert(
|
export async function fireHealthCheckUnhealthyAlert(
|
||||||
orgId: string,
|
orgId: string,
|
||||||
healthCheckId: number,
|
healthCheckId: number,
|
||||||
healthCheckName?: string,
|
healthCheckName?: string,
|
||||||
|
|||||||
20
server/lib/alerts/events/resourceEvents.ts
Normal file
20
server/lib/alerts/events/resourceEvents.ts
Normal file
@@ -0,0 +1,20 @@
|
|||||||
|
export async function fireResourceHealthyAlert(
|
||||||
|
orgId: string,
|
||||||
|
resourceId: number,
|
||||||
|
resourceName?: string | null,
|
||||||
|
extra?: Record<string, unknown>
|
||||||
|
): Promise<void> {}
|
||||||
|
|
||||||
|
export async function fireResourceUnhealthyAlert(
|
||||||
|
orgId: string,
|
||||||
|
resourceId: number,
|
||||||
|
resourceName?: string | null,
|
||||||
|
extra?: Record<string, unknown>
|
||||||
|
): Promise<void> {}
|
||||||
|
|
||||||
|
export async function fireResourceToggleAlert(
|
||||||
|
orgId: string,
|
||||||
|
resourceId: number,
|
||||||
|
resourceName?: string | null,
|
||||||
|
extra?: Record<string, unknown>
|
||||||
|
): Promise<void> {}
|
||||||
@@ -1,2 +1,3 @@
|
|||||||
export * from "./events/siteEvents";
|
export * from "./events/siteEvents";
|
||||||
export * from "./events/healthCheckEvents";
|
export * from "./events/healthCheckEvents";
|
||||||
|
export * from "./events/resourceEvents";
|
||||||
|
|||||||
@@ -102,7 +102,7 @@ export async function fireHealthCheckUnhealthyAlert(
|
|||||||
});
|
});
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
logger.error(
|
logger.error(
|
||||||
`fireHealthCheckNotHealthyAlert: unexpected error for healthCheckId ${healthCheckId}`,
|
`fireHealthCheckUnhealthyAlert: unexpected error for healthCheckId ${healthCheckId}`,
|
||||||
err
|
err
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -17,3 +17,4 @@ export * from "./sendAlertWebhook";
|
|||||||
export * from "./sendAlertEmail";
|
export * from "./sendAlertEmail";
|
||||||
export * from "./events/siteEvents";
|
export * from "./events/siteEvents";
|
||||||
export * from "./events/healthCheckEvents";
|
export * from "./events/healthCheckEvents";
|
||||||
|
export * from "./events/resourceEvents";
|
||||||
|
|||||||
@@ -14,7 +14,10 @@ import {
|
|||||||
fireHealthCheckHealthyAlert,
|
fireHealthCheckHealthyAlert,
|
||||||
fireHealthCheckUnhealthyAlert
|
fireHealthCheckUnhealthyAlert
|
||||||
} from "#dynamic/lib/alerts";
|
} from "#dynamic/lib/alerts";
|
||||||
import { fireResourceHealthyAlert, fireResourceUnhealthyAlert } from "@server/private/lib/alerts/events/resourceEvents";
|
import {
|
||||||
|
fireResourceHealthyAlert,
|
||||||
|
fireResourceUnhealthyAlert
|
||||||
|
} from "#dynamic/lib/alerts";
|
||||||
|
|
||||||
interface TargetHealthStatus {
|
interface TargetHealthStatus {
|
||||||
status: string;
|
status: string;
|
||||||
@@ -223,13 +226,13 @@ export const handleHealthcheckStatusMessage: MessageHandler = async (
|
|||||||
await fireHealthCheckUnhealthyAlert(
|
await fireHealthCheckUnhealthyAlert(
|
||||||
orgId,
|
orgId,
|
||||||
targetCheck.targetHealthCheckId,
|
targetCheck.targetHealthCheckId,
|
||||||
targetCheck.name
|
targetCheck.name ?? undefined
|
||||||
);
|
);
|
||||||
} else if (healthStatus.status === "healthy") {
|
} else if (healthStatus.status === "healthy") {
|
||||||
await fireHealthCheckHealthyAlert(
|
await fireHealthCheckHealthyAlert(
|
||||||
orgId,
|
orgId,
|
||||||
targetCheck.targetHealthCheckId,
|
targetCheck.targetHealthCheckId,
|
||||||
targetCheck.name
|
targetCheck.name ?? undefined
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user