SUMMARY #2 : Solaris CPU load from Perl

From: alex dyas <adyas_at_twowaytv.co.uk>
Date: Wed Jun 19 2002 - 04:42:36 EDT
Update. Thanks to those who followed up.

alex dyas wrote:
> Original question:
> 
>  > I'd like to be able to determine the CPU's busy/idle states through
>  > Perl, much like the readout of top.  A few attempts have so far proven
>  > fruitless:
>  >
>  > - vmstat - this is fine on machines that haven't been up for long, but
>  > there is a problem after a few months that causes negative numbers to
>  > appear for some of the values.  i can't rely on this. (
>  > http://www.sunmanagers.org/archives/2000/1277.html )
>  >
>  > - Solaris:: packages. The script needs to be portable so I don't want
>  > to have to install packages everywhere.
> 
> Thanks to all those who replied.  Suggestions were:
> 
> - Kstat Perl module 
> (http://search.cpan.org/search?module=Solaris::Kstat).  Although I think 
> this would be the best solution in most ways, I was put off by the 
> trouble I had building it.  I need something portable and easy to 
> install. (Kevin Buterbaugh suggested that building it with the same 
> compiler I built Perl with would probably help).

Kstat is installed by default with Solaris 8 and 9.  See /usr/bin/kstat 
and man kstat.

> - sar. this would be good but doesn't seem to be installed on all the 
> machines we have (?).

sar is installed with the following packages:

      system      SUNWaccr       System Accounting, (Root)
      system      SUNWaccu       System Accounting, (Usr)

> - mpstat. this gives CPU states for all CPUs in the machine which is 
> nice. an average could easily be calculated.

the first reading summarizes  all  activity  since  boot; each 
subsequent table summarizes activity for the preceding interval.

Alex..
_______________________________________________
sunmanagers mailing list
sunmanagers@sunmanagers.org
http://www.sunmanagers.org/mailman/listinfo/sunmanagers
Received on Wed Jun 19 04:48:03 2002

This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:47 EST