[Date Prev]   [Date Next] [Thread Prev]   [Thread Next] [Date Index]   [Thread Index]

 

     Re: [snips-users] Glitch in hostmon-client.solaris2

On Thu, May 08, 2003 at 06:36:58PM -0400, Tuc wrote:
> Hi,
> 
> 	Having an issue with hostmon-client.solaris2 on the old Nocol...
> 
> 	We are getting a vmstat -S of :
> 
>  0 0 0 5408072 1178056 0  0  0  0  0  0  0  0  0  0  0  418 1609   38 100 0  0
> 
> 
> 	Which when it hits :
> 
>     # if any CPU time is 100, vmstat doesnt have any spaces in it.
>     s/100(\s+\d+){0,2}\s*$/ 100\1/;
> 
> 
> 	Becomes :
> 
>  0 0 0 5408072 1178056 0  0  0  0  0  0  0  0  0  0  0  418 1609   38  100  0

Hmmm... that piece of Perl appears to be based on a b0rked vmstat or
some such.  There should probably be a piece of logic in there to count
the number of fields returned and try to reconcile the numbers if and
only if there are less than 22 fields.

> 	and then fails 
> 
>     if (/^\s*(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d
> +)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d+)\s+(\d
> +)\s+(\d+)\s+(\d+)\s+(\d+)\s*$/)
> 
> 	Is there a reason that the "s/100(\s+\d+){0,2}\s*$/ 100\1/;", despite
> what it claims? And why is it cutting out one of the "0"'s?

Well, if I read that right, it's looking for "100" followed by zero to
two additional columns before the EOL.  It's basically matching the 100
and putting an additional space in front of it (when it doesn't actually
need it in this incident).  The other piece of being that the "counter"
is outside the match... my guess is that this should probably actually
be re-written as:

       s/100((\s+\d+){0,2})\s*$/ 100\1/;

...but, I haven't tested it in the condition that it's actually designed
to catch (ie. the lack of the space before "100").

Hope that helps...
Russell


-- 
Russell M. Van Tassell
russell at loosenut com

 "I see you've had no computer training. Although that qualifies you for
  upper management, it means you're under-qualified for our entry level
  positions."

Zyrion Traverse Network Monitoring & Network Management Software