I want to periodically monitor the CPU usage and plot in time series. Not having much knowledge, I plan to use the top command, something like this question (Monitor cpu usage (and perhaps memory using) for a single process simple as possible). However, when I issue command like "top -c -p PID", I want it to output then exit automatically without manually type q or ctrl-c. And if not using top, what other command can achieve the same function without interactivity?
Asked
Active
Viewed 258 times
2 Answers
1
If you want to monitor the things for particular process you can use command:
ps -flp <PID>
if you want to monitor overall performance of the system you can use vmstat from sysstat package:
vmstat 1 2
and get the second line (first is average from the server start)
Romeo Ninov
- 6,677