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). - sar. this would be good but doesn't seem to be installed on all the machines we have (?). - vmstat. Jonas Blaberg suggested running vmstat for a few lines and taking the second or third values thus skipping the first problematic one. this would work, but is slow. i would have to wait 3+ seconds for each reading. (shame there is no way to reset the counters). - mpstat. this gives CPU states for all CPUs in the machine which is nice. an average could easily be calculated. - uptime. Although uptime doesn't give me the CPU load the same way as top, a measure of jobs in the run queue is a good an indication of load. I think after all that I'll use a combination of mpstat and uptime. Thanks again. Alex... -- -= alex dyas - webmaster - twowaytv - uk =- _______________________________________________ sunmanagers mailing list sunmanagers@sunmanagers.org http://www.sunmanagers.org/mailman/listinfo/sunmanagersReceived on Tue Jun 18 05:19:30 2002
This archive was generated by hypermail 2.1.8 : Thu Mar 03 2016 - 06:42:46 EST