0 Replies Latest reply on Nov 1, 2017 8:52 AM by coofercat

    Linux Process Monitor Process Names

    coofercat

      I've just spent an hour or two looking into this, so thought I'd share for anyone else similarly stuck.

       

      I'm trying to monitor a bunch of processes on a Linux machine with the agent installed (Centos 7, if it matters). It seems that SW uses the output of something like "ps -ae" to get process names, but in my case, the processes have changed their names to far more descriptive ones (which you can see in "ps -ax").

       

      For example, this is what SW 'sees':

       

      119503 ?        03:24:06 ruby

      119971 ?        00:00:08 PassengerAgent

      119974 ?        01:09:47 PassengerAgent

      119982 ?        00:00:15 PassengerAgent

      119993 ?        00:00:00 nginx-1.12.1

      119994 ?        00:04:10 nginx-1.12.1

      120004 ?        00:00:00 PassengerAgent

      120070 ?        00:48:33 ruby

       

      ...but this is what I'd like to be able to use:

       

      119503 ?        Sl   204:07 sidekiq 4.2.7 myapp [0 of 25 busy]

      119971 ?        Ssl    0:08 Passenger watchdog

      119974 ?        Sl    69:47 Passenger core

      119982 ?        Sl     0:15 Passenger ust-router

      119993 ?        Ss     0:00 nginx: master process /usr/lib64/passenger/support-binaries/nginx-1.12.1 -c /tmp/passenger-standalone.trp0zs/nginx.conf -p /tmp/passenger-standalone.trp0zs

      119994 ?        S      4:10 nginx: worker process

      120004 ?        Ss     0:00 /usr/lib64/passenger/support-binaries/PassengerAgent temp-dir-toucher /tmp/passenger-standalone.trp0zs --cleanup --daemonize --pid-file /tmp/passenger-standalone.trp0zs/temp_

      120070 ?        Sl    48:33 Passenger RubyApp: /home/myapp/myapp

       

      It turns out you can monitor this quite effectively. In the Process Monitor (Component Monitor):

       

      - "Process Name" must be the 'ps -ae' name of the process (ie. the one derived from the binary that was run to create it)

      - "Command Line Filter" can be the changed name (as seen in 'ps -ef'). You can use the whole output

       

      Eg: Process Name: "PassengerAgent", Command Line Filter: "Passenger watchdog"

       

      The limitations here are that (say) you end up monitoring "nginx-1.12.1", because that's the binary name - if you do an upgrade, all your monitoring will erroneously break. You can't do a check on the "Process Name" with a wildcard to skip over minor differences like that. Either way, I hope it saves someone an hour or two :-)