I am currently using procstat as input plugin in telgraf to collect the metrics of the running process. However, I dint find a way to check the status of the processes. For example we have a requirement of checking the status of java process if it is running or not.
Appreciate if anyone can help on this.
Check monit
It provides metric monit_process
with status_code
field
There should be a procstat_lookup
metric that states this. For example:
procstat_lookup,pattern=firefox2,pid_finder=pgrep,result=success pid_count=0i,running=0i,result_code=0i 1721056611000000000
It shows there were no running firefox2
processes versus when I use firefox
I get:
procstat_lookup,pattern=firefox,pid_finder=pgrep,result=success pid_count=14i,running=14i,result_code=0i 1721056607000000000
To show 14 running processes
@jpowers
Thanks for the inputs. I will check this.
But in my case I am looking for java processes status. There are around 10 java processes in total and all of them have pattern as only “java”.
I have no experience with your particular use case, so the more information you can provide the better. Do note, that you can use additional filters, patterns, etc. See the plugin readme: telegraf/plugins/inputs/procstat at master · influxdata/telegraf · GitHub For example, the patterns option to match against the full command.
It may be that you need to write a simple script to find your specific process and report that to Telegraf using the exec plugin.