From: Michael Tremer Date: Sat, 27 Sep 2025 18:14:10 +0000 (+0000) Subject: modules: Define the RRD schema X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=c67f534ca564b5474c7050d817606b54bcb68533;p=telemetry.git modules: Define the RRD schema Signed-off-by: Michael Tremer --- diff --git a/src/daemon/module.h b/src/daemon/module.h index db8e706..ce7362e 100644 --- a/src/daemon/module.h +++ b/src/daemon/module.h @@ -26,9 +26,26 @@ typedef struct collecty_module collecty_module; #include "ctx.h" #include "daemon.h" +#define MAX_FIELDS 64 + +typedef struct collecty_rrd_schema { + // Field + const char* field; + + // Type + const char* type; + + // Minimum/Maxmimum Value + int min; + int max; +} collecty_rrd_schema; + typedef struct collecty_module_methods { const char* name; + // RRD Schema + collecty_rrd_schema rrd_schema[MAX_FIELDS]; + // Init int (*init)(collecty_ctx* ctx); diff --git a/src/daemon/modules/loadavg.c b/src/daemon/modules/loadavg.c index dcd463a..3d7c1db 100644 --- a/src/daemon/modules/loadavg.c +++ b/src/daemon/modules/loadavg.c @@ -40,5 +40,15 @@ static int loadavg_collect(collecty_ctx* ctx, collecty_module* module) { const collecty_module_methods loadavg_module = { .name = "loadavg", + + // RRD Schema + .rrd_schema = { + { "load1", "GAUGE", 0, -1, }, + { "load5", "GAUGE", 0, -1, }, + { "load15", "GAUGE", 0, -1, }, + { NULL }, + }, + + // Methods .collect = loadavg_collect, };