procmatch limits command-line to 4096 characters
Hi,
I have a process loading a lot of libraries (Apache Kafka), and the full command-line takes ~5200 characters, with all meaningful arguments being at the end. So I can't distinguish 2 processes that have the same command(line for the ~4500 first characters.
Let me know if you want more details.
Any way to increase how many characters of the commandline monit reads ?
Comments (6)
-
-
Hello,
a question of understanding only, from the past I know I get not the whole command line by "ps" because the max length is/was limited to 4096 characters, based on the used PAGE_SIZE. I got the problem with AIX also.Are you sure the whole command line is available in the "/sys" or "/proc" filesystem. In AIX the available command line is limited to the PAGE_SIZE, but you can enter longer commands.
With regard,
Lutz -
Hi,
It seems so indeed, at least on Linux :root@euppkaf01:~# cat /proc/21236/cmdline | wc 0 1 4615 root@euppkaf01:~# uname -r 3.10.0-862.3.2.el7.x86_64 root@euppkaf01:~# cat /etc/redhat-release Red Hat Enterprise Linux Server release 7.5 (Maipo)
(That’s my problematic case with kafka where the meaningful string is beyond 4096, so I can’t differentiate Brokers from MirrorMaker instances)
-
Hello Maxime,
thanks for your test, I/we fix the problem with an additional dummy "-D" option at the beginning of the command line, in a AIX/Linux Liberty Profile/Websphere application server environment. The dummy option contain a useful unique name to differentiate the application JVMs.Unfortunately, the proc cmdline length checked, the buffer size, is set to 4096 in Monit. A new "set limits" option seems to be useful to handle this in the future like the "fileContentBuffer" option for "match".
With regards,
Lutzp.s.
The used command line seems to be shorter than 4096 with MacOS. -
repo owner - changed status to resolved
Fixed: Issue
#851: Linux and AIX: The length of the string that describes the process name and its arguments was limited to 4kB, so the "procmatch" may not find the process if the pattern is past this limit. The limit was removed on Linux. On AIX the limit was rised to 8kB.→ <<cset 9210d131999f>>
-
Thank you very much for this fix. I was looking forward to it.
- Log in to comment
That would require to modify src/process/sysdep_LINUX.c :
sed “s/4096/80192/” on the whole file should suffice.
(note : i’m the original submitter of this issue)