can I use ps to log overall system stats.


 
Thread Tools Search this Thread
Operating Systems AIX can I use ps to log overall system stats.
# 1  
Old 08-29-2007
can I use ps to log overall system stats.

Hi I'm writing a script to get overall system memory and cpu utilization in percentages, much like in top or with AIX's topas.
Could I use 'ps' to get the same, I know I can get such results for a particular or group of PIDs but I haven't been able to figure out how I could use 'ps' to give me general system wide statsSmilie.
Is there some other utility I could incorporate in to my script so that I may dump this info into a csv sort of file. This need to work on AIX 5.2 & 5.3
Thanks in advance.
# 2  
Old 08-30-2007
Sorry for not answering for "ps" question, I don't have man pages installed on my aix boxes (I know, this is stupid), but I will recommend this tool for gathering such info - get the source code and build it, it's awesome tool, plus it has the csv reporting option that you asked about. If someone has thoughts to share for the "ps" question, I will be glad to learn it too.
# 3  
Old 08-30-2007
if you have man pages in your system you look at this ;

vmstat 1 20 :gives virtual memory stats. 20 times 1 is the period (1 second)
or vmstsat 1 or else

ps -ef :gives systemwide resultsSmilierocesses stats
ps aux :gives some other systemwide results Smilierocesses stats
sar 1 1 or sar -P ALL etc sar gives cpu stats ( vmstat gives this information additionally to memory stats. But sar gives detailed info for all cpu )

netstat -v |netstat -D |netstat -i|netstat -r |netstat -in or etc.gives networtk stats

iostat 1 10 gives io stats

filemon gives filesystem stats

topas uses this underneath : sou you must read these from man pages
# 4  
Old 08-31-2007
Hi, I'm looking into that tool sysgate, my corporate firewall (sonic) had it blocked so I'm in the process of getting that opened up, I'm quite interested from your description. I ended up using vmstat and iostat, though the better option would have been 'sar'. It relies on a few services to populate a file with sa1 and sa2, it's in the manual, unfortunately I couldn't get the time to configure it, I went with a simple script for the time being till the site opens up:
#!/bin/bash

# applabs.com

# Author: Siddharth Mody (siddharth.mody@gmail.com)

#===============START===============

ROOT_UID=0 # only users with $UID 0 have root privilages.

E_NOROOT=67 # Non-root exit error.

FILENAME=$1-${BACKUPDATE}".mem"



#check if root user.

# Run as root:

if [ "$UID" -ne "$ROOT_UID" ]

then

echo "Must be root to run this script"

exit $E_NOTROOT

fi;

testrun=$1;



# start timer

while true

do

read_time=$(date +%m.%d.%Y-%H\:%M\:%S);

# used and free memory pages of 4k chunks

avm=$(vmstat | awk '{print $3}' | tail -n 1);

fre=$(vmstat | awk '{print $4}' | tail -n 1);

cpu=$(iostat -s | awk '{print $4}' );

read -r -a array <<< $cpu;

cpu=${array[2]};

logdata=${cpu}","${avm}

mainheader="time,pcpu,pmem(4k chunks)";



if [ -f ${testrun}"_sysMon.csv" ]

then

:

else

echo "["$(uname -a)"]" >> ${testrun}"_sysMon.csv"

echo "${mainheader}" >> ${testrun}"_sysMon.csv"

fi

#log data into file

echo ${read_time};

echo ${read_time}","${logdata} >> ${testrun}"_sysMon.csv"

sleep 15

done

exit 0



If anybody could tell me how to manage that data extraction using awk with specifying line numbers I could get rid of all those read and tail statements.

Thanks for all the help so far, I really appreciate this forum.Smilie
# 5  
Old 08-31-2007
PerfPMR

Use PerfPRM tool by IBM, untar and use their scripts, either the main one or run them one at a time
# 6  
Old 08-31-2007
PerfPMR is, strictly speaking, version specific but you may be able to parse the v5.2 and v5.3 releases and find common scripts to achieve your goal.

Details:
pSeries and AIX Information Center

Download:
ftp://ftp.software.ibm.com/aix/tools/perftools/perfpmr/
# 7  
Old 09-17-2007
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. UNIX for Advanced & Expert Users

Recording stats for Comcast

The last few weeks I've had a problem with Comcast in San Francisco (anyone else sharing the same issue ? Please share !) During the late afternoon throughout early morning hours I see a high amount of dropped packets and increased latency when pinging my favorite destinations, like 8.8.8.8. ... (1 Reply)
Discussion started by: SandmanCL
1 Replies

2. UNIX for Advanced & Expert Users

linux stats per core

Does anyone know how to check linux stats per core? (1 Reply)
Discussion started by: cokedude
1 Replies

3. Linux

Stats on subdirectories

Please help me with a shell script to get the stats on many subdirectories (sub1), (sub2) etc under a mother directory (big) /big | |_______sub1 |_______sub2 |_______sub3 --------- I want to know 1. What is the last file accessed in each subdirectory with date and by whom 2.... (2 Replies)
Discussion started by: digipak
2 Replies

4. Shell Programming and Scripting

Using Stats in Php

So, I have a php program that i need to delete ALL files in a directory that are older than a certain age. <?php /* Get file stat */ $stat = stat('/apps/security/ajaba'); This is as far as I've been able to get. I know in shell programming you can easily do something like this. but I'm... (2 Replies)
Discussion started by: SkySmart
2 Replies

5. AIX

IO Stats

Aix 5.3 I am trying to view the IO stats. I do the sar 5 5 but that is the WIO and si different than the IO stats right? I am just blanking on this. I know there is a command that I used to run that brings up a whole bunch of live stats that run live such as mem and so on just can't rememeber... (4 Replies)
Discussion started by: rocker40
4 Replies

6. AIX

system stats

I recieved this out put below soemhow. Unfortunatly I did not write down the command I used to get it. Can someone tell me what command I use to gather these stats? OS = AIX 5.3 64Bit System Model: IBM,7026-6H1 Machine Serial Number:... (2 Replies)
Discussion started by: rocker40
2 Replies

7. UNIX for Advanced & Expert Users

I/O Stats Metrics

What do others use for measuring I/O statistics? I'd like something versatile, as in being able to watch (like iostat, but easier to trend), generate load (like iozone, but more realistic), and perform somewhat generalized benchmarks (like bonnie, but more current.) It would scale from a few... (0 Replies)
Discussion started by: LivinFree
0 Replies

8. UNIX for Dummies Questions & Answers

Display filename and wc stats

I'm just learning UNIX and I'm trying to do the following: Write a script called details.bash that, for each file in the working directory, prints the filename, the # of lines, and the # of words to to some output file, like this: filename1 73 431 filename2 5 21 It's probably a stupid... (1 Reply)
Discussion started by: asianmike
1 Replies
Login or Register to Ask a Question