feat: Add 'local service' monitor type

This adds a new monitor type to check local services by executing a shell command. It also includes fixes for Prometheus errors when adding new tags and for the UI not updating when tags are changed.
This commit is contained in:
iotux
2025-12-09 14:19:38 +01:00
parent 883083f5c3
commit 7461bd296f
8 changed files with 225 additions and 39 deletions

View File

@@ -0,0 +1,33 @@
const { settings } = require("../../server/util-server");
/**
* @param {import("knex").Knex} knex
*/
exports.up = async (knex) => {
await knex.schema.alterTable("monitor", (table) => {
table.string("local_service_command");
table.string("local_service_expected_output");
table.string("local_service_check_type").notNullable().defaultTo("keyword");
});
};
/**
* @param {import("knex").Knex} knex
*/
exports.down = async (knex) => {
if (await knex.schema.hasColumn("monitor", "local_service_command")) {
await knex.schema.alterTable("monitor", (table) => {
table.dropColumn("local_service_command");
});
}
if (await knex.schema.hasColumn("monitor", "local_service_expected_output")) {
await knex.schema.alterTable("monitor", (table) => {
table.dropColumn("local_service_expected_output");
});
}
if (await knex.schema.hasColumn("monitor", "local_service_check_type")) {
await knex.schema.alterTable("monitor", (table) => {
table.dropColumn("local_service_check_type");
});
}
};