Subject: | add_DS does not accept negative value for 'min' |
Source code uses regex to match only digits (positive integer or zero):
sub add_DS {
# add a new DS. argument is is same format as used by create
my ($self, $arg) = @_; my $rrd=$self->{rrd};
if ($arg !~ m/^DS:([a-zA-Z0-9_\-]+):(GAUGE|COUNTER|DERIVE|ABSOLUTE):
([0-9]+):(U|[0-9\.]+):(U|[0-9\.]+)$/) { croak("Invalid DS spec\n");}
But RRD is able to specify/use negative values in DS min/max (such as
temperature as sample).
How to reproduce:
my $rrde = RRD::Editor->new();
$rrde->open('exists rrd file');
$rrde->add_DS('DS:temp:ABSOLUTE:120:-60:+60');
Result:
Invalid DS spec
Expected result:
Successfully altered RRD