ncabatoff / process-exporter

Prometheus exporter that mines /proc to report on selected processes
MIT License
1.72k stars 270 forks source link

Looking for specific processes. #198

Closed waardd closed 3 years ago

waardd commented 3 years ago

I want to count certain processes with process-exporter. But i can't seem to figure out how to seperate them.

I do a simple search now with this config:

process_names:
  - comm:
    - java
    - node_exporter
    - process-exporte
    - java8
    - Agent.Listner
    - splunkd
    - tee

But what i want is a seperation of java processes on a argument.

So i have some processes like: /usr/bin/sh -c /usr/lib/jvm/jre-11-openjdk/bin/java /usr/bin/sh -c /usr/lib/jvm/jre-11-openjdk/bin/java /usr/lib/jvm/jre-11-openjdk/bin/java /usr/lib/jvm/jre-11-openjdk/bin/java

How do i count/monitor them seperatly?

Should i do something with:

  - name: "{{.Comm}}<and_more>"
    cmdline:
    - '.+<some_regex>'
ncabatoff commented 3 years ago

Hi @waardd,

Sorry, I don't have enough time to help people with questions here, I only take bug reports and feature requests.

nbadam2105 commented 2 years ago

@waardd did you find the solution?

waardd commented 2 years ago

Found this method to be working.

process_names:

comm is the second field of /proc//stat minus parens.

It is the base executable name, truncated at 15 chars.

It cannot be modified by the program, unlike exe.

All processes

- name: "{{.Comm}}"

cmdline:

- '.+'