mirror of https://github.com/mikaku/Monitorix.git
Zoomed graphs in 'wowza.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:
parent
85b43fab8e
commit
b3ece773b9
80
lib/wowza.pm
80
lib/wowza.pm
|
@ -384,6 +384,15 @@ sub wowza_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;
|
||||
|
@ -425,6 +434,7 @@ sub wowza_cgi {
|
|||
"#444444",
|
||||
);
|
||||
|
||||
$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};
|
||||
|
@ -587,7 +597,7 @@ sub wowza_cgi {
|
|||
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
|
||||
}
|
||||
($width, $height) = split('x', $config->{graph_size}->{main});
|
||||
RRDs::graph("$PNG_DIR" . "$PNG[$e * 5]",
|
||||
$pic = $rrd{$version}->("$PNG_DIR" . "$PNG[$e * 5]",
|
||||
"--title=$config->{graphs}->{_wowza1} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -615,7 +625,7 @@ sub wowza_cgi {
|
|||
print("ERROR: while graphing $PNG_DIR" . "$PNG[$e * 5]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
RRDs::graph("$PNG_DIR" . "$PNGz[$e * 5]",
|
||||
$picz = $rrd{$version}->("$PNG_DIR" . "$PNGz[$e * 5]",
|
||||
"--title=$config->{graphs}->{_wowza1} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -623,6 +633,7 @@ sub wowza_cgi {
|
|||
"--width=$width",
|
||||
"--height=$height",
|
||||
@riglim,
|
||||
$zoom,
|
||||
@{$cgi->{version12}},
|
||||
@{$colors->{graph_colors}},
|
||||
"DEF:wms" . $e . "_a0=$rrd:wms" . $e . "_a0_conncur:AVERAGE",
|
||||
|
@ -646,7 +657,14 @@ sub wowza_cgi {
|
|||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5] . "' border='0'></a>\n");
|
||||
}
|
||||
else {
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5] . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5] . "' border='0'></a>\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(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5] . "'>\n");
|
||||
|
@ -683,7 +701,7 @@ sub wowza_cgi {
|
|||
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
|
||||
}
|
||||
($width, $height) = split('x', $config->{graph_size}->{main});
|
||||
RRDs::graph("$PNG_DIR" . $PNG[$e * 5 + 1],
|
||||
$pic = $rrd{$version}->("$PNG_DIR" . $PNG[$e * 5 + 1],
|
||||
"--title=$config->{graphs}->{_wowza2} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -717,7 +735,7 @@ sub wowza_cgi {
|
|||
print("ERROR: while graphing $PNG_DIR" . $PNG[$e * 5 + 1] . ": $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
RRDs::graph("$PNG_DIR" . $PNGz[$e * 5 + 1],
|
||||
$picz = $rrd{$version}->("$PNG_DIR" . $PNGz[$e * 5 + 1],
|
||||
"--title=$config->{graphs}->{_wowza2} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -725,6 +743,7 @@ sub wowza_cgi {
|
|||
"--width=$width",
|
||||
"--height=$height",
|
||||
@riglim,
|
||||
$zoom,
|
||||
@{$cgi->{version12}},
|
||||
@{$colors->{graph_colors}},
|
||||
"DEF:wms" . $e . "_a0i=$rrd:wms" . $e . "_a0_minbrt:AVERAGE",
|
||||
|
@ -756,7 +775,14 @@ sub wowza_cgi {
|
|||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 1] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 1] . "' border='0'></a>\n");
|
||||
}
|
||||
else {
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 1] . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 1] . "' border='0'></a>\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(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 1] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 1] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 1] . "'>\n");
|
||||
|
@ -787,7 +813,7 @@ sub wowza_cgi {
|
|||
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
|
||||
}
|
||||
($width, $height) = split('x', $config->{graph_size}->{small});
|
||||
RRDs::graph("$PNG_DIR" . $PNG[$e * 5 + 2],
|
||||
$pic = $rrd{$version}->("$PNG_DIR" . $PNG[$e * 5 + 2],
|
||||
"--title=$config->{graphs}->{_wowza3} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -814,7 +840,7 @@ sub wowza_cgi {
|
|||
print("ERROR: while graphing $PNG_DIR" . $PNG[$e * 5 + 2] . ": $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
RRDs::graph("$PNG_DIR" . $PNGz[$e * 5 + 2],
|
||||
$picz = $rrd{$version}->("$PNG_DIR" . $PNGz[$e * 5 + 2],
|
||||
"--title=$config->{graphs}->{_wowza3} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -822,6 +848,7 @@ sub wowza_cgi {
|
|||
"--width=$width",
|
||||
"--height=$height",
|
||||
@riglim,
|
||||
$zoom,
|
||||
@{$cgi->{version12}},
|
||||
@{$cgi->{version12_small}},
|
||||
@{$colors->{graph_colors}},
|
||||
|
@ -846,7 +873,14 @@ sub wowza_cgi {
|
|||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 2] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 2] . "' border='0'></a>\n");
|
||||
}
|
||||
else {
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 2] . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 2] . "' border='0'></a>\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(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 2] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 2] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 2] . "'>\n");
|
||||
|
@ -872,7 +906,7 @@ sub wowza_cgi {
|
|||
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
|
||||
}
|
||||
($width, $height) = split('x', $config->{graph_size}->{small});
|
||||
RRDs::graph("$PNG_DIR" . $PNG[$e * 5 + 3],
|
||||
$pic = $rrd{$version}->("$PNG_DIR" . $PNG[$e * 5 + 3],
|
||||
"--title=$config->{graphs}->{_wowza4} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -899,7 +933,7 @@ sub wowza_cgi {
|
|||
print("ERROR: while graphing $PNG_DIR" . $PNG[$e * 5 + 3] . ": $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
RRDs::graph("$PNG_DIR" . $PNGz[$e * 5 + 3],
|
||||
$picz = $rrd{$version}->("$PNG_DIR" . $PNGz[$e * 5 + 3],
|
||||
"--title=$config->{graphs}->{_wowza4} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -907,6 +941,7 @@ sub wowza_cgi {
|
|||
"--width=$width",
|
||||
"--height=$height",
|
||||
@riglim,
|
||||
$zoom,
|
||||
@{$cgi->{version12}},
|
||||
@{$cgi->{version12_small}},
|
||||
@{$colors->{graph_colors}},
|
||||
|
@ -931,7 +966,14 @@ sub wowza_cgi {
|
|||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 3] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 3] . "' border='0'></a>\n");
|
||||
}
|
||||
else {
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 3] . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 3] . "' border='0'></a>\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(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 3] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 3] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 3] . "'>\n");
|
||||
|
@ -957,7 +999,7 @@ sub wowza_cgi {
|
|||
push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF");
|
||||
}
|
||||
($width, $height) = split('x', $config->{graph_size}->{small});
|
||||
RRDs::graph("$PNG_DIR" . $PNG[$e * 5 + 4],
|
||||
$pic = $rrd{$version}->("$PNG_DIR" . $PNG[$e * 5 + 4],
|
||||
"--title=$config->{graphs}->{_wowza5} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -984,7 +1026,7 @@ sub wowza_cgi {
|
|||
print("ERROR: while graphing $PNG_DIR" . $PNG[$e * 5 + 4] . ": $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
RRDs::graph("$PNG_DIR" . $PNGz[$e * 5 + 4],
|
||||
$picz = $rrd{$version}->("$PNG_DIR" . $PNGz[$e * 5 + 4],
|
||||
"--title=$config->{graphs}->{_wowza5} ($tf->{nwhen}$tf->{twhen})",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"--imgformat=PNG",
|
||||
|
@ -992,6 +1034,7 @@ sub wowza_cgi {
|
|||
"--width=$width",
|
||||
"--height=$height",
|
||||
@riglim,
|
||||
$zoom,
|
||||
@{$cgi->{version12}},
|
||||
@{$cgi->{version12_small}},
|
||||
@{$colors->{graph_colors}},
|
||||
|
@ -1016,7 +1059,14 @@ sub wowza_cgi {
|
|||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 4] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 4] . "' border='0'></a>\n");
|
||||
}
|
||||
else {
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 4] . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 4] . "' border='0'></a>\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(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $PNGz[$e * 5 + 4] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 4] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $PNG[$e * 5 + 4] . "'>\n");
|
||||
|
|
Loading…
Reference in New Issue