From: Marc Fournier Date: Tue, 12 Jan 2016 21:21:39 +0000 (+0100) Subject: processes: warn about process names above OS limit X-Git-Tag: collectd-5.5.2~6^2~10^2~3 X-Git-Url: https://git.verplant.org/?a=commitdiff_plain;h=0ad1304b2b00720507ed57be67885df652583066;p=collectd.git processes: warn about process names above OS limit Fixes #1284 --- diff --git a/src/collectd.conf.pod b/src/collectd.conf.pod index d856d21c..3b7b9e64 100644 --- a/src/collectd.conf.pod +++ b/src/collectd.conf.pod @@ -4796,6 +4796,9 @@ collected for these selected processes are size of the resident segment size (RSS), user- and system-time used, number of processes and number of threads, io data (where available) and minor and major pagefaults. +Some platforms have a limit on the length of process names. I must stay +below this limit. + =item B I I Similar to the B option this allows to select more detailed diff --git a/src/processes.c b/src/processes.c index 86486147..b7775154 100644 --- a/src/processes.c +++ b/src/processes.c @@ -546,6 +546,10 @@ static int ps_config (oconfig_item_t *ci) { int i; +#if KERNEL_LINUX + const size_t max_procname_len = 15; +#endif + for (i = 0; i < ci->children_num; ++i) { oconfig_item_t *c = ci->children + i; @@ -566,6 +570,15 @@ static int ps_config (oconfig_item_t *ci) c->children_num, c->values[0].value.string); } +#if KERNEL_LINUX + if (strlen (c->values[0].value.string) > max_procname_len) { + WARNING ("processes plugin: this platform has a %lu character limit " + "to process names. The `Process \"%s\"' option will " + "not work as expected.", + max_procname_len, c->values[0].value.string); + } +#endif + ps_list_register (c->values[0].value.string, NULL); } else if (strcasecmp (c->key, "ProcessMatch") == 0)