]> git.ipfire.org Git - collecty.git/commitdiff
modules: Define the RRD schema
authorMichael Tremer <michael.tremer@ipfire.org>
Sat, 27 Sep 2025 18:14:10 +0000 (18:14 +0000)
committerMichael Tremer <michael.tremer@ipfire.org>
Sat, 27 Sep 2025 18:14:10 +0000 (18:14 +0000)
Signed-off-by: Michael Tremer <michael.tremer@ipfire.org>
src/daemon/module.h
src/daemon/modules/loadavg.c

index db8e70632d2ef39e14f0e4d9e477fba4c31864a4..ce7362e8f243aa2027dc7d41daa29aa94208bb6d 100644 (file)
@@ -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);
 
index dcd463ad3367e04a91781275105a056e0ada7a52..3d7c1db2d7bf1c9026837f72200dcf6883b3612b 100644 (file)
@@ -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,
 };