summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAdrien Mahieux <adrien.mahieux@gmail.com>2021-06-17 09:53:57 +0200
committerGitHub <noreply@github.com>2021-06-17 10:53:57 +0300
commit2e88104ddc4c2bf3a365c87d463b62c659635a49 (patch)
tree6deb80dd8383cdda626230e0469e9775407c7c93
parent8ac82fb6fa9613f25264ec9530145c91aafa9d5f (diff)
slabinfo: Handle slabs added after discovery (#11257)
-rw-r--r--collectors/slabinfo.plugin/slabinfo.c9
1 files changed, 8 insertions, 1 deletions
diff --git a/collectors/slabinfo.plugin/slabinfo.c b/collectors/slabinfo.plugin/slabinfo.c
index 863f440e44..58d9c4fffc 100644
--- a/collectors/slabinfo.plugin/slabinfo.c
+++ b/collectors/slabinfo.plugin/slabinfo.c
@@ -51,6 +51,8 @@ char *netdata_configured_host_prefix = "";
int running = 1;
int debug = 0;
+size_t lines_discovered = 0;
+int redraw_chart = 0;
// ----------------------------------------------------------------------------
@@ -187,6 +189,10 @@ struct slabinfo *read_file_slabinfo() {
// Iterate on all lines to populate / update the slabinfo struct
size_t lines = procfile_lines(ff), l;
+ if (unlikely(lines != lines_discovered)) {
+ lines_discovered = lines;
+ redraw_chart = 1;
+ }
slabdebug(" Read %lu lines from procfile", (unsigned long)lines);
for(l = 2; l < lines; l++) {
@@ -254,7 +260,8 @@ unsigned int do_slab_stats(int update_every) {
sactive = read_file_slabinfo();
// Init Charts
- if (unlikely(loops == 0)) {
+ if (unlikely(redraw_chart)) {
+ redraw_chart = 0;
// Memory Usage
printf("CHART %s.%s '' 'Memory Usage' 'B' '%s' '' line %d %d %s\n"
, CHART_TYPE