#!/usr/bin/perl
#my $srv_name=`uname -n`;
#chomp ($srv_name);
my $TIMESTAMP=`date +%Y%m%d%H%M`;
chomp ($TIMESTAMP);
my $pagesize=`pagesize`;
my $i=0;
print "t Server Name t Date and Time t MemFreetSwapFreet%CPU Utilizationn";
my @servers=`cat /home/rn074/serverlist.txt`;
foreach $server(@servers)
{
$server=~s/n$//g;
my $memfree = `remsh $server sar -r 5 5 | tail -1 |
linuxjishu/13830.html target=_blank class=infotextkey>awk '{ print $2}'`;
my $swapfree=`remsh $server sar -r 5 5 | tail -1 |awk '{print $3}'`;
my $free_mem=($memfree*$pagesize/1024)/1024;
my $free_swap=($swapfree*$pagesize/1024)/1024;
my $cpu=`remsh $server sar -u 5 5 | tail -1 | awk '{ print 100 - $5 }'`;
#print "t Server Name t Date and Timet MemfreetSwapfreet % CPU Utilisationn";
printf ("t%-18s%-10st%-10.2ft%-10.2ft%-10.2fn",$servers[$i],$TIMESTAMP,$free_mem,$free_swap,$cpu);
$iS++;
}