mirror of
https://github.com/Cacti/cacti.git
synced 2026-11-09 05:26:50 +09:00
git-svn-id: svn+ssh://repo.cacti.net/var/data/svnroot/cacti/branches/BRANCH_0_8_6/cacti@3439 860744bd-22fc-0310-8c96-e9fe5004b5ca
25 lines
401 B
Perl
25 lines
401 B
Perl
#!/usr/bin/perl
|
|
|
|
#get load avg for 5;15;30 min
|
|
open(PROCESS,"uptime |");
|
|
$avg = <PROCESS>;
|
|
$avg =~ s/.*:\s*//;
|
|
close(PROCESS);
|
|
|
|
if ($ARGV[0] eq "5") {
|
|
$avg = `echo "$avg" | awk '\{print \$1 \}'`;
|
|
}
|
|
|
|
if ($ARGV[0] eq "15") {
|
|
$avg = `echo "$avg" | awk '\{print \$2 \}'`;
|
|
}
|
|
|
|
if ($ARGV[0] eq "30") {
|
|
$avg = `echo "$avg" | awk '\{print \$3 \}'`;
|
|
}
|
|
|
|
chomp $avg;
|
|
$avg =~ s/,//;
|
|
$avg =~ s/\n//;
|
|
print $avg;
|