2
0
mirror of https://github.com/munin-monitoring/contrib.git synced 2018-11-08 00:59:34 +01:00

Merge pull request #28 from dcaillibaud/patch-1

code cleanup
This commit is contained in:
Kenyon Ralph 2012-02-12 20:02:40 -08:00
commit 2c85ca6547

View File

@ -52,10 +52,10 @@ if ( $arg eq "autoconf" ) {
print "yes\n";
} elsif ( $arg eq "config" ) {
print "multigraph openvz_loadavg\n";
print "graph_title loadavg of VE\n";
print "graph_title load average of VE\n";
print "graph_args --base 1000 -l 0 -N\n";
print "graph_scale no\n";
print "graph_vlabel loadavg\n";
print "graph_vlabel load average\n";
print "graph_info Shows 5-minute load average per VE\n";
print "graph_category OpenVZ\n";
@ -68,7 +68,7 @@ if ( $arg eq "autoconf" ) {
my $name = $label;
$name =~ s/\W/_/g;
print "$name.label $label: load average\n";
print "$name.label $label\n";
print "$name.min 0\n";
if ($A==0) {
print "$name.draw AREA\n";
@ -78,48 +78,17 @@ if ( $arg eq "autoconf" ) {
}
}
for (@result ) {
( my $veid,my $label ) = /^\s*(\d+)\s*([\w\-]+)\s*$/ ;
my $name = $label;
$name =~ s/\W/_/g;
print "multigraph openvz_loadavg.$name\n";
print "graph_title loadavg of VE\n";
print "graph_vlabel loadavg\n";
print "$name.label $label: load average\n";
print "$name.info Average load on $label for the past 5 minutes\n";
print "$name.min 0\n";
print "$name.draw AREA\n";
}
} else {
# Getting the values
my @result=`/usr/sbin/vzlist -H -s veid -o veid,name,laverage`;
my $A=0;
print "multigraph openvz_loadavg\n";
print "graph_title loadavg of VE\n";
print "graph_vlabel loadavg\n";
print "graph_category OpenVZ\n";
for (@result ) {
if (( my $veid,my $label, my $laverage ) = /^\s*(\d+)\s+([\w\-]+)\s+[\d\.]+\/([\d\.]+)\/[\d\.]+\s*$/) {
my $name = $label;
$name =~ s/\W/_/g;
print "$name.label $name\n";
print "$name.min 0\n";
if ($A==0) { print "$name.draw AREA\n"; $A=1; } else { print "$name.draw STACK\n"; }
print "$name.value $laverage\n"
}
}
for (@result ) {
if (( my $veid,my $label, my $laverage ) = /^\s*(\d+)\s+([\w\-]+)\s+[\d\.]+\/([\d\.]+)\/[\d\.]+\s*$/) {
my $name = $label;
$name =~ s/\W/_/g;
print "multigraph openvz_loadavg.$name\n";
print "graph_title loadavg of VE\n";
print "graph_vlabel loadavg\n";
print "$name.value $laverage\n"
}
}
}