diff --git a/plugins/in_process_exporter_metrics/pe.h b/plugins/in_process_exporter_metrics/pe.h index 96bc37b96e2..ae282978706 100644 --- a/plugins/in_process_exporter_metrics/pe.h +++ b/plugins/in_process_exporter_metrics/pe.h @@ -52,6 +52,7 @@ struct flb_pe { struct flb_input_instance *ins; /* input instance */ struct mk_list *metrics; /* enabled metrics */ int enabled_flag; /* indicate enabled metrics */ + long page_size; /* page size for converting number of pages to bytes */ /* * Metrics Contexts diff --git a/plugins/in_process_exporter_metrics/pe_config.c b/plugins/in_process_exporter_metrics/pe_config.c index 851c53444e7..f003d0a8dc7 100644 --- a/plugins/in_process_exporter_metrics/pe_config.c +++ b/plugins/in_process_exporter_metrics/pe_config.c @@ -100,6 +100,8 @@ struct flb_pe *flb_pe_config_create(struct flb_input_instance *ins, return NULL; } + ctx->page_size = sysconf(_SC_PAGESIZE); + return ctx; } diff --git a/plugins/in_process_exporter_metrics/pe_process.c b/plugins/in_process_exporter_metrics/pe_process.c index 6706e8bd37b..1d303b21663 100644 --- a/plugins/in_process_exporter_metrics/pe_process.c +++ b/plugins/in_process_exporter_metrics/pe_process.c @@ -1108,6 +1108,8 @@ static int process_update(struct flb_pe *ctx) tmp = entry->str; /* Collect the number of RSS per process */ if (pe_utils_str_to_uint64(tmp, &val) != -1) { + /* convert RSS memory in number of pages to bytes */ + val = val * ctx->page_size; cmt_gauge_set(ctx->memory_bytes, ts, val, 4, (char *[]){ name, pid_str, ppid_str, "rss" }); }