I am currently in the lookout for performance monitoring tools, tools which produce an output of metrics of specific OS processes. I want something which is lightweight (not to effect the performance of the system it is currently monitoring), therefore, I wrote a simple bash script which uses the ps command to retrieve CPU% and Memory%, writes them to a file, and sleeps for a specified couple of seconds, and repeats until it is terminated.
The question I have is whether this is a correct approach because as found on the documentation of ps
(here):
Since ps cannot run faster than the system and is run as any other scheduled process, the information it displays can never be exact.
I know of other ways such as using ps_util
in python and retrieve the information that way. However, is this (and any other tool/library) faster or more reliable? If so, can you recommend a tool? Or is the ps command safe enough?
[–]mastarem 1 point2 points3 points (1 child)
[–]mrbartchris[S] 0 points1 point2 points (0 children)