Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

data collection service? top --> graph! HELP!

Status
Not open for further replies.

linuxtricks

IS-IT--Management
May 24, 2000
111
0
0
US
Hi.
I'm used to a data collection service under VMS that collects all data for the entire system...you can then get graphs or tables of anything that went on in the system during any time period.

Let's say a server goes down at 12 noon today. I want to be able to refer back to some output that displays what was using the most cpu or memory or hd I/O , etc... from 11am to 12pm so that I can determin which app caused the headache.

Does anyone know of a way to get a listing of the processes that are using the highest amount of cpu in a system (like top does)? I'll need to find out how I can take that information and graph it out over a period of time.

I installed rrdtool and collected data from particular processes ok: [i.e. mysql cpu utilization reported by 'top'.]

[red]top n 1 b | grep mysqld | awk -- 'BEGIN { FS = " " } { print $9 }' | sed -e 's/\%//'[/red]

Thing is, I'm not sure how I can collect the information for every process on the machine over a period of time.

If top can:
run once every 5 mins or so... and automatically output everything it shows to a graph - and have the graph show the sequencial data through time, it would be exactly what I needed!

any help or ideas? :)



---
Try not. Do. Or do not. There is no try.
 
You might have more luck with the ps command:

%ps -aux

You could wrap this in a shell or perl command to parse the data and provide graphs. You could then run it as a cron or as a daemon.

Will.
fortytwo
will@hellacool.co.uk
 
Yeah, I used to LOVE VMS! It was the ONLY fully self contained standardized O/S I have ever seen. It is the only one that was:

MULTIUSER/TASKING with detached processing (sure UNIX has this, but most don't)
STANDARD SHELL (UNIX tends to have at least 2 favored shells, and several flavors of each)
FULLY INTEGRATED ISAM with directory display and easy setup (I don't know of any equal)
FULLY INTEGRATED multi rule ACLs with directory display and easy setup (again, no equal)

Too bad the I/O STUNK(It was the only fast computer that could not handle input as fast as I could type!), and the company didn't do right by its customers/sales force.

As for the answer to your question? PS is a VERY basic summary, and probably NOT what you want. Luckily MOST Unix variants now support a special device called proc! Just treat it like a normal disk drive. Here is an example:


[admin@ns admin]$ ls /proc
1 23730 28749 28761 32482 6 cpuinfo kcore partitions
10724 23731 28750 28762 359 7 devices kmsg pci
10725 23732 28751 3 368 7790 dma ksyms self
17068 23743 28752 32047 3740 7791 driver loadavg slabinfo
17671 23744 28753 32075 382 7813 execdomains locks stat
2 26002 28754 32093 396 864 filesystems lvm swaps
20785 28743 28755 32116 4 930 fs meminfo sys
20786 28744 28756 32124 4153 931 ide misc sysvipc
21043 28745 28757 32127 4338 932 interrupts modules tty
21064 28746 28758 32130 447 933 iomem mounts uptime
21066 28747 28759 32444 5 bus ioports mtrr version
21067 28748 28760 32479 522 cmdline irq net

[root@ns admin]# ls /proc/522
cmdline cwd environ exe fd maps mem root stat statm status
[root@ns admin]# cat /proc/522/cmdline
/usr/sbin/qpopper-R-B[root@ns admin]# cat /proc/522/statm
127 78 78 0 0 78 0
[root@ns admin]# cat /proc/522/status
Name: qpopper
State: S (sleeping)
Tgid: 522
Pid: 522
PPid: 1
TracerPid: 0
Uid: 0 0 0 0
Gid: 0 0 0 0
FDSize: 32
Groups:
VmSize: 2316 kB
VmLck: 0 kB
VmRSS: 312 kB
VmData: 76 kB
VmStk: 8 kB
VmExe: 124 kB
VmLib: 2000 kB
SigPnd: 0000000000000000
SigBlk: 0000000000000000
SigIgn: 8000000000010000
SigCgt: 0000000000004001
CapInh: 0000000000000000
CapPrm: 00000000fffffeff
CapEff: 00000000fffffeff
[root@ns admin]#

If you only want to see the tasks in descending order of resource use, use TOP. Again, that only gives basic info, but it DOES quickly tell you what is giving the system the most work.

Steve
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top