RE: Timing several processes

2003-12-04 Thread Akens, Anthony
AIX 5.1, actually.  Though eventually linux, windows,
and possibly other OS's will be in the mix.

I'm writing this with the idea of it being very "modular"
in that each server will do it's own "check" ever 15
minutes or so, and that the webserver will only "connect"
and grab that data when someone goes to the page (using
a cgi to parse it up and display it in a heirarchical
fashion).  The server will access the data via NFS (the
NFS exports are already in place due to another project)

Writing to a file gives me a history of data should any
individual box go down.  (Especially the "webserver" in
this case, since it is periodically taken offline during
the course of any given week due to its role in the
overall project these machines run)

I also plan on the actual programs that are called to be
set up in a config file.  Something along the lines of:

APP1_HANDLE = "sar"
APP1_EXEC = "sar 5 5"
APP1_LOG = "/log/monitor/delta/sar.out"
APP1_PARSE = "/log/monitor/parse_sar.pl"
APP1_SUMMARY = "/log/monitor/delta/sar.summary"

I'm planning on figuring out how to put all of those into
a hash, and then using a foreach loop to exec each one, and
another foreach loop to wait for each to complete, and a
final foreach loop that runs the "parse" for each one and
generates a summary.  The summary files will all be in a
"standard" format that the webserver will use to genrate
its display.

I had not thought of stderr from the commands, so
you're right that catching it is something I need to
think on.

The other bit I'm working on is to make an "options"
file for each server (generated before the summaries
are parsed) that contains info like number of processors,
and tuning options (set with schedtune and vmtune, etc)
that can be used by the "APP_PARSE" scripts in calculating 
results.  (Thrashing detection, etc).

I know, it's all a little complex, but the individual
pieces are fairly simple in design.  And in the end it
will meet the goal that management put forth, which is
what keeps me paid :)

-Tony

-Original Message-
From: drieux [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 03, 2003 7:24 PM
To: Perl Perl
Subject: Re: Timing several processes



On Dec 3, 2003, at 10:49 AM, Akens, Anthony wrote:
[..]
> print "Running vmstat\n";
> defined(my $vmstat_pid = fork) or die "Cannot fork: $!"; unless 
> ($vmstat_pid) {
>   exec "vmstat 5 5 > /log/monitor/delta/vmstat.out";
>   die "cannot exec vmstat: $!";
> }
> print "Running sar\n";
> defined(my $sar_pid = fork) or die "Cannot fork: $!";
> unless ($sar_pid) {
>   exec "sar 5 5 > /log/monitor/delta/sar.out";
>   die "cannot exec date: $!";
> }
> print "Waiting...\n";
> waitpid($vmstat_pid, 0);
> waitpid($sar_pid, 0);
> print "done!\n";
[..]

I presume you are working on a solaris box?
have you thought about

timex sar 5 5
timex vmstat 5 5

and you will notice that the sar command will
take about 25 seconds and the vmstat about 20.

but then there is that minor nit about

exec "vmstat 5 5 > /log/monitor/delta/vmstat.out"
or  die "cannot exec vmstat: $!";

since in theory exec WILL not return, so if it failed
why not keep it in the proper context...

Then there is that Minor Nit about not controlling 'stderr' which can
lead to things like:

vladimir: 60:] ./st*.plx
Running vmstat
Running sar
sh: /log/monitor/delta/vmstat.out: cannot create
sh: /log/monitor/delta/sar.out: cannot create
Waiting...
done!
vladimir: 61:]

So while you are in the process of learning
fork() and exec() why not think a bit more
agressively and go with say a pipe to pass
back the information so as not to buy
the IO overhead of writing to files?

While the following was written for a command
line 'let us get interactive' type of solution,
it might be a framework you could rip off
and use:

<http://www.wetware.com/drieux/pbl/Sys/gen_sym_big_dog.txt>



ciao
drieux

---


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Timing several processes

2003-12-03 Thread drieux
On Dec 3, 2003, at 5:01 PM, Wiggins d'Anconia wrote:
[..]
it might be a framework you could rip off
and use:

