alerting for gateways and relays

This commit is contained in:
x032205
2025-10-08 23:46:47 -04:00
parent 12b59fc2c0
commit c6696d4fde
12 changed files with 365 additions and 18 deletions
@@ -0,0 +1,29 @@
import { Knex } from "knex";
import { TableName } from "../schemas";
export async function up(knex: Knex): Promise<void> {
if (!(await knex.schema.hasColumn(TableName.Relay, "healthAlertedAt"))) {
await knex.schema.alterTable(TableName.Relay, (t) => {
t.datetime("healthAlertedAt");
});
}
if (!(await knex.schema.hasColumn(TableName.GatewayV2, "healthAlertedAt"))) {
await knex.schema.alterTable(TableName.GatewayV2, (t) => {
t.datetime("healthAlertedAt");
});
}
}
export async function down(knex: Knex): Promise<void> {
if (await knex.schema.hasColumn(TableName.GatewayV2, "healthAlertedAt")) {
await knex.schema.alterTable(TableName.GatewayV2, (t) => {
t.dropColumn("healthAlertedAt");
});
}
if (await knex.schema.hasColumn(TableName.Relay, "healthAlertedAt")) {
await knex.schema.alterTable(TableName.Relay, (t) => {
t.dropColumn("healthAlertedAt");
});
}
}
+2 -1
View File
@@ -18,7 +18,8 @@ export const GatewaysV2Schema = z.object({
relayId: z.string().uuid().nullable().optional(),
name: z.string(),
heartbeat: z.date().nullable().optional(),
encryptedPamSessionKey: zodBuffer.nullable().optional()
encryptedPamSessionKey: zodBuffer.nullable().optional(),
healthAlertedAt: z.date().nullable().optional()
});
export type TGatewaysV2 = z.infer<typeof GatewaysV2Schema>;
+2 -1
View File
@@ -15,7 +15,8 @@ export const RelaysSchema = z.object({
identityId: z.string().uuid().nullable().optional(),
name: z.string(),
host: z.string(),
heartbeat: z.date().nullable().optional()
heartbeat: z.date().nullable().optional(),
healthAlertedAt: z.date().nullable().optional()
});
export type TRelays = z.infer<typeof RelaysSchema>;