diff options
-rw-r--r-- | collectors/apps.plugin/apps_plugin.c | 31 |
1 files changed, 21 insertions, 10 deletions
diff --git a/collectors/apps.plugin/apps_plugin.c b/collectors/apps.plugin/apps_plugin.c index 39023c2286..fa07802422 100644 --- a/collectors/apps.plugin/apps_plugin.c +++ b/collectors/apps.plugin/apps_plugin.c @@ -106,6 +106,7 @@ static int enable_file_charts = 1, max_fds_cache_seconds = 60, #endif + enable_function_cmdline = 0, enable_detailed_uptime_charts = 0, enable_users_charts = 1, enable_groups_charts = 1, @@ -4122,6 +4123,10 @@ static void parse_args(int argc, char **argv) enable_detailed_uptime_charts = 1; continue; } + if(strcmp("with-function-cmdline", argv[i]) == 0) { + enable_function_cmdline = 1; + continue; + } if(strcmp("-h", argv[i]) == 0 || strcmp("--help", argv[i]) == 0) { fprintf(stderr, @@ -4139,6 +4144,11 @@ static void parse_args(int argc, char **argv) "\n" " debug enable debugging (lot of output)\n" "\n" + " with-function-cmdline enable reporting the complete command line for processes\n" + " it includes the command and passed arguments\n" + " it may include sensitive data such as passwords and tokens\n" + " enabling this could be a security risk\n" + "\n" " with-childs\n" " without-childs enable / disable aggregating exited\n" " children resources into parents\n" @@ -4538,10 +4548,10 @@ static void apps_plugin_function_processes(const char *transaction, char *functi // cmd buffer_json_add_array_item_string(wb, p->comm); -#ifdef NETDATA_DEV_MODE // cmdline - buffer_json_add_array_item_string(wb, (p->cmdline && *p->cmdline) ? p->cmdline : p->comm); -#endif + if (enable_function_cmdline) { + buffer_json_add_array_item_string(wb, (p->cmdline && *p->cmdline) ? p->cmdline : p->comm); + } // ppid buffer_json_add_array_item_uint64(wb, p->ppid); @@ -4648,13 +4658,14 @@ static void apps_plugin_function_processes(const char *transaction, char *functi RRDF_FIELD_FILTER_MULTISELECT, RRDF_FIELD_OPTS_VISIBLE | RRDF_FIELD_OPTS_STICKY, NULL); -#ifdef NETDATA_DEV_MODE - buffer_rrdf_table_add_field(wb, field_id++, "CmdLine", "Command Line", RRDF_FIELD_TYPE_DETAIL_STRING, - RRDF_FIELD_VISUAL_VALUE, RRDF_FIELD_TRANSFORM_NONE, 0, - NULL, NAN, RRDF_FIELD_SORT_ASCENDING, NULL, RRDF_FIELD_SUMMARY_COUNT, - RRDF_FIELD_FILTER_MULTISELECT, - RRDF_FIELD_OPTS_NONE, NULL); -#endif + if (enable_function_cmdline) { + buffer_rrdf_table_add_field(wb, field_id++, "CmdLine", "Command Line", RRDF_FIELD_TYPE_STRING, + RRDF_FIELD_VISUAL_VALUE, RRDF_FIELD_TRANSFORM_NONE, 0, + NULL, NAN, RRDF_FIELD_SORT_ASCENDING, NULL, RRDF_FIELD_SUMMARY_COUNT, + RRDF_FIELD_FILTER_MULTISELECT, + RRDF_FIELD_OPTS_NONE, NULL); + } + buffer_rrdf_table_add_field(wb, field_id++, "PPID", "Parent Process ID", RRDF_FIELD_TYPE_INTEGER, RRDF_FIELD_VISUAL_VALUE, RRDF_FIELD_TRANSFORM_NUMBER, 0, NULL, NAN, RRDF_FIELD_SORT_ASCENDING, "PID", RRDF_FIELD_SUMMARY_COUNT, |