Have we come back to POE?  POE.

;-)
who knows, after a bit of work the OP may decide that
the 400m of downloadable free software framework from
source forge will help him over more things than he
would want to Shake a Stick At.
But first things first, show them some chunky code
that they can futz around with. Keep pointing them
back into the other stuff, and raising flags as to
why that might be simpler...
There are always going to be trade offs, as you noticed
over on the cgi-beginner's with whether the 'thunking'
of Autoloadables et al is worth the time it takes, or
should one just buy all of that overhead in one bang
at start up and  and and...
So FribNark, I Tried to invoke

	&POE::Pipe::_stop_blocking($my_back_side);

but I am still constipated

what did I do wrong?

8-)

ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Timing several processes

2003-12-03 Thread Wiggins d'Anconia
drieux wrote:


So while you are in the process of learning
fork() and exec() why not think a bit more
agressively and go with say a pipe to pass
back the information so as not to buy
the IO overhead of writing to files?
While the following was written for a command
line 'let us get interactive' type of solution,
it might be a framework you could rip off
and use:


Have we come back to POE?  POE.

;-)

http://danconia.org

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


Re: Timing several processes

2003-12-03 Thread drieux
On Dec 3, 2003, at 10:49 AM, Akens, Anthony wrote:
[..]
print "Running vmstat\n";
defined(my $vmstat_pid = fork) or die "Cannot fork: $!";
unless ($vmstat_pid) {
  exec "vmstat 5 5 > /log/monitor/delta/vmstat.out";
  die "cannot exec vmstat: $!";
}
print "Running sar\n";
defined(my $sar_pid = fork) or die "Cannot fork: $!";
unless ($sar_pid) {
  exec "sar 5 5 > /log/monitor/delta/sar.out";
  die "cannot exec date: $!";
}
print "Waiting...\n";
waitpid($vmstat_pid, 0);
waitpid($sar_pid, 0);
print "done!\n";
[..]

I presume you are working on a solaris box?
have you thought about
timex sar 5 5
timex vmstat 5 5
and you will notice that the sar command will
take about 25 seconds and the vmstat about 20.
but then there is that minor nit about

exec "vmstat 5 5 > /log/monitor/delta/vmstat.out"
or  die "cannot exec vmstat: $!";
since in theory exec WILL not return, so if it failed
why not keep it in the proper context...
Then there is that Minor Nit about not controlling 'stderr'
which can lead to things like:
vladimir: 60:] ./st*.plx
Running vmstat
Running sar
sh: /log/monitor/delta/vmstat.out: cannot create
sh: /log/monitor/delta/sar.out: cannot create
Waiting...
done!
vladimir: 61:]
So while you are in the process of learning
fork() and exec() why not think a bit more
agressively and go with say a pipe to pass
back the information so as not to buy
the IO overhead of writing to files?
While the following was written for a command
line 'let us get interactive' type of solution,
it might be a framework you could rip off
and use:




ciao
drieux
---

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


RE: Timing several processes

2003-12-03 Thread Akens, Anthony
It seems as if my example was doing what it was intended to do, the
"problem" was in the exec for sar...

It seems that using redirection with the sar command is a little
different then I expected... it does not write anything to the
output file until it is finished.

As for the "Waiting..." line not showing up, when I had done my
testing I had left out the /n  - which caused it not to print until
later.  Once I added the /n (as you see in the code below) it printed
when I expected it to.

Thanks for the help...

-Tony

-Original Message-
From: Akens, Anthony 
Sent: Wednesday, December 03, 2003 1:50 PM
To: Wiggins d Anconia; Tom Kinzer; [EMAIL PROTECTED]
Subject: RE: Timing several processes


Here's the sample code I'm trying...  In essence I would expect to see
The following output:

Running vmstat
Running sar
Waiting...  (at this point a long wait while sar and vmstat finish)
Done!


Instead I am seeing:
Running vmstat
Running sar  (The long wait is here)
Waiting...
Done!


In watching the file sizes, I can see both files are created at the Same
time, but sar does not produce any output in its file until Vmstat
finishes.

-Tony

