Zoomed graphs in 'system.pm' now honour the 'global_zoom' option, and they also use the function RRDs::graphv to fit better in the browser pop up window (only for RRDtool v1.3+)

This commit is contained in:
Jordi Sanfeliu 2014-12-30 16:27:00 +01:00
parent 6986519fc7
commit 28eab15a01
1 changed files with 8 additions and 6 deletions

View File

@ -587,7 +587,7 @@ sub system_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
RRDs::graph("$PNG_DIR" . "$PNG2",
$pic = $rrd{$version}->("$PNG_DIR" . "$PNG2",
"--title=$config->{graphs}->{_system2} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@ -610,7 +610,7 @@ sub system_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}->{_system2} ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@ -618,6 +618,7 @@ sub system_cgi {
"--width=$width",
"--height=$height",
@riglim,
$zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},
@ -636,7 +637,7 @@ sub system_cgi {
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $PNG2z . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG2 . "' border='0'></a>\n");
}
else {
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNG2z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG2 . "' border='0'></a>\n");
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNG2z . "','','width=" . ($picz->{image_width} * $config->{global_zoom}) . ",height=" . ($picz->{image_height} * $config->{global_zoom}) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG2 . "' border='0'></a>\n");
}
} else {
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG2 . "'>\n");
@ -681,7 +682,7 @@ sub system_cgi {
push(@tmp, "COMMENT: \\n");
push(@tmp, "COMMENT: \\n");
}
RRDs::graph("$PNG_DIR" . "$PNG3",
$pic = $rrd{$version}->("$PNG_DIR" . "$PNG3",
"--title=$config->{graphs}->{_system3} (${total_mem}MB) ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@ -715,7 +716,7 @@ sub system_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}->{_system3} (${total_mem}MB) ($tf->{nwhen}$tf->{twhen})",
"--start=-$tf->{nwhen}$tf->{twhen}",
"--imgformat=PNG",
@ -725,6 +726,7 @@ sub system_cgi {
"--upper-limit=$total_mem",
"--lower-limit=0",
"--base=1024",
$zoom,
@{$cgi->{version12}},
@{$cgi->{version12_small}},
@{$colors->{graph_colors}},
@ -752,7 +754,7 @@ sub system_cgi {
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $PNG3z . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG3 . "' border='0'></a>\n");
}
else {
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNG3z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG3 . "' border='0'></a>\n");
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNG3z . "','','width=" . ($picz->{image_width} * $config->{global_zoom}) . ",height=" . ($picz->{image_height} * $config->{global_zoom}) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG3 . "' border='0'></a>\n");
}
} else {
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG3 . "'>\n");