Homemade activity monitor-ish


 
Thread Tools Search this Thread
Top Forums Shell Programming and Scripting Homemade activity monitor-ish
# 1  
Old 09-03-2010
Homemade activity monitor-ish

Hello - I didn't find this with search, but I'm guessing it's out there somewhere. Apologies for reposting if that's the case.

I'm shell scripting on a 10.5.8 Mac.

I want to make a program that runs in the background and periodically logs computer use, storing things like - cpu usage, programs running, etc. I know I can get the pid of the most recently called process with $!, but is there a way to get the pid of any arbitrary process, or even to see all pids in use at one time? Do all processes have single, unique pids?

Is it possible to see the number of windows open at any one time?

Thanks.
# 2  
Old 09-03-2010
Yes, all processes have a single unique pid. The ps command might help you. Not sure if this is the same switches on Mac, but you can get for example process stati with:
Code:
ps aux

where the STAT column might be interessting for you. The values are explained in the man page for ps so you might grep for the ones you'd like to see.
Where you can see the number of open windows, I do not know. But maybe you can find them in some X log or also as processes or threads.

Last edited by zaxxon; 09-06-2010 at 05:53 AM.. Reason: typo
# 3  
Old 09-03-2010
Thanks so much. ps looks great.
Login or Register to Ask a Question

Previous Thread | Next Thread

8 More Discussions You Might Find Interesting

1. Infrastructure Monitoring

Searching for Saas Monitor service which monitor my servers which are sitting in different providers

Sorry if this is the wrong forum Searching for Saas Monitor service which monitor my servers which are sitting in different providers . This monitor tool will take as less CPU as possible , and will send info about the server to main Dashboard. The info I need is CPU / RAM / my servers status (... (1 Reply)
Discussion started by: umen
1 Replies

2. UNIX for Dummies Questions & Answers

Control-break"ish" in awk

Hi, input: 1|Bob 2|Bob Ref|Bob 3|Rick 7|Rick Ref|Rick I am trying to append a "*" field to the record containing "Ref" in $1, only if the previous $1 with a common $2 have a value <4. ouput: 1|Bob 2|Bob Ref|Bob|* 3|Rick 7|Rick Ref|Rick (11 Replies)
Discussion started by: beca123456
11 Replies

3. UNIX for Dummies Questions & Answers

how to monitor swap space paging activity?

hi guys My tivoli monitoring tools is reporting the monitor parameters says Pages Paged out is too high 1600 so it is a critical warning (threshold 400) now according to them this usually happens at dawn so is there a way to monitor this? during the time I am not working? ans something... (1 Reply)
Discussion started by: karlochacon
1 Replies

4. UNIX for Dummies Questions & Answers

Commands to monitor other user's activity

What commands would you recommend in order to monitor things like when a user logs on to a server, assuming you know that user's name on the server? (2 Replies)
Discussion started by: Sotau
2 Replies

5. Shell Programming and Scripting

How to monitor system activity while executing tests

I need to monitor system activity (RAM, CPU usage, execution time) while running some tests on solaris, linux and aix and save the output. Please advise whether there's a utility available for these systems? How can time the execution of the command? Thanks! (2 Replies)
Discussion started by: smovla
2 Replies

6. Shell Programming and Scripting

Homemade echo command

Hi everyone, this is probably very simple, but i haven't found anything in the forum, or maybe im just taking the wrong aproach... I made a script to check a bunch of stuff, this script currently outputs it's findings to the screen, i need to log that output too, i was thinking to just make a... (2 Replies)
Discussion started by: sx3v1l_1n51de
2 Replies

7. UNIX for Dummies Questions & Answers

Tool to monitor user activity

Hello, Does any one knows any tools or method to monitor users all activities on Solaris 8, including command and its result. Similar to 'script' ??? Thanks nana (3 Replies)
Discussion started by: nana
3 Replies

8. Programming

Unix/Linux Newbie(ish) Question - IPC/Signals

:) Hello, i have been given the following code to help me learn how to use signals, it won't compile. The problem maybe because this was written for use in Unix and i am trying to compile in Linux. The error i get says that SIGPIPE and SIG_IGN are undeclared. I think that these are defined... (2 Replies)
Discussion started by: theultimatechuf
2 Replies
Login or Register to Ask a Question