Files
ports/sysutils/munin-common/files/patch-GraphOld.pm-rrdtool-1.10.0
2026-10-04 04:07:15 +00:00

166 lines
5.0 KiB
Plaintext

--- master/lib/Munin/Master/GraphOld.pm
+++ master/lib/Munin/Master/GraphOld.pm.new.ver
@@ -51,13 +51,12 @@
use Text::ParseWords;
# For UTF-8 handling (plugins are assumed to use Latin 1)
-if ($RRDs::VERSION >= 1.3) {
- use Encode;
- use Encode::Guess;
- Encode->import;
- Encode::Guess->import;
-}
+use Encode;
+use Encode::Guess;
+Encode->import;
+Encode::Guess->import;
+
use Munin::Master::Logger;
use Munin::Master::Utils;
use Munin::Common::Defaults;
@@ -65,25 +64,18 @@
use Log::Log4perl qw( :easy );
# RRDtool 1.2 requires \\: in comments
-my $RRDkludge = $RRDs::VERSION < 1.2 ? '' : '\\';
+my $RRDkludge = '\\';
# And RRDtool 1.2.* draws lines with crayons so we hack
# the LINE* options a bit.
my $LINEkluge = 0;
-if ($RRDs::VERSION >= 1.2 and $RRDs::VERSION < 1.3) {
- # Only kluge the line widths in RRD 1.2*
- $LINEkluge = 1;
-}
-
# RRD 1.3 has a "ADDNAN" operator which evaluates n + NaN = n instead of = NaN.
-my $AddNAN = '+';
-if ($RRDs::VERSION >= 1.3) {
- $AddNAN = 'ADDNAN';
-}
+my $AddNAN = 'ADDNAN';
+
# the ":dashes" syntax for LINEs is supported since rrdtool 1.5.3
-my $RRDLineThresholdAttribute = ($RRDs::VERSION < 1.50003) ? '' : ':dashes';
+my $RRDLineThresholdAttribute = ':dashes';
# Force drawing of "graph no".
my $force_graphing = 0;
@@ -214,7 +206,6 @@
return $arg;
}
-
sub graph_startup {
# Parse options and set up. Stuff that is usually only needed once.
@@ -321,13 +312,7 @@
$max_running = &munin_get($config, "max_graph_jobs", $max_running);
if ($config->{"rrdcached_socket"}) {
- if ($RRDs::VERSION >= 1.3){
- # Using the RRDCACHED_ADDRESS environnement variable, as
- # it is way less intrusive than the command line args.
- $ENV{RRDCACHED_ADDRESS} = $config->{"rrdcached_socket"};
- } else {
- ERROR "[ERROR] RRDCached feature ignored: RRD version must be at least 1.3. Version found: " . $RRDs::VERSION;
- }
+ $ENV{RRDCACHED_ADDRESS} = $config->{"rrdcached_socket"};
}
@@ -548,7 +533,7 @@
push @$result, ("--vertical-label", $tmp_field);
}
- push @$result, '--slope-mode' if $RRDs::VERSION >= 1.2;
+ push @$result, '--slope-mode';
push @$result, "--height", ($size_y || munin_get($service, "graph_height", "175"));
push @$result, "--width", ($size_x || munin_get($service, "graph_width", "400"));
@@ -1108,9 +1093,9 @@
# Or when we want to.
push(@rrd, "COMMENT:" . (" " x $max_field_len));
push(@rrd, "COMMENT: Cur$RRDkludge:");
- push(@rrd, "COMMENT:Min$RRDkludge:");
- push(@rrd, "COMMENT:Avg$RRDkludge:");
- push(@rrd, "COMMENT:Max$RRDkludge: \\j");
+ push(@rrd, "COMMENT: Min$RRDkludge:");
+ push(@rrd, "COMMENT: Avg$RRDkludge:");
+ push(@rrd, "COMMENT: Max$RRDkludge: \\j");
$global_headers = 2; # Avoid further headers/labels
}
@@ -1351,7 +1336,7 @@
my @complete = get_fonts();
# Watermarks introduced in RRD 1.2.13.
- push(@complete, '-W', $watermark) if $RRDs::VERSION >= 1.2013;
+ push(@complete, '-W', $watermark);
# Do the header (title, vtitle, size, etc...), but IN THE BEGINNING
unshift @complete, @{get_header($service, $time)};
@@ -1378,13 +1363,11 @@
# as utf8 string. So we assume that every input is in latin1
# and decode it to perl's internal representation and then to utf8.
- if ($RRDs::VERSION >= 1.3) {
@complete = map {
my $str = $_;
my $utf8 = guess_encoding($str, 'utf8');
ref $utf8 ? $str : encode("utf8", (decode("latin1", $_)));
} @complete;
- }
# Surcharging the graphing limits
my ($upper_limit_overrided, $lower_limit_overrided);
@@ -1654,20 +1637,7 @@
# Set up rrdtool graph font options according to RRD version.
my @options;
- if ($RRDs::VERSION < 1.2) {
- # RRD before 1.2, no font options
- } elsif ($RRDs::VERSION < 1.3) {
- # RRD 1.2
- # The RRD 1.2 documentation says you can identify font family
- # names but I never got that to work, but full font path worked
@options = (
- '--font', "LEGEND:7:$libdir/DejaVuSansMono.ttf",
- '--font', "UNIT:7:$libdir/DejaVuSans.ttf",
- '--font', "AXIS:7:$libdir/DejaVuSans.ttf",
- );
- } else {
- # At least 1.3
- @options = (
'--font', 'DEFAULT:0:DejaVuSans,DejaVu Sans,DejaVu LGC Sans,Bitstream Vera Sans',
'--font', 'LEGEND:7:DejaVuSansMono,DejaVu Sans Mono,DejaVu LGC Sans Mono,Bitstream Vera Sans Mono,monospace',
# Colors coordinated with CSS.
@@ -1678,14 +1648,10 @@
'--color', 'AXIS#CFD6F8', # And axis like html boxes
'--color', 'ARROW#CFD6F8', # And arrow, ditto.
);
- }
- if ($RRDs::VERSION >= 1.4) {
- # RRD 1.4 has border, adding it
push @options, (
'--border', '0',
);
- }
return @options;
};
@@ -1847,7 +1813,7 @@
sub RRDescape {
my $text = shift;
- return $RRDs::VERSION < 1.2 ? $text : escape($text);
+ return escape($text);
}