]> git.zerfleddert.de Git - upsgraph/commitdiff
Trigger data migration if limits of a data source are changed in config file
authorBenjamin Oechslein <benjamin.oechslein@informatik.uni-erlangen.de>
Mon, 12 Jan 2015 20:10:04 +0000 (21:10 +0100)
committerBenjamin Oechslein <benjamin.oechslein@informatik.uni-erlangen.de>
Mon, 12 Jan 2015 20:10:04 +0000 (21:10 +0100)
upsgraph.pl

index 3f17d38409199cf128004ac4f26fe57606ee10ee..795ee95d9d87062e9593124aab8d4d26ed84e035 100755 (executable)
@@ -325,12 +325,15 @@ foreach my $host (@$hosts) {
                        exit 1;
                }
 
                        exit 1;
                }
 
+               my $limitsChanged = 0;
                if (defined($rrdinfo->{"ds[${field}].min"})) {
                        if ($rrdinfo->{"ds[${field}].min"} ne $host->{'vars'}->{$field}->{'min'}) {
                if (defined($rrdinfo->{"ds[${field}].min"})) {
                        if ($rrdinfo->{"ds[${field}].min"} ne $host->{'vars'}->{$field}->{'min'}) {
+                               $limitsChanged = 1;
                                RRDs::tune("${rrdfile}.${field}","-i",$field.":".$host->{'vars'}->{$field}->{'min'});
                        }
                } else {
                        if ($host->{'vars'}->{$field}->{'min'} ne 'U') {
                                RRDs::tune("${rrdfile}.${field}","-i",$field.":".$host->{'vars'}->{$field}->{'min'});
                        }
                } else {
                        if ($host->{'vars'}->{$field}->{'min'} ne 'U') {
+                               $limitsChanged = 1;
                                RRDs::tune("${rrdfile}.${field}","-i",$field.":".$host->{'vars'}->{$field}->{'min'});
                        }
                }
                                RRDs::tune("${rrdfile}.${field}","-i",$field.":".$host->{'vars'}->{$field}->{'min'});
                        }
                }
@@ -342,10 +345,12 @@ foreach my $host (@$hosts) {
 
                if (defined($rrdinfo->{"ds[${field}].max"})) {
                        if ($rrdinfo->{"ds[${field}].max"} ne $host->{'vars'}->{$field}->{'max'}) {
 
                if (defined($rrdinfo->{"ds[${field}].max"})) {
                        if ($rrdinfo->{"ds[${field}].max"} ne $host->{'vars'}->{$field}->{'max'}) {
+                               $limitsChanged = 1;
                                RRDs::tune("${rrdfile}.${field}","-a",$field.":".$host->{'vars'}->{$field}->{'max'});
                        }
                } else {
                        if ($host->{'vars'}->{$field}->{'max'} ne 'U') {
                                RRDs::tune("${rrdfile}.${field}","-a",$field.":".$host->{'vars'}->{$field}->{'max'});
                        }
                } else {
                        if ($host->{'vars'}->{$field}->{'max'} ne 'U') {
+                               $limitsChanged = 1;
                                RRDs::tune("${rrdfile}.${field}","-a",$field.":".$host->{'vars'}->{$field}->{'max'});
                        }
                }
                                RRDs::tune("${rrdfile}.${field}","-a",$field.":".$host->{'vars'}->{$field}->{'max'});
                        }
                }
@@ -356,7 +361,8 @@ foreach my $host (@$hosts) {
                }
                    
                if ($rrdinfo->{'rra[0].rows'} != $keep ||
                }
                    
                if ($rrdinfo->{'rra[0].rows'} != $keep ||
-                       !defined($rrdinfo->{'rra[1].rows'}) || $rrdinfo->{'rra[1].rows'} != $keepHours) {
+                       !defined($rrdinfo->{'rra[1].rows'}) || $rrdinfo->{'rra[1].rows'} != $keepHours ||
+                       $limitsChanged == 1) {
 
                        print "Resizing ${rrdfile}.${field} from " . $rrdinfo->{'rra[0].rows'} .
                                " to ${keep} samples.\n";
 
                        print "Resizing ${rrdfile}.${field} from " . $rrdinfo->{'rra[0].rows'} .
                                " to ${keep} samples.\n";
Impressum, Datenschutz