process-exporter icon indicating copy to clipboard operation
process-exporter copied to clipboard

How to differienciate mutile process with same process name?

Open nickwu2008 opened this issue 1 year ago • 1 comments

How to differienciate mutile process with same process name The three processes has same process name 'padms' like below

[m119@test019 ~]$ ps -ef | grep "./padms"|grep -v test
m119    67110 147204  0 14:32 pts/13   00:00:00 ./padms
m119    67111  67110  0 14:32 pts/13   00:00:12 ./padms
m119    67345  67111  0 09:37 pts/13   00:00:04 [padms] <defunct>

I want to monitor the two process with below configration

process_names:

  - name: "{{.ExeFull}}"
    cmdline:
    - './padms'

Then observer the three processes metrics in grafana site,I only find one metrics with padms. How to differienciate the three processes ?

nickwu2008 avatar Sep 21 '23 02:09 nickwu2008

在name中添加Pid {{.PID}}

Template variables available:

  • {{.Comm}} contains the basename of the original executable, i.e. 2nd field in /proc/<pid>/stat
  • {{.ExeBase}} contains the basename of the executable
  • {{.ExeFull}} contains the fully qualified path of the executable
  • {{.Username}} contains the username of the effective user
  • {{.Matches}} map contains all the matches resulting from applying cmdline regexps
  • {{.PID}} contains the PID of the process. Note that using PID means the group will only contain a single process.
  • {{.StartTime}} contains the start time of the process. This can be useful in conjunction with PID because PIDs get reused over time.
  • {{.Cgroups}} contains (if supported) the cgroups of the process (/proc/self/cgroup). This is particularly useful for identifying to which container a process belongs.

tangguangliang avatar Dec 07 '23 03:12 tangguangliang