Operating System - HP-UX
1827872 Members
1196 Online
109969 Solutions
New Discussion

How to monitor a UNIX process?

 
SOLVED
Go to solution
Enrico Venturi
Super Advisor

How to monitor a UNIX process?

Hello colleagues,
I should monitor the PERL interpreter on my platform, in order to gather data on its usage: who call it, how many times it's called, ....
Is there any utility to do it?
something like "monitor process_image log_file"
thanks
Enrico
7 REPLIES 7
Pete Randall
Outstanding Contributor

Re: How to monitor a UNIX process?

Hi Enrico,

Do you have Glance? You can set up filters to select just the processes you're interested in. Or you can set up MeasureWare to run reports for you.


Pete

Pete
Enrico Venturi
Super Advisor

Re: How to monitor a UNIX process?

No, I haven't such tools.... :-(
Peter Godron
Honored Contributor

Re: How to monitor a UNIX process?

Enrico,
on the simplest level you could use

ps -ef | grep -i perl | grep -v grep
on a script basis

or a the most complex something like:
http://ovweb.external.hp.com/ovnsmdps/pdf/os_spi_admin.pdf

Glance would be probably be the best suited, but has to be installed.
Regards
B. Hulst
Trusted Contributor

Re: How to monitor a UNIX process?

Hi,

Or put a wrapper around the perl binary.

1. Basically rename the perl binary.
mv /usr/bin/perl /usr/bin/perl_
2. Create a script called perl in the same dir as the perl binary

!#/bin/sh
echo `who am i` >> /var/tmp/perlusage.log
/usr/bin/perl $*


3. and make it executable with
chmod a+x perl
4. Create the initial logfile
touch /var/tmp/perlusage.log
5. and make sure the log file does not fill up your /var/tmp....

Regards,
Bob
harry d brown jr
Honored Contributor
Solution

Re: How to monitor a UNIX process?

Then you need to purchase it if you want to monitor at that level.

get and evaluation copy from: http://managementsoftware.hp.com/products/ovperf/tc_ovperf_0001.html


live free or die
harry d brown jr
Live Free or Die
Florian Heigl (new acc)
Honored Contributor

Re: How to monitor a UNIX process?

I'd try to do a simple thing like putting a wrapper or a global alias around the perl binary.
The drawback is that this is kind of a hack which needs to be documented, but I think using an alias is less intrusive.

i.e. like in the following example - which is BAD[1] and does it wrong [2] :)

mv /usr/bin/perl /usr/bin/perl.bin
echo "time /usr/bin/perl $@ | tee -a /tmp/perl.log" > /usr/bin/perl

[1]
The output is messy as Your log contains the script output which YOU don't need, and Your users get to read the cpu-time info THEY don't need.
[2]
errr - YOU get script output, but not the cpu times and THEY get both.

But this means that the time command uses a different way of outputting it's information and if You find out how it's doing that, You can catch only the time output.

Maybe You can make something out it.

The regular way would be using some way of cpu-time accounting like on mainframes or compute clusters, but I've never seen such how such a thing is set up, even less on hp-ux.

Anybody?
yesterday I stood at the edge. Today I'm one step ahead.
Florian Heigl (new acc)
Honored Contributor

Re: How to monitor a UNIX process?

Awww, I can't read today.

If You only need to see who's calling it, go with a wrapper and trace the PPID's process name and terminal, this should be enough data.

yesterday I stood at the edge. Today I'm one step ahead.