From: Michael Tremer Date: Fri, 28 Nov 2025 13:27:06 +0000 (+0000) Subject: sources: unbound: Collect memory usage of the cache & modules X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=983ef4d68b967cd650652eca0781bfe872818752;p=collecty.git sources: unbound: Collect memory usage of the cache & modules Signed-off-by: Michael Tremer --- diff --git a/src/daemon/sources/unbound.c b/src/daemon/sources/unbound.c index 093195e..33d2229 100644 --- a/src/daemon/sources/unbound.c +++ b/src/daemon/sources/unbound.c @@ -37,6 +37,11 @@ static int unbound_on_success(td_ctx* ctx, unsigned long rrset_cache_count = 0; unsigned long infra_cache_count = 0; unsigned long key_cache_count = 0; + unsigned long mem_cache_rrset = 0; + unsigned long mem_cache_message = 0; + unsigned long mem_mod_iterator = 0; + unsigned long mem_mod_validator = 0; + unsigned long mem_mod_respip = 0; double rec_time_median = 0; double rec_time_avg = 0; int r; @@ -58,6 +63,15 @@ static int unbound_on_success(td_ctx* ctx, PARSE1("infra.cache.count=%ld", &infra_cache_count), PARSE1("key.cache.count=%ld", &key_cache_count), + // Cache Memory Usage + PARSE1("mem.cache.rrset=%ld", &mem_cache_rrset), + PARSE1("mem.cache.message=%ld", &mem_cache_message), + + // Module Memory Usage + PARSE1("mem.mod.iterator=%ld", &mem_mod_iterator), + PARSE1("mem.mod.validator=%ld", &mem_mod_validator), + PARSE1("mem.mod.respip=%ld", &mem_mod_respip), + { NULL }, }; @@ -82,7 +96,16 @@ static int unbound_on_success(td_ctx* ctx, VALUE_UINT64("cache_msg_objects", &msg_cache_count), VALUE_UINT64("cache_rrset_objects", &rrset_cache_count), VALUE_UINT64("cache_infra_objects", &infra_cache_count), - VALUE_UINT64("cache_key_objects", &key_cache_count) + VALUE_UINT64("cache_key_objects", &key_cache_count), + + // Cache Memory Usage + VALUE_UINT64("mem_cache_rrset", &mem_cache_rrset), + VALUE_UINT64("mem_cache_message", &mem_cache_message), + + // Module Memory Usage + VALUE_UINT64("mem_mod_iterator", &mem_mod_iterator), + VALUE_UINT64("mem_mod_validator", &mem_mod_validator), + VALUE_UINT64("mem_mod_respip", &mem_mod_respip) )); } @@ -116,6 +139,15 @@ const td_source_impl unbound_source = { { "cache_infra_objects", "GAUGE", 0, -1 }, { "cache_key_objects", "GAUGE", 0, -1 }, + // Cache Memory Usage + { "mem_cache_rrset", "GAUGE", 0, -1 }, + { "mem_cache_message", "GAUGE", 0, -1 }, + + // Module Memory Usage + { "mem_mod_iterator", "GAUGE", 0, -1 }, + { "mem_mod_validator", "GAUGE", 0, -1 }, + { "mem_mod_respip", "GAUGE", 0, -1 }, + { NULL }, },