mirror of
https://github.com/munin-monitoring/contrib.git
synced 2025-07-25 18:38:30 +00:00
Whitespace cleanup
* remove trailing whitespace * remove empty lines at the end of files
This commit is contained in:
parent
ef851f0c34
commit
17f784270a
604 changed files with 2927 additions and 2945 deletions
|
@ -7,8 +7,8 @@
|
|||
# Based loosely on Adam Crews' xen_cpu script
|
||||
#
|
||||
# This script tries to measure the CPU usage of the Xen guests
|
||||
# accurately.
|
||||
# The problem with the current monitoring script is that these
|
||||
# accurately.
|
||||
# The problem with the current monitoring script is that these
|
||||
# scripts use the CPU output of xentop or xm list, which might be
|
||||
# inaccurate due to the resources used up at the time of the query by
|
||||
# the xm or xentop command.
|
||||
|
@ -50,7 +50,7 @@ if ( defined($ARGV[0]) )
|
|||
{
|
||||
$arg = 'autoconf';
|
||||
}
|
||||
|
||||
|
||||
if ( $arg eq 'autoconf')
|
||||
{
|
||||
if ( -e $XM && -e $XMTOP )
|
||||
|
@ -102,7 +102,7 @@ if ( defined($ARGV[0]) )
|
|||
exit 0;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
my @xmlist = `$XM list`;
|
||||
shift (@xmlist);
|
||||
|
||||
|
@ -124,7 +124,7 @@ if ( -e $TEMPFILE )
|
|||
$_ =~ /(\S+)\s+\S+\s+\S+\s+\d+\s+\S+\s+(\S+)/;
|
||||
$dom{$1}->{'oldtime'} = $2;
|
||||
}
|
||||
|
||||
|
||||
close FH;
|
||||
}
|
||||
|
||||
|
@ -137,14 +137,14 @@ foreach my $domain ( @xmlist )
|
|||
|
||||
$diff = $dom{$1}->{'newtime'} - $dom{$1}->{'oldtime'};
|
||||
$diff = sprintf("%.2f", $diff);
|
||||
|
||||
|
||||
# Calc the diff between old and new cputime, or reset the counter
|
||||
if ( $diff < 0 )
|
||||
{
|
||||
$diff = $dom{$1}->{'newtime'};
|
||||
}
|
||||
$dom{$1}->{'diff'} = $diff;
|
||||
|
||||
|
||||
# Calc a sum CPU usage
|
||||
$cpusum = $cpusum + $diff;
|
||||
}
|
||||
|
@ -168,7 +168,7 @@ while (($key, $value) = each %dom)
|
|||
my $tmp = 0;
|
||||
$tmp = ( $dom{$key}->{'diff'} / $cpusum ) * 100;
|
||||
$dom{$key}->{'pc_time'} = sprintf("%.2f", $tmp);
|
||||
|
||||
|
||||
# Calc a percentage based on the _total_ available CPU time
|
||||
$tmp = 0;
|
||||
if ($tcpuavail != 0) {
|
||||
|
@ -177,7 +177,7 @@ while (($key, $value) = each %dom)
|
|||
} else {
|
||||
$dom{$key}->{'pc_tcpu'} = "U";
|
||||
}
|
||||
|
||||
|
||||
if ( $debug )
|
||||
{
|
||||
print "$key newtime: ".$dom{$key}->{'newtime'}.", oldtime: ".$dom{$key}->{'oldtime'}.", diff: ".$dom{$key}->{'diff'}.", pc_bytime ".$dom{$key}->{'pc_time'}.", pc_bytcpu ".$dom{$key}->{'pc_tcpu'}."\n";
|
||||
|
@ -190,4 +190,4 @@ open(FH, ">", $TEMPFILE) or die $!;
|
|||
print FH $curtime."\n";
|
||||
print FH @xmlist;
|
||||
close FH;
|
||||
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue