diff --git a/lib/nfss.pm b/lib/nfss.pm
index 6b1cdf3..667e434 100644
--- a/lib/nfss.pm
+++ b/lib/nfss.pm
@@ -283,6 +283,15 @@ sub nfss_cgi {
my $graph = $cgi->{graph};
my $silent = $cgi->{silent};
my $zoom = "--zoom=" . $config->{global_zoom};
+ my %rrd = (
+ 'new' => \&RRDs::graphv,
+ 'old' => \&RRDs::graph,
+ );
+ my $version = "new";
+ my $pic;
+ my $picz;
+ my $picz_width;
+ my $picz_height;
my $u = "";
my $width;
@@ -321,6 +330,7 @@ sub nfss_cgi {
"#888888",
);
+ $version = "old" if $RRDs::VERSION < 1.3;
my $rrd = $config->{base_lib} . $package . ".rrd";
my $title = $config->{graph_title}->{$package};
my $PNG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
@@ -509,7 +519,7 @@ sub nfss_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
- RRDs::graph("$PNG_DIR" . "$PNG1",
+ $pic = $rrd{$version}->("$PNG_DIR" . "$PNG1",
"--title=$config->{graphs}->{_nfss1} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -528,7 +538,7 @@ sub nfss_cgi {
print("ERROR: while graphing $PNG_DIR" . "$PNG1: $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
- RRDs::graph("$PNG_DIR" . "$PNG1z",
+ $picz = $rrd{$version}->("$PNG_DIR" . "$PNG1z",
"--title=$config->{graphs}->{_nfss1} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -536,6 +546,7 @@ sub nfss_cgi {
"--width=$width",
"--height=$height",
@riglim,
+ $zoom,
@{$cgi->{version12}},
@{$colors->{graph_colors}},
@DEF,
@@ -550,7 +561,14 @@ sub nfss_cgi {
print(" {url} . "/" . $config->{imgs_dir} . $PNG1z . "\">\n");
}
else {
- print(" {url} . "/" . $config->{imgs_dir} . $PNG1z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\">\n");
+ if($version eq "new") {
+ $picz_width = $picz->{image_width} * $config->{global_zoom};
+ $picz_height = $picz->{image_height} * $config->{global_zoom};
+ } else {
+ $picz_width = $width + 115;
+ $picz_height = $height + 100;
+ }
+ print(" {url} . "/" . $config->{imgs_dir} . $PNG1z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
}
} else {
print(" \n");
@@ -596,7 +614,7 @@ sub nfss_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
- RRDs::graph("$PNG_DIR" . "$PNG2",
+ $pic = $rrd{$version}->("$PNG_DIR" . "$PNG2",
"--title=$config->{graphs}->{_nfss2} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -614,7 +632,7 @@ sub nfss_cgi {
print("ERROR: while graphing $PNG_DIR" . "$PNG2: $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
- RRDs::graph("$PNG_DIR" . "$PNG2z",
+ $picz = $rrd{$version}->("$PNG_DIR" . "$PNG2z",
"--title=$config->{graphs}->{_nfss2} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -622,6 +640,7 @@ sub nfss_cgi {
"--width=$width",
"--height=$height",
@riglim,
+ $zoom,
@{$cgi->{version12}},
@{$colors->{graph_colors}},
@DEF,
@@ -636,7 +655,14 @@ sub nfss_cgi {
print(" {url} . "/" . $config->{imgs_dir} . $PNG2z . "\">\n");
}
else {
- print(" {url} . "/" . $config->{imgs_dir} . $PNG2z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\">\n");
+ if($version eq "new") {
+ $picz_width = $picz->{image_width} * $config->{global_zoom};
+ $picz_height = $picz->{image_height} * $config->{global_zoom};
+ } else {
+ $picz_width = $width + 115;
+ $picz_height = $height + 100;
+ }
+ print(" {url} . "/" . $config->{imgs_dir} . $PNG2z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
}
} else {
print(" \n");
@@ -682,7 +708,7 @@ sub nfss_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
- RRDs::graph("$PNG_DIR" . "$PNG3",
+ $pic = $rrd{$version}->("$PNG_DIR" . "$PNG3",
"--title=$config->{graphs}->{_nfss3} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -700,7 +726,7 @@ sub nfss_cgi {
print("ERROR: while graphing $PNG_DIR" . "$PNG3: $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
- RRDs::graph("$PNG_DIR" . "$PNG3z",
+ $picz = $rrd{$version}->("$PNG_DIR" . "$PNG3z",
"--title=$config->{graphs}->{_nfss3} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -708,6 +734,7 @@ sub nfss_cgi {
"--width=$width",
"--height=$height",
@riglim,
+ $zoom,
@{$cgi->{version12}},
@{$colors->{graph_colors}},
@DEF,
@@ -722,7 +749,14 @@ sub nfss_cgi {
print(" {url} . "/" . $config->{imgs_dir} . $PNG3z . "\">\n");
}
else {
- print(" {url} . "/" . $config->{imgs_dir} . $PNG3z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\">\n");
+ if($version eq "new") {
+ $picz_width = $picz->{image_width} * $config->{global_zoom};
+ $picz_height = $picz->{image_height} * $config->{global_zoom};
+ } else {
+ $picz_width = $width + 115;
+ $picz_height = $height + 100;
+ }
+ print(" {url} . "/" . $config->{imgs_dir} . $PNG3z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
}
} else {
print(" \n");
@@ -763,7 +797,7 @@ sub nfss_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
- RRDs::graph("$PNG_DIR" . "$PNG4",
+ $pic = $rrd{$version}->("$PNG_DIR" . "$PNG4",
"--title=$config->{graphs}->{_nfss4} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -784,7 +818,7 @@ sub nfss_cgi {
print("ERROR: while graphing $PNG_DIR" . "$PNG4: $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
- RRDs::graph("$PNG_DIR" . "$PNG4z",
+ $picz = $rrd{$version}->("$PNG_DIR" . "$PNG4z",
"--title=$config->{graphs}->{_nfss4} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -792,6 +826,7 @@ sub nfss_cgi {
"--width=$width",
"--height=$height",
@riglim,
+ $zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},
@@ -809,7 +844,14 @@ sub nfss_cgi {
print(" {url} . "/" . $config->{imgs_dir} . $PNG4z . "\">\n");
}
else {
- print(" {url} . "/" . $config->{imgs_dir} . $PNG4z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\">\n");
+ if($version eq "new") {
+ $picz_width = $picz->{image_width} * $config->{global_zoom};
+ $picz_height = $picz->{image_height} * $config->{global_zoom};
+ } else {
+ $picz_width = $width + 115;
+ $picz_height = $height + 100;
+ }
+ print(" {url} . "/" . $config->{imgs_dir} . $PNG4z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
}
} else {
print(" \n");
@@ -849,7 +891,7 @@ sub nfss_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
- RRDs::graph("$PNG_DIR" . "$PNG5",
+ $pic = $rrd{$version}->("$PNG_DIR" . "$PNG5",
"--title=$config->{graphs}->{_nfss5} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -872,7 +914,7 @@ sub nfss_cgi {
print("ERROR: while graphing $PNG_DIR" . "$PNG5: $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
- RRDs::graph("$PNG_DIR" . "$PNG5z",
+ $picz = $rrd{$version}->("$PNG_DIR" . "$PNG5z",
"--title=$config->{graphs}->{_nfss5} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -880,6 +922,7 @@ sub nfss_cgi {
"--width=$width",
"--height=$height",
@riglim,
+ $zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},
@@ -899,7 +942,14 @@ sub nfss_cgi {
print(" {url} . "/" . $config->{imgs_dir} . $PNG5z . "\">\n");
}
else {
- print(" {url} . "/" . $config->{imgs_dir} . $PNG5z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\">\n");
+ if($version eq "new") {
+ $picz_width = $picz->{image_width} * $config->{global_zoom};
+ $picz_height = $picz->{image_height} * $config->{global_zoom};
+ } else {
+ $picz_width = $width + 115;
+ $picz_height = $height + 100;
+ }
+ print(" {url} . "/" . $config->{imgs_dir} . $PNG5z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
}
} else {
print(" \n");
@@ -939,7 +989,7 @@ sub nfss_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
- RRDs::graph("$PNG_DIR" . "$PNG6",
+ $pic = $rrd{$version}->("$PNG_DIR" . "$PNG6",
"--title=$config->{graphs}->{_nfss6} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -963,7 +1013,7 @@ sub nfss_cgi {
print("ERROR: while graphing $PNG_DIR" . "$PNG6: $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
- RRDs::graph("$PNG_DIR" . "$PNG6z",
+ $picz = $rrd{$version}->("$PNG_DIR" . "$PNG6z",
"--title=$config->{graphs}->{_nfss6} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -971,6 +1021,7 @@ sub nfss_cgi {
"--width=$width",
"--height=$height",
@riglim,
+ $zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},
@@ -991,7 +1042,14 @@ sub nfss_cgi {
print(" {url} . "/" . $config->{imgs_dir} . $PNG6z . "\">\n");
}
else {
- print(" {url} . "/" . $config->{imgs_dir} . $PNG6z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\">\n");
+ if($version eq "new") {
+ $picz_width = $picz->{image_width} * $config->{global_zoom};
+ $picz_height = $picz->{image_height} * $config->{global_zoom};
+ } else {
+ $picz_width = $width + 115;
+ $picz_height = $height + 100;
+ }
+ print(" {url} . "/" . $config->{imgs_dir} . $PNG6z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
}
} else {
print(" \n");
@@ -1049,7 +1107,7 @@ sub nfss_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
- RRDs::graph("$PNG_DIR" . "$PNG7",
+ $pic = $rrd{$version}->("$PNG_DIR" . "$PNG7",
"--title=$config->{graphs}->{_nfss7} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -1079,7 +1137,7 @@ sub nfss_cgi {
print("ERROR: while graphing $PNG_DIR" . "$PNG7: $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
- RRDs::graph("$PNG_DIR" . "$PNG7z",
+ $picz = $rrd{$version}->("$PNG_DIR" . "$PNG7z",
"--title=$config->{graphs}->{_nfss7} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -1087,6 +1145,7 @@ sub nfss_cgi {
"--width=$width",
"--height=$height",
@riglim,
+ $zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},
@@ -1113,7 +1172,14 @@ sub nfss_cgi {
print(" {url} . "/" . $config->{imgs_dir} . $PNG7z . "\">\n");
}
else {
- print(" {url} . "/" . $config->{imgs_dir} . $PNG7z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\">\n");
+ if($version eq "new") {
+ $picz_width = $picz->{image_width} * $config->{global_zoom};
+ $picz_height = $picz->{image_height} * $config->{global_zoom};
+ } else {
+ $picz_width = $width + 115;
+ $picz_height = $height + 100;
+ }
+ print(" {url} . "/" . $config->{imgs_dir} . $PNG7z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
}
} else {
print(" \n");
@@ -1153,7 +1219,7 @@ sub nfss_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
- RRDs::graph("$PNG_DIR" . "$PNG8",
+ $pic = $rrd{$version}->("$PNG_DIR" . "$PNG8",
"--title=$config->{graphs}->{_nfss8} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -1175,7 +1241,7 @@ sub nfss_cgi {
print("ERROR: while graphing $PNG_DIR" . "$PNG8: $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
- RRDs::graph("$PNG_DIR" . "$PNG8z",
+ $picz = $rrd{$version}->("$PNG_DIR" . "$PNG8z",
"--title=$config->{graphs}->{_nfss8} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -1183,6 +1249,7 @@ sub nfss_cgi {
"--width=$width",
"--height=$height",
@riglim,
+ $zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},
@@ -1201,7 +1268,14 @@ sub nfss_cgi {
print(" {url} . "/" . $config->{imgs_dir} . $PNG8z . "\">\n");
}
else {
- print(" {url} . "/" . $config->{imgs_dir} . $PNG8z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\">\n");
+ if($version eq "new") {
+ $picz_width = $picz->{image_width} * $config->{global_zoom};
+ $picz_height = $picz->{image_height} * $config->{global_zoom};
+ } else {
+ $picz_width = $width + 115;
+ $picz_height = $height + 100;
+ }
+ print(" {url} . "/" . $config->{imgs_dir} . $PNG8z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
}
} else {
print(" \n");
@@ -1241,7 +1315,7 @@ sub nfss_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
- RRDs::graph("$PNG_DIR" . "$PNG9",
+ $pic = $rrd{$version}->("$PNG_DIR" . "$PNG9",
"--title=$config->{graphs}->{_nfss9} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -1265,7 +1339,7 @@ sub nfss_cgi {
print("ERROR: while graphing $PNG_DIR" . "$PNG9: $err\n") if $err;
if(lc($config->{enable_zoom}) eq "y") {
($width, $height) = split('x', $config->{graph_size}->{zoom});
- RRDs::graph("$PNG_DIR" . "$PNG9z",
+ $picz = $rrd{$version}->("$PNG_DIR" . "$PNG9z",
"--title=$config->{graphs}->{_nfss9} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@@ -1273,6 +1347,7 @@ sub nfss_cgi {
"--width=$width",
"--height=$height",
@riglim,
+ $zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},
@@ -1293,7 +1368,14 @@ sub nfss_cgi {
print(" {url} . "/" . $config->{imgs_dir} . $PNG9z . "\">\n");
}
else {
- print(" {url} . "/" . $config->{imgs_dir} . $PNG9z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\">\n");
+ if($version eq "new") {
+ $picz_width = $picz->{image_width} * $config->{global_zoom};
+ $picz_height = $picz->{image_height} * $config->{global_zoom};
+ } else {
+ $picz_width = $width + 115;
+ $picz_height = $height + 100;
+ }
+ print(" {url} . "/" . $config->{imgs_dir} . $PNG9z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n");
}
} else {
print(" \n");