1833920 Members
4446 Online
110063 Solutions
New Discussion

Re: Monitoring a process

 
Sanjiv Sharma_1
Honored Contributor

Monitoring a process

Hi,

Is there any utility( command, script or tool) which I can use to monitor a particular unix process in HP-UX 11.11?

What I want to do is to keep track of a particular process and wants to find out how often is it in run mode and how often it went to sleep.

Thanks,
Everything is possible
6 REPLIES 6
mirco_1
Valued Contributor

Re: Monitoring a process

hi,

tusc is free program to trace system call,
glance for the tuning
lsof for monitorin open file

DM.
Alex Lavrov.
Honored Contributor

Re: Monitoring a process

I think there is no such built-in function. But it's pretty easy script to write that will parse the "ps" output.

"man ps" you'll see the filed names and probably you'll have to set UNIX95 variable on.

Alex.
I don't give a damn for a man that can only spell a word one way. (M. Twain)
Muthukumar_5
Honored Contributor

Re: Monitoring a process

You can try with a script as,

#!/bin/ksh
# monitor.ksh
PID="9889"
STIME=120 # Sleep time in seconds
while [ 1 ]
do
ps -efl | grep $PID >> /tmp/monitor.log
sleep $STIME
done

# chmod u+x monitor.ksh
# ./monitor.ksh &
# tail -f /tmp/monitor.log

will give details.

hth.
Easy to suggest when don't know about the problem!
Cem Tugrul
Esteemed Contributor

Re: Monitoring a process

A fresh link,

http://forums1.itrc.hp.com/service/forums/questionanswer.do?threadId=954081

Good Luck,
Our greatest duty in this life is to help others. And please, if you can't
Enrico P.
Honored Contributor

Re: Monitoring a process

Hy,
you can try with Glance product and the extract command (see man extract) combination.
The metric ones that interests to you would have to be:

PROC_PROC_ID
PROC_RUN_TIME
PROC_SLEEP_WAIT_PCT

Enrico
Bill Hassell
Honored Contributor

Re: Monitoring a process

Actually, you can deduce the sleep versus run state by the starting time and the amount of CPU consumed. Programs can change states (there are many, many other states) dozens of times per second. Processes will not be running while waiting on I/O (a few milliseconds) or waiting on a semaphore flag, or waiting on a system call. The ps command can give you specifics about start time and CPU consumed, so subtract CPU consumed from total time running and the result is sleep or more accurately, wait time.


Bill Hassell, sysadmin