Will be possible to verify PID and pattern matching in the same check

Issue #353 closed
Stefano Paolo Morselli created an issue

Hello, I'm facing problems very similar to that of issue 151, but I'm only in the design process of my monit infrastructure. I want to know if it will be ever possible, in the near future, to have the option to mix check process PID and MATCH regex in the same statements. Could be the solution for some problems related to PID, PID files and process restarted or server reboot, but I don't know if it is technically possible or desiderable.

Thank you!

P.S. I'm sorry for my bad english, I will explain my idea with an example:

check process AppServer1 with pidfile /srv/catalina/tomcat1.pid and matching "tomcat1" ...

Comments (4)

  1. Tildeslash repo owner

    Hello Stefano,

    the next monit release improves the pattern based process check, so maybe you can use it without pidfile?

    Originally if the process forked (similarly to apache fork-model), the pattern based process check was not suitable for monitoring such process, as it it scanned the process tree for matching process using first-match (which may find child instead of apache's master process).

    The next monit release always looks for top-most process (parent) matching the pattern and selects also the parent with highest uptime (in case multiple processes on the same level with no common parent are found).

  2. Stefano Paolo Morselli reporter

    Hello tildeslash, thank you for the quick answer! Yes, I see the necessity to improving the pattern based process check, and I know that many troubles comes from PID file not correctly created in a temporary filesystem, but what I intended to say was: If I can chain together PID and match regex, in situation like when I have an Application Server or another application that spawns child processes, I can filter out only the father process, and I can be 99.99% sure I cannot do mistakes when I refer to that specific process, because, for example, I can filter the command line only for the father process (this will be discriminant only if the command line or something I can filter with regex match is different, I know that if I have no differences, I cannot have any discrimination). In my opinion Monit is doing a great job in the process management, but PID and match regex refer to something monit doesn't create or manage directly, and so could not be so easily controlled. The coupling of PID and pattern matching is not perfect, but far more flexible and precise that only the pid or the match regex, but, as I say in my first post, I don't know if it has reasons and feasability to be implemented.

    Thank you!

    P.S. And again, sorry for my bad english!

  3. Log in to comment