Summary: help w/ vmstat and perl

From: pat eyler (p_eyler@hotmail.com)
Date: Mon Dec 13 1999 - 15:29:48 CST


DOH!
I got the answer almost immediately (and can't believe I didn't see it
myself.

-pate

[the following answer is from Mark Neill]
>
>chomp() operates directly on the string. The return value from it is the
>number of characters removed. Just chomp $string, don't assign anything
>from the chomp....see the change below...
>
>
>-----Original Message-----
>From: pat eyler [mailto:p_eyler@hotmail.com]
>Sent: Monday, December 13, 1999 4:04 PM
>To: sun-managers@sunmanagers.ececs.uc.edu
>Subject: help w/ vmstat and perl
>
>
>on a solaris 2.6 box, I'm trying to do (trimmed to show just the odd
>behavior)
>
>open(PROC, "vmstat 3 3|");
>while (<PROC>) {
> unless ($_ =~ /procs/) {
> unless ($_ =~ /swap/ {
> chomp $line; <----change here
> push(@errors, $line);
> }
> }
>}
>
>The problem is that the PROC filehandle closes immediately.
>The first line contains 'procs' and is ignored (correctly).
>The second line contains 'swap' and is ignored (correctly).
>The final three lines do not contain the expected data, instead each holds
>the value '1'.
>
>Using sar in a similar way behaves as follows:
>The PROC filehandle stays open for about 9 seconds.
>Every line contains the expected data.
>
>I need to use both sar and vmstat in this script, so I'm looking for help
>in
>
>understanding why vmstat is not behaving the way I expect it should. (And
>since the problem is probably in my expectation, a better idea of how I
>might get the output of vmstat.)
>
>-pate
>
>______________________________________________________
>Get Your Private, Free Email at http://www.hotmail.com

______________________________________________________
Get Your Private, Free Email at http://www.hotmail.com



This archive was generated by hypermail 2.1.2 : Fri Sep 28 2001 - 23:13:34 CDT