Monitor specific application process in Linux

26 views
Skip to first unread message

Juan Rosero

unread,
May 19, 2020, 3:11:47 AM5/19/20
to Prometheus Users
Hello,

I've been reading a lot on different sites and this User Group as well, but have not come up with a clear answer. I need to monitor a specific application process in Linux and verify if it's running and I've been reading about --collector.processes and enabling it on Node Exporter. Ideally, I would like to narrow down to that specific process instead of getting info on all running processes on the system. What's the best approach for this and correct syntax?

Many thanks!

Vu Tuan Dat

unread,
May 19, 2020, 4:37:43 AM5/19/20
to Prometheus Users
Ideally, write a exporter for your specific process, it's not that hard.

Or instrument directly into your app.

Brian Candler

unread,
May 19, 2020, 5:04:17 AM5/19/20
to Prometheus Users
You can use a little script to write metrics to a textfile and pick them up with node_exporter's textfile_collector, and run it periodically (e.g. from cron).

The textfile_collector also exposes the timestamp when the file was last modified, so you can alert if it stops being updated.

Christian Hoffmann

unread,
May 19, 2020, 5:41:37 PM5/19/20
to Juan Rosero, Prometheus Users
Hi Juan,
On 5/19/20 9:11 AM, Juan Rosero wrote:
> I've been reading a lot on different sites and this User Group as well,
> but have not come up with a clear answer. I need to monitor a specific
> application process in Linux and verify if it's running and I've been
> reading about *--collector.processes* and enabling it on Node Exporter.
> Ideally, I would like to narrow down to that specific process instead of
> getting info on all running processes on the system. What's the best
> approach for this and correct syntax?

Besides the other replies, there are also existing process exporters
which may fit your use case.
I've been using this one:
https://github.com/ncabatoff/process-exporter

Just expect that it may accumulate some CPU time over time (which is not
necessarily a problem with that implementation; older monitoring tools
might use "ps" for such checks and cpu time will never be tracked for
them as one would only have short-living processes compared to
process_exporter).

Kind regards,
Christian
Message has been deleted

Juan Rosero

unread,
May 19, 2020, 8:22:42 PM5/19/20
to Prometheus Users
Thanks everyone! I'll explore the options suggested and see what works best. Thanks again and have a great day/evening!
Reply all
Reply to author
Forward
0 new messages