diff --git a/contrib/collection3/lib/Collectd/Graph/Type.pm b/contrib/collection3/lib/Collectd/Graph/Type.pm
index 60097e5c43653c8e2cd3aedabceb8bc877236dfe..01c2417c39db7bab0e5a74fbd6f91b4724e7c60a 100644 (file)
my $plugin_instance = $ident->{'plugin_instance'};
my $type = $ident->{'type'};
my $type_instance = $ident->{'type_instance'};
my $plugin_instance = $ident->{'plugin_instance'};
my $type = $ident->{'type'};
my $type_instance = $ident->{'type_instance'};
+ my $instance;
+
+ if (defined $type_instance)
+ {
+ $instance = $type_instance;
+ }
+ elsif (defined $plugin_instance)
+ {
+ $instance = $plugin_instance;
+ }
+ else
+ {
+ $instance = 'no instance';
+ }
if (!defined $plugin_instance)
{
if (!defined $plugin_instance)
{
$title =~ s#{plugin_instance}#$plugin_instance#g;
$title =~ s#{type}#$type#g;
$title =~ s#{type_instance}#$type_instance#g;
$title =~ s#{plugin_instance}#$plugin_instance#g;
$title =~ s#{type}#$type#g;
$title =~ s#{type_instance}#$type_instance#g;
+ $title =~ s#{instance}#$instance#g;
return ($title);
}
return ($title);
}
$f =~ s#:#\\:#g;
$ds_name =~ s#:#\\:#g;
$f =~ s#:#\\:#g;
$ds_name =~ s#:#\\:#g;
- push (@ret,
- "DEF:min${i}=${f}:${ds_name}:MIN",
- "DEF:avg${i}=${f}:${ds_name}:AVERAGE",
- "DEF:max${i}=${f}:${ds_name}:MAX");
+ if (exists ($obj->{'scale'}))
+ {
+ my $scale = 0.0 + $obj->{'scale'};
+ push (@ret,
+ "DEF:min${i}_raw=${f}:${ds_name}:MIN",
+ "DEF:avg${i}_raw=${f}:${ds_name}:AVERAGE",
+ "DEF:max${i}_raw=${f}:${ds_name}:MAX",
+ "CDEF:max${i}=max${i}_raw,$scale,*",
+ "CDEF:avg${i}=avg${i}_raw,$scale,*",
+ "CDEF:min${i}=min${i}_raw,$scale,*");
+ }
+ else
+ {
+ push (@ret,
+ "DEF:min${i}=${f}:${ds_name}:MIN",
+ "DEF:avg${i}=${f}:${ds_name}:AVERAGE",
+ "DEF:max${i}=${f}:${ds_name}:MAX");
+ }
}
if (@$ds == 1)
}
if (@$ds == 1)