Subject: | default_dstype not used when auto-create new DS - patch included |
When executing an "update" for a data source that is not part of the
RRD file, the source is auto-added (which is great :-). However, this
new added source is not using default_dstype as set at the rrd level or
any other level.
In the "update" document section:
"If you try to update a value for a data source that does not exist, it
will automatically be added for you. The data source type will be set
to whatever is contained in the $RRD::Simple::DEFAULT_DSTYPE variable.
(See the VARIABLES section below)."
I have attached a patch that fixes the issue for me.
Thanks for the wonderful RRD::Simple module!
Subject: | dstype_on_update.diff |
--- Simple.pm.orig 2009-05-27 19:08:31.056090500 +0200
+++ Simple.pm 2009-06-02 18:43:43.914256200 +0200
@@ -323,16 +323,9 @@
my $error = RRDs::error();
croak($error) if $error;
- my %dsTypes;
- for my $key (grep(/^ds\[.+?\]\.type$/,keys %{$info})) {
- $dsTypes{$info->{$key}}++;
- }
- DUMP('%dsTypes',\%dsTypes);
- my $dstype = (sort { $dsTypes{$b} <=> $dsTypes{$a} }
- keys %dsTypes)[0];
- TRACE("\$dstype = $dstype");
+ TRACE("\$dstype = $stor->{default_dstype}");
- $self->add_source($rrdfile,$ds,$dstype);
+ $self->add_source($rrdfile,$ds,$stor->{default_dstype});
}
}
}