#!/usr/bin/perl -w

use strict;

print "Running vmstat\n";
defined(my $vmstat_pid = fork) or die "Cannot fork: $!";
unless ($vmstat_pid) {
  exec "vmstat 5 5 > /log/monitor/delta/vmstat.out";
  die "cannot exec vmstat: $!";
}
print "Running sar\n";
defined(my $sar_pid = fork) or die "Cannot fork: $!";
unless ($sar_pid) {
  exec "sar 5 5 > /log/monitor/delta/sar.out";
  die "cannot exec date: $!";
}
print "Waiting...\n";
waitpid($vmstat_pid, 0);
waitpid($sar_pid, 0);
print "done!\n";

-Original Message-
From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 03, 2003 1:31 PM
To: Akens, Anthony; Tom Kinzer; [EMAIL PROTECTED]
Subject: RE: Timing several processes


I was going to suggest POE as well, 'til I saw that little word 'simple'
:-)...

Have you read:

perldoc perlipc
perldoc -f fork
perldoc -f wait
perldoc -f waitpid

Of course POE is what makes keeping track of all those spun off
processes trivial, but learning it is I will admit not trivial...

http://danconia.org

> I already have some ideas for how I want to build the page, how to 
> parse the data I will generate, etc.
> 
> As I said, I've looked at some of the other tools out there, and want 
> to stick to some simple perl code to parse out the information and 
> return the results.
> 
> The only bit I'm not sure of is how to tell if all forked processes 
> have completed before moving on.
> 
> 
> -Tony
> 
> -Original Message-
> From: Tom Kinzer [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 03, 2003 12:35 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Timing several processes
> 
> 
>  http://poe.perl.org
> 
> Maybe this would be a good job for POE?
> 
> -Tom Kinzer
> 
> 
> -Original Message-
> From: Akens, Anthony [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 03, 2003 7:49 AM
> To: [EMAIL PROTECTED]
> Subject: Timing several processes
> 
> 
> Hi all!
> 
> I'm wanting to write a simple web-based tool to see the status of
> several servers at a glance.  I know there are many solutions 
> existing, but I can't learn as much about perl by just using one of 
> those as I can by writing my own.  The first step I want to do is call

> a script from cron that runs several basic monitoring tools (sar,
> vmstat, df, iostat, etc) and saves the output of each to a file. Then 
> I'd parse those files up, and write a summary file.
> 
> Easy enough.  And I could certainly do it with by calling the tools
> one at a time.  However, I'd like to get roughly 1 minute of vmstat, 
> iostat, and sar output Simultaneously.  So I'm supposing I'd want 
> to fork off each process, and then when those are all done come back 
> and run a script that then parses those results out for the individual

> statistics I'm looking for.
> 
> I've never used fork before, and while it looks fairly straight
> forward what I am not sure of is how to make sure all of those forked 
> processes have completed before moving on and parsing the files.
> 
> Any pointers?
> 
> Thanks in advance
> 
> -Tony
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Timing several processes

2003-12-03 Thread Akens, Anthony
Here's the sample code I'm trying...  In essence I would expect to see
The following output:

Running vmstat
Running sar
Waiting...  (at this point a long wait while sar and vmstat finish)
Done!


Instead I am seeing:
Running vmstat
Running sar  (The long wait is here)
Waiting...
Done!


In watching the file sizes, I can see both files are created at the
Same time, but sar does not produce any output in its file until
Vmstat finishes.

-Tony

#!/usr/bin/perl -w

use strict;

print "Running vmstat\n";
defined(my $vmstat_pid = fork) or die "Cannot fork: $!";
unless ($vmstat_pid) {
  exec "vmstat 5 5 > /log/monitor/delta/vmstat.out";
  die "cannot exec vmstat: $!";
}
print "Running sar\n";
defined(my $sar_pid = fork) or die "Cannot fork: $!";
unless ($sar_pid) {
  exec "sar 5 5 > /log/monitor/delta/sar.out";
  die "cannot exec date: $!";
}
print "Waiting...\n";
waitpid($vmstat_pid, 0);
waitpid($sar_pid, 0);
print "done!\n";

-Original Message-
From: Wiggins d Anconia [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 03, 2003 1:31 PM
To: Akens, Anthony; Tom Kinzer; [EMAIL PROTECTED]
Subject: RE: Timing several processes


I was going to suggest POE as well, 'til I saw that little word 'simple'
:-)...

Have you read:

perldoc perlipc
perldoc -f fork
perldoc -f wait
perldoc -f waitpid

Of course POE is what makes keeping track of all those spun off
processes trivial, but learning it is I will admit not trivial...

http://danconia.org

> I already have some ideas for how I want to build the page, how
> to parse the data I will generate, etc.
> 
> As I said, I've looked at some of the other tools out there,
> and want to stick to some simple perl code to parse out the 
> information and return the results.
> 
> The only bit I'm not sure of is how to tell if all forked processes
> have completed before moving on.
> 
> 
> -Tony
> 
> -Original Message-
> From: Tom Kinzer [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 03, 2003 12:35 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Timing several processes
> 
> 
>  http://poe.perl.org
> 
> Maybe this would be a good job for POE?
> 
> -Tom Kinzer
> 
> 
> -Original Message-
> From: Akens, Anthony [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 03, 2003 7:49 AM
> To: [EMAIL PROTECTED]
> Subject: Timing several processes
> 
> 
> Hi all!
> 
> I'm wanting to write a simple web-based tool to see the status of 
> several servers at a glance.  I know there are many solutions 
> existing, but I can't learn as much about perl by just using one of 
> those as I can by writing my own.  The first step I want to do is call

> a script from cron that runs several basic monitoring tools (sar, 
> vmstat, df, iostat, etc) and saves the output of each to a file. Then 
> I'd parse those files up, and write a summary file.
> 
> Easy enough.  And I could certainly do it with by calling the tools 
> one at a time.  However, I'd like to get roughly 1 minute of vmstat, 
> iostat, and sar output Simultaneously.  So I'm supposing I'd want 
> to fork off each process, and then when those are all done come back 
> and run a script that then parses those results out for the individual

> statistics I'm looking for.
> 
> I've never used fork before, and while it looks fairly straight 
> forward what I am not sure of is how to make sure all of those forked 
> processes have completed before moving on and parsing the files.
> 
> Any pointers?
> 
> Thanks in advance
> 
> -Tony
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Timing several processes

2003-12-03 Thread Wiggins d Anconia
I was going to suggest POE as well, 'til I saw that little word 'simple'
:-)...

Have you read:

perldoc perlipc
perldoc -f fork
perldoc -f wait
perldoc -f waitpid

Of course POE is what makes keeping track of all those spun off
processes trivial, but learning it is I will admit not trivial...

http://danconia.org

> I already have some ideas for how I want to build the page, how 
> to parse the data I will generate, etc.
> 
> As I said, I've looked at some of the other tools out there, 
> and want to stick to some simple perl code to parse out the 
> information and return the results.
> 
> The only bit I'm not sure of is how to tell if all forked processes 
> have completed before moving on.
> 
> 
> -Tony
> 
> -Original Message-
> From: Tom Kinzer [mailto:[EMAIL PROTECTED] 
> Sent: Wednesday, December 03, 2003 12:35 PM
> To: [EMAIL PROTECTED]
> Subject: RE: Timing several processes
> 
> 
>  http://poe.perl.org 
> 
> Maybe this would be a good job for POE?
> 
> -Tom Kinzer
> 
> 
> -Original Message-
> From: Akens, Anthony [mailto:[EMAIL PROTECTED]
> Sent: Wednesday, December 03, 2003 7:49 AM
> To: [EMAIL PROTECTED]
> Subject: Timing several processes
> 
> 
> Hi all!
> 
> I'm wanting to write a simple web-based tool to see the status of
> several servers at a glance.  I know there are many solutions existing,
> but I can't learn as much about perl by just using one 
> of those as I can by writing my own.  The first step I want to do 
> is call a script from cron that runs several basic monitoring tools 
> (sar, vmstat, df, iostat, etc) and saves the output of each to a 
> file. Then I'd parse those files up, and write a summary file.
> 
> Easy enough.  And I could certainly do it with by calling the tools one
> at a time.  However, I'd like to get roughly 1 minute of vmstat, 
> iostat, and sar output Simultaneously.  So I'm supposing I'd 
> want to fork off each process, and then when those are all done 
> come back and run a script that then parses those results out for 
> the individual statistics I'm looking for.
> 
> I've never used fork before, and while it looks fairly straight forward
> what I am not sure of is how to make sure all of those forked 
> processes have completed before moving on and parsing the files.
> 
> Any pointers?
> 
> Thanks in advance
> 
> -Tony
> 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Timing several processes

2003-12-03 Thread Tom Kinzer
Correct.  You could spawn 5 and then do 5 waits.  Assuming you want to do
nothing until all 5 finish.

But:  Do you actually want to do a timer for those 5 processes, run for a
certain amount of time and then have them stop??  Then check to make sure
all 5 are done, then do some other stuff (reporting)??

The code below spawns a process but instead of waiting like it would for a
system call, it says I'm gonna keep on trucking -- course it doesn't do
anything except go straight to a wait in this example, but in theory, the
"main" could be doing other stuff at the same time.

Of course, all this has very little to do with terminating a child at a
certain time...

-Tom Kinzer


-Original Message-
From: Akens, Anthony [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 10:07 AM
To: Akens, Anthony; Tom Kinzer; [EMAIL PROTECTED]
Subject: RE: Timing several processes


To clarify, I found the following in "Learning Perl".

It doesn't quite make sense to me, though.  Perhaps someone
Can clarify what's going on in this?

defined(my $pid = fork) or die "Cannot fork: $!";
unless ($pid) {
  # Child process is here
  exec "date";
  die "cannot exec date: $!";
}
# Parent process is here
waitpid($pid, 0);


It seems I could use that code, modified to start (5) processes,
And a waitpid() for each of those (5).  It doesn't matter
Which processes would finish first.  (I put the 5 in quotes,
Because right now I'm looking at using 5 different tools that
I want to monitor).

-Tony



-Original Message-
From: Akens, Anthony
Sent: Wednesday, December 03, 2003 12:58 PM
To: Tom Kinzer; [EMAIL PROTECTED]
Subject: RE: Timing several processes


I already have some ideas for how I want to build the page, how
to parse the data I will generate, etc.

As I said, I've looked at some of the other tools out there,
and want to stick to some simple perl code to parse out the
information and return the results.

The only bit I'm not sure of is how to tell if all forked processes
have completed before moving on.


-Tony

-Original Message-
From: Tom Kinzer [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 12:35 PM
To: [EMAIL PROTECTED]
Subject: RE: Timing several processes


 http://poe.perl.org

Maybe this would be a good job for POE?

-Tom Kinzer


-Original Message-
From: Akens, Anthony [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 7:49 AM
To: [EMAIL PROTECTED]
Subject: Timing several processes


Hi all!

I'm wanting to write a simple web-based tool to see the status of
several servers at a glance.  I know there are many solutions existing,
but I can't learn as much about perl by just using one
of those as I can by writing my own.  The first step I want to do
is call a script from cron that runs several basic monitoring tools
(sar, vmstat, df, iostat, etc) and saves the output of each to a
file. Then I'd parse those files up, and write a summary file.

Easy enough.  And I could certainly do it with by calling the tools one
at a time.  However, I'd like to get roughly 1 minute of vmstat,
iostat, and sar output Simultaneously.  So I'm supposing I'd
want to fork off each process, and then when those are all done
come back and run a script that then parses those results out for
the individual statistics I'm looking for.

I've never used fork before, and while it looks fairly straight forward
what I am not sure of is how to make sure all of those forked
processes have completed before moving on and parsing the files.

Any pointers?

Thanks in advance

-Tony

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Timing several processes

2003-12-03 Thread Tom Kinzer
Right.  POE may be a good tool for handling those children processes.
(Instead of forking at all.)

 -Tom Kinzer

-Original Message-
From: Akens, Anthony [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 9:58 AM
To: Tom Kinzer; [EMAIL PROTECTED]
Subject: RE: Timing several processes


I already have some ideas for how I want to build the page, how
to parse the data I will generate, etc.

As I said, I've looked at some of the other tools out there,
and want to stick to some simple perl code to parse out the
information and return the results.

The only bit I'm not sure of is how to tell if all forked processes
have completed before moving on.


-Tony

-Original Message-
From: Tom Kinzer [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 12:35 PM
To: [EMAIL PROTECTED]
Subject: RE: Timing several processes


 http://poe.perl.org

Maybe this would be a good job for POE?

-Tom Kinzer


-Original Message-
From: Akens, Anthony [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 7:49 AM
To: [EMAIL PROTECTED]
Subject: Timing several processes


Hi all!

I'm wanting to write a simple web-based tool to see the status of
several servers at a glance.  I know there are many solutions existing,
but I can't learn as much about perl by just using one
of those as I can by writing my own.  The first step I want to do
is call a script from cron that runs several basic monitoring tools
(sar, vmstat, df, iostat, etc) and saves the output of each to a
file. Then I'd parse those files up, and write a summary file.

Easy enough.  And I could certainly do it with by calling the tools one
at a time.  However, I'd like to get roughly 1 minute of vmstat,
iostat, and sar output Simultaneously.  So I'm supposing I'd
want to fork off each process, and then when those are all done
come back and run a script that then parses those results out for
the individual statistics I'm looking for.

I've never used fork before, and while it looks fairly straight forward
what I am not sure of is how to make sure all of those forked
processes have completed before moving on and parsing the files.

Any pointers?

Thanks in advance

-Tony

--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Timing several processes

2003-12-03 Thread Akens, Anthony
To clarify, I found the following in "Learning Perl".

It doesn't quite make sense to me, though.  Perhaps someone
Can clarify what's going on in this?

defined(my $pid = fork) or die "Cannot fork: $!";
unless ($pid) {
  # Child process is here
  exec "date";
  die "cannot exec date: $!";
}
# Parent process is here
waitpid($pid, 0);


It seems I could use that code, modified to start (5) processes,
And a waitpid() for each of those (5).  It doesn't matter
Which processes would finish first.  (I put the 5 in quotes,
Because right now I'm looking at using 5 different tools that
I want to monitor).

-Tony



-Original Message-
From: Akens, Anthony 
Sent: Wednesday, December 03, 2003 12:58 PM
To: Tom Kinzer; [EMAIL PROTECTED]
Subject: RE: Timing several processes


I already have some ideas for how I want to build the page, how 
to parse the data I will generate, etc.

As I said, I've looked at some of the other tools out there, 
and want to stick to some simple perl code to parse out the 
information and return the results.

The only bit I'm not sure of is how to tell if all forked processes 
have completed before moving on.


-Tony

-Original Message-
From: Tom Kinzer [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 03, 2003 12:35 PM
To: [EMAIL PROTECTED]
Subject: RE: Timing several processes


 http://poe.perl.org 

Maybe this would be a good job for POE?

-Tom Kinzer


-Original Message-
From: Akens, Anthony [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 7:49 AM
To: [EMAIL PROTECTED]
Subject: Timing several processes


Hi all!

I'm wanting to write a simple web-based tool to see the status of
several servers at a glance.  I know there are many solutions existing,
but I can't learn as much about perl by just using one 
of those as I can by writing my own.  The first step I want to do 
is call a script from cron that runs several basic monitoring tools 
(sar, vmstat, df, iostat, etc) and saves the output of each to a 
file. Then I'd parse those files up, and write a summary file.

Easy enough.  And I could certainly do it with by calling the tools one
at a time.  However, I'd like to get roughly 1 minute of vmstat, 
iostat, and sar output Simultaneously.  So I'm supposing I'd 
want to fork off each process, and then when those are all done 
come back and run a script that then parses those results out for 
the individual statistics I'm looking for.

I've never used fork before, and while it looks fairly straight forward
what I am not sure of is how to make sure all of those forked 
processes have completed before moving on and parsing the files.

Any pointers?

Thanks in advance

-Tony

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Timing several processes

2003-12-03 Thread Akens, Anthony
I already have some ideas for how I want to build the page, how 
to parse the data I will generate, etc.

As I said, I've looked at some of the other tools out there, 
and want to stick to some simple perl code to parse out the 
information and return the results.

The only bit I'm not sure of is how to tell if all forked processes 
have completed before moving on.


-Tony

-Original Message-
From: Tom Kinzer [mailto:[EMAIL PROTECTED] 
Sent: Wednesday, December 03, 2003 12:35 PM
To: [EMAIL PROTECTED]
Subject: RE: Timing several processes


 http://poe.perl.org 

Maybe this would be a good job for POE?

-Tom Kinzer


-Original Message-
From: Akens, Anthony [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 7:49 AM
To: [EMAIL PROTECTED]
Subject: Timing several processes


Hi all!

I'm wanting to write a simple web-based tool to see the status of
several servers at a glance.  I know there are many solutions existing,
but I can't learn as much about perl by just using one 
of those as I can by writing my own.  The first step I want to do 
is call a script from cron that runs several basic monitoring tools 
(sar, vmstat, df, iostat, etc) and saves the output of each to a 
file. Then I'd parse those files up, and write a summary file.

Easy enough.  And I could certainly do it with by calling the tools one
at a time.  However, I'd like to get roughly 1 minute of vmstat, 
iostat, and sar output Simultaneously.  So I'm supposing I'd 
want to fork off each process, and then when those are all done 
come back and run a script that then parses those results out for 
the individual statistics I'm looking for.

I've never used fork before, and while it looks fairly straight forward
what I am not sure of is how to make sure all of those forked 
processes have completed before moving on and parsing the files.

Any pointers?

Thanks in advance

-Tony

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


--
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



RE: Timing several processes

2003-12-03 Thread Tom Kinzer
 http://poe.perl.org 

Maybe this would be a good job for POE?

-Tom Kinzer


-Original Message-
From: Akens, Anthony [mailto:[EMAIL PROTECTED]
Sent: Wednesday, December 03, 2003 7:49 AM
To: [EMAIL PROTECTED]
Subject: Timing several processes


Hi all!

I'm wanting to write a simple web-based tool to see the status
of several servers at a glance.  I know there are many solutions
existing, but I can't learn as much about perl by just using one 
of those as I can by writing my own.  The first step I want to do 
is call a script from cron that runs several basic monitoring tools 
(sar, vmstat, df, iostat, etc) and saves the output of each to a 
file. Then I'd parse those files up, and write a summary file.

Easy enough.  And I could certainly do it with by calling the tools
one at a time.  However, I'd like to get roughly 1 minute of vmstat, 
iostat, and sar output Simultaneously.  So I'm supposing I'd 
want to fork off each process, and then when those are all done 
come back and run a script that then parses those results out for 
the individual statistics I'm looking for.

I've never used fork before, and while it looks fairly straight
forward what I am not sure of is how to make sure all of those forked 
processes have completed before moving on and parsing the files.

Any pointers?

Thanks in advance

-Tony

-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]



Re: Timing several processes

2003-12-03 Thread Casey West
It was Wednesday, December 03, 2003 when Akens, Anthony took the soap box, saying:
: Hi all!
: 
: I'm wanting to write a simple web-based tool to see the status
: of several servers at a glance.  I know there are many solutions
: existing, but I can't learn as much about perl by just using one 
: of those as I can by writing my own.  The first step I want to do 
: is call a script from cron that runs several basic monitoring tools 
: (sar, vmstat, df, iostat, etc) and saves the output of each to a 
: file. Then I'd parse those files up, and write a summary file.

You may be able to save yourself a load of time by using some
already-written tools such as Nagios or mon.

  http://www.nagios.org/
  http://www.kernel.org/software/mon/

  Casey West

-- 
Shooting yourself in the foot with APL 
You shoot yourself in the foot; then spend all day figuring out how to
do it in fewer characters. 


-- 
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]