Somebody can help me to find a tool or combine tools to make a statistic and build chart of tasks activity, i need to monitoring how much % process use from cpu and show this in grath (%, and hour)
The pidstat tool (part of sysstat package) may collect process statistics. Filter out what you are looking for with sed and awk. Plot using graph and plot.
Maybe sar (system activity recorder) and isag (interactive system activity grapher) will be useful to you.
can i with pidstat monitoring process activity for 24 Hour and save this to file or this comand is only solution "pidstats 8640 10 > /tmp/stats.txt "
Yes. Please have a closer look at the man page. Basically all you need to know about this is written there.
Typically you’ll need the process id (pid) of the process you wish to monitor. Assuming you would like to save the output of pidstat once every second for 24 hours into a file you could run the command like this:
pidstat -p *pid* 1 86400 > /tmp/stats.txt
Replace pid with the actual process id. Perhaps you should start with a few seconds first, instead of the full 86400 for the entire 24 hours, just to see that this is what you are really looking for.
But since you are aiming to plot this data in a graph you should first figure out how to filter the output of pidstat, only to get the data needed. This could typically be done with the grep, sed and awk tools. So, have a look at those man pages too.
In the end, if you wish to use the graph and plot tools to graphically display the data, you need to know the input to those. More man pages to read
Seeing all this reading of man pages can take a bit of time, perhaps you can tell us why you need to do this. There may be easier ways to accomplish your goal.
i find a way how to sort needed data , with awk i select column what i need .
output data look like that
Linux 2.6.27.37-0.1-pae (linux-i85r) 11/11/2009 _i686_
05:09:00 PM PID %usr %system %guest %CPU CPU Command
05:09:11 PM 6 0.00 0.20 0.00 0.20 1 ksoftirqd/1
05:09:11 PM 3183 2.99 0.30 0.00 3.29 0 Xorg
05:09:11 PM 5012 0.00 0.20 0.00 0.20 1 kicker
05:09:11 PM PID %usr %system %guest %CPU CPU Command
05:09:21 PM 7 0.00 0.20 0.00 0.20 0 events/0
05:09:21 PM 1542 0.00 0.20 0.00 0.20 0 kjournald
05:09:21 PM 3183 1.60 0.10 0.00 1.70 0 Xorg
after executing this script
#!/bin/sh
cat -n $1 | head -n 3 | awk '{print $1,$2,$3,$4,$8,$10}' > /tmp/stats.txt
cat -n $1 | awk '{ if($2 != "Average:" && $4 != "PID" && $2 !="" && $1 != "1" ) print $1,$2,$3,$4,$8,$10}' >> /tmp/stats.txt
the output will look like this
3 05:09:00 PM PID %CPU Command
4 05:09:11 PM 6 0.20 ksoftirqd/1
5 05:09:11 PM 3183 3.29 Xorg
6 05:09:11 PM 5012 0.20 kicker
7 05:09:11 PM 5027 0.60 yakuake
after that i can put this output in openoffice and build graph
but in man page i cant find what option put to pidstat that command look not just for example “Xorg” but full path somthing like this “/usr/bin/Xorg -br -nolisten tcp :0 vt7 -auth /var/lib/xdm/authdir/authfiles/A:0-JYcwic” ., can sombody help me to do this ?
I don’t think pidstat can do that. Perhaps you can extend your script to use the ps command together with the process id, pid, in question. Something like this:
ps -f -p *pid* | grep *pid* | awk '{for (i=8;i<=NF;i++) printf("%s%s",$i,(i==NF?"
":" "))}'