Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Usage of CPU in graphical form

Status
Not open for further replies.

aixadm

MIS
May 11, 2005
28
0
0
US
Hi,

How can I collect the cpu utilization in a graphical form ? Is there anyway to collect this graph from nmon? I need to send this to our apps/DB guys to look in.
Thanks
 
use topas, and I think you can get that into a file.

Also checkout "severgraph" its a opensource program
 
As far as I know nmon provides a facilty to export to Excel format.
 
I use the command vmstat and a perlscript that convert the Output from vmstat to excel.

vmstat_ausgabe.sh (runs once the day via cron)
out=/tmp/vmstat/`date +%w`-vmstat.out
vmstat -t 900 96 > $out &

vmreport.pl (runs once the day via cron)
#!/usr/bin/perl

use strict;
use Spreadsheet::WriteExcel;
use Env;
use MIME::Lite;

my $path = "/tmp/vmstat/";
my $datin = "-vmstat.out";
my $node = `hostname`;
chomp ($node);
my $exl = "$node-vmstat";
my $mailto = "your.name\@your-company.de";
my $datum = `date +%d.%m.%Y`;
my $i = 0;
my $sum_cpu = 0;
my $sum_ps = 0;
my $line = 0;
my @felder = " ";
my $exlfile = Spreadsheet::WriteExcel->new("$path$exl.xls");
my @tag = ("Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag");

chomp ($datum);

for ($i = 0; $i <= 6; $i++)
{
open (IN, "$path$i$datin");
my $ws = $exlfile->add_worksheet(@tag[$i]);
$line = 0;
$ws->write ($line, 1, "CPU User");
$ws->write ($line, 2, "CPU System");
$ws->write ($line, 3, "CPU Wait");
$ws->write ($line, 4, "CPU Summe");
$ws->write ($line, 5, "Page to PS");
$ws->write ($line, 6, "Page from PS");
$ws->write ($line, 7, "Page Summe");
$ws->write ($line, 8, "Time");
$line = 1;
while (<IN>)
{
if ( substr ($_,0,1) eq " " )
{
if (substr ($_,1,1) ne "r")
{
@felder = split(" ",$_);
$sum_cpu = @felder[13] + @felder[14] + @felder[16];
$sum_ps = @felder[6] + @felder[5];
$ws->write ($line, 1, @felder[13]);
$ws->write ($line, 2, @felder[14]);
$ws->write ($line, 3, @felder[16]);
$ws->write ($line, 4, $sum_cpu);
$ws->write ($line, 5, @felder[6]);
$ws->write ($line, 6, @felder[5]);
$ws->write ($line, 7, $sum_ps);
$ws->write ($line, 8, "@felder[17]");
++$line;
}
}
}
}

$exlfile->close ("$path$exl.xls");

if ( -e "$path$exl.xls")
{
chdir $path;
system ("/usr/bin/zip -9mD $path$exl.zip $exl.xls > /dev/null");
senden();
}


sub senden
{
my $msg =MIME::Lite->new(
From => "$ENV{USER}\@$node",
To => "$mailto",
Subject => "$node : Performanceanalyse vom $datum",
Type => 'multipart/mixed'
);
$msg->attach(
Type => 'TEXT',
Data => "Workload Datei vom $datum !!!\n ",
);
$msg->attach(
Type => 'AUTO',
Filename => "$exl.zip",
Path => "$path$exl.zip",
Disposition => 'attachment'
);
$msg->send();
}



You become every day an email with an excel attachment.
Maybe you neeed to install some perl modules.


Hope it is usebal for you

Michael

 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top