1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24
|
#!/usr/bin/perl
$HOSTNAME = `/bin/hostname`; chop($HOSTNAME); $machine = $HOSTNAME;
$load = `awk '/cpu /' < /proc/stat`;
chop ($load);
$load =~ s/ / /; ($lame,$user,$nice,$sys,$idle) = split (/ /, $load);
$total = $user + $nice; print "$total\n";
$totalsys = $total + $sys; print "$totalsys\n";
$getuptime = `/usr/bin/uptime`; $getuptime =~ /^\s+(\d{1,2}:\d{2}..)\s+up\s+(\d+)\s+(\w+),/; print $2." ".$3."\n";
print $machine."\n"; |