Hey,
It is possible to monitor windows process?
For instance: All i want to do to see if this java process is running or not:
It is possible with telegraf?
Hey,
It is possible to monitor windows process?
For instance: All i want to do to see if this java process is running or not:
It is possible with telegraf?
Yes, actually you have two options. Most Windows users prefer to use the win_perf_counters
plugin as it is the most powerful of the two. I suggest using the perfmon
GUI to help you setup the plugin, which comes with Windows, so you can browse the available settings. The configuration will look something like this:
[[inputs.win_perf_counters]]
[[inputs.win_perf_counters.object]]
ObjectName = "Process"
Counters = ["% Processor Time","Handle Count","Private Bytes","Thread Count","Virtual Bytes","Working Set"]
Instances = ["javaw"]
Measurement = "win_proc"
Another option, though less frequently used in Windows, is the procstat
plugin:
[[inputs.procstat]]
exe = "javaw"
pid_finder = "native" // Recommended on Windows to avoid needing pgrep
Thank you for answer Daniel!
What if we have for instance 3 processes with the same name?
Often you will want to collect all of them. With win_perf_counters
Windows gives the first process a #1
suffix. When using procstat
you will want to ensure pid_tag = true
is set and consider cmdline_tag = true
, which may work well but also can be extremely long with some Java applications.
So if i have for instance 5 javaw process i should copy this 5 times?
[[inputs.win_perf_counters]]
[[inputs.win_perf_counters.object]]
ObjectName = “Process”
Counters = ["% Processor Time",“Handle Count”,“Private Bytes”,“Thread Count”,“Virtual Bytes”,“Working Set”]
Instances = [“javaw”]
Measurement = “win_proc”
But how i know which is which?
And another question, Do we have Counter who checking is process running or not?
I would recommend setting the UseWildcardsExpansion
option to true, and then using the “partial instance wildcard”: javaw*
. This will collect all java instances:
[[inputs.win_perf_counters]]
UseWildcardsExpansion = true
[[inputs.win_perf_counters.object]]
ObjectName = "Process"
Counters = ["% Processor Time","Handle Count","Private Bytes","Thread Count","Virtual Bytes","Working Set"]
Instances = ["javaw*"]
Measurement = “win_proc”
However, there isn’t a great way to tell which is which, because the Instance name is non descript: javaw
, javaw#1
, javaw#2
, and there isn’t access to the rest of the command. One thing that might be helpful is using the ID Process
counter which can be cross referenced with other tools.
For checking if a process is running there isn’t an explicit signal, you need to treat the absence of the metric as an error. If you are using Kapacitor for alerts perhaps you could set it to alert if there are fewer than 5 instances and also use a deadman’s switch for if there are metrics at all.
Thanks for your help! @daniel
How to know a process’ name
I don’t have my Windows system handy right now, but I believe it is tagged as instance
.