How to list non-relevant(RL) info on unix processes

(imported topic written by SystemAdmin)

Hi there,

I have systems running scripts as daemons and am not able to determine if they are running or not with my limited knowledge of RL.

example:

ps -ef|grep vmstat_test

username PID CHILD N TIME ? NN:NN /usr/local/bin/vmstat_test

Since scripts running as daemons do not have a Process Descriptor on many NIX platforms (unless it was written in ‘c’), is there a way I get the following info using Relevance Language?:

  1. the script is running as a daemon in the background (’(name of it) of processes’ does not work)

  2. the daemon owner

username

Thanks much,

(imported comment written by MarkA.Stevens)

I don’t have the exact process you are looking for. However, this should point you in the correct direction.

  1. ps -ef | egrep ‘vm’

root 2962 1 0 Oct06 ? 00:00:00

vmmemctl

root 3066 1 0 Oct06 ? 00:06:27 /usr/lib/vmware-tools/sbin32/vmware-guestd --background /var/run/vmware-guestd.pid

root 23976 23226 0 10:24 pts/2 00:00:00 egrep vm

Q: (names of it, id of it as string) of processes whose (name of it contains “vm”)

A: vmware-guestd, 3066

T: 2815

What I don’t understand is why didn’t I get:

A: vmmemctl, 2962

listed in my RL output?

(imported comment written by MarkA.Stevens)

Since I’m having trouble with sleeping processes showing up as “unnamed” I started down a path using a hint I found in http://forum.bigfix.com/viewtopic.php?id=1026 (Index » Fixlet Authoring » command line argument of running UNIX processes ) to search /proc, I have come up with pieces that get me:

  1. a process name from within the /proc/$PID/task/status file

parenthesized parts 1 of (matches (regex “^Name:%09(nfs.*)$”) of it) of (lines of file it) of ("/proc/" & pid of it as string & “/status”) of processes whose (name of it equals “unnamed”)

2A. an “internal” process id from within the status file

(parenthesized parts 1 of (matches (regex “^Pid:%09(.*)$”) of it) of (lines of file it) of ("/proc/" & pid of it as string & “/status”) of processes whose (name of it equals “unnamed”)

2B. an “external” process id of those processes which are sleeping (in square brackets

nfsd

)

(pid of it as string) of processes whose (name of it equals “unnamed”))

I’m having trouble tying it together to know that I have one each of all the pids for all the nfsd processes. I’ve managed to create a tuple to try to get the entries where the “external” pid matches the “internal” pid. The following generates external pid, name, internal pid for each tuple:

(parenthesized parts 1 of (matches (regex “^Pid:%09(.)$") of it) of (lines of file it) of ("/proc/" & pid of it as string & “/status”) of processes whose (name of it equals “unnamed”) , parenthesized parts 1 of (matches (regex "^Name:%09(nfs.)$”) of it) of (lines of file it) of ("/proc/" & pid of it as string & “/status”) of processes whose (name of it equals “unnamed”) , (pid of it as string) of processes whose (name of it equals “unnamed”)) whose (item 0 of it is item 2 of it)

Any suggestions?

(imported comment written by SystemAdmin)

Hello stevenam,

Thanks very much for trying so hard to resolve the issue I submitted and my thanks is not intended to discourage continuing efforts. The solution I’m working towards, of course, is a way to list the processes across all unix platforms and we all know how many different animals there are. There is a “long” workaround, but involves multiple steps. Basically running a fixlet to run unix commands and port the result to a text file…yuk! I don’t know if there is a way to run actual unix commandline statements from relevance, such as, from a managed property (I suspect not).

The reason some processes, especially scripts which are running as daemons do not show up, has to do with Process Descriptors that are actually tied in some fashion to binaries, like c-code that is compiled. I’ve done some research (I’m not a programmer, but have done lots of scripting) on the web and this is where I had learned about why my script(daemon) was not showing up with the process inspector.

Maybe IBM will add a non-PD process inspector at some point, with results that could display something like a ‘ps -ef’ command does, which is fairly standard across most unix platforms that I know of or are familiar with, (Solaris,Linux and HP-UX).

Thanks again for your persistence.