mirror of https://github.com/mikaku/Monitorix.git
redirect all the output into an array to support parallelizing in 'process.pm'
This commit is contained in:
parent
98a379fa18
commit
ee17ddbf2b
163
lib/process.pm
163
lib/process.pm
|
@ -1,7 +1,7 @@
|
|||
#
|
||||
# Monitorix - A lightweight system monitoring tool.
|
||||
#
|
||||
# Copyright (C) 2005-2016 by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
# Copyright (C) 2005-2017 by Jordi Sanfeliu <jordi@fibranet.cat>
|
||||
#
|
||||
# This program is free software; you can redistribute it and/or modify
|
||||
# it under the terms of the GNU General Public License as published by
|
||||
|
@ -307,6 +307,7 @@ sub process_update {
|
|||
|
||||
sub process_cgi {
|
||||
my ($package, $config, $cgi) = @_;
|
||||
my @output;
|
||||
|
||||
my $process = $config->{process};
|
||||
my @rigid = split(',', ($process->{rigid} || ""));
|
||||
|
@ -376,20 +377,20 @@ sub process_cgi {
|
|||
#
|
||||
if(lc($config->{iface_mode}) eq "text") {
|
||||
if($title) {
|
||||
main::graph_header($title, 2);
|
||||
print(" <tr>\n");
|
||||
print(" <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
push(@output, main::graph_header($title, 2));
|
||||
push(@output, " <tr>\n");
|
||||
push(@output, " <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
}
|
||||
my (undef, undef, undef, $data) = RRDs::fetch("$rrd",
|
||||
"--start=-$tf->{nwhen}$tf->{twhen}",
|
||||
"AVERAGE",
|
||||
"-r $tf->{res}");
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while fetching $rrd: $err\n") if $err;
|
||||
push(@output, "ERROR: while fetching $rrd: $err\n") if $err;
|
||||
my $line1;
|
||||
my $line2;
|
||||
my $line3;
|
||||
print(" <pre style='font-size: 12px; color: $colors->{fg_color}';>\n");
|
||||
push(@output, " <pre style='font-size: 12px; color: $colors->{fg_color}';>\n");
|
||||
foreach my $pg (sort keys %{$process->{list}}) {
|
||||
my @lp = split(',', $process->{list}->{$pg});
|
||||
for($n = 0; $n < scalar(@lp); $n++) {
|
||||
|
@ -401,9 +402,9 @@ sub process_cgi {
|
|||
$line3 .= "---------------------------------------------------------------";
|
||||
}
|
||||
}
|
||||
print(" $line1\n");
|
||||
print("Time $line2\n");
|
||||
print("-----$line3 \n");
|
||||
push(@output, " $line1\n");
|
||||
push(@output, "Time $line2\n");
|
||||
push(@output, "-----$line3 \n");
|
||||
my $line;
|
||||
my @row;
|
||||
my $time;
|
||||
|
@ -413,7 +414,7 @@ sub process_cgi {
|
|||
$line = @$data[$n];
|
||||
$time = $time - (1 / $tf->{ts});
|
||||
my ($root, $swap) = @$line;
|
||||
printf(" %2d$tf->{tc} ", $time);
|
||||
push(@output, sprintf(" %2d$tf->{tc} ", $time));
|
||||
$e = 0;
|
||||
foreach my $pg (sort keys %{$process->{list}}) {
|
||||
my @lp = split(',', $process->{list}->{$pg});
|
||||
|
@ -432,20 +433,20 @@ sub process_cgi {
|
|||
$pro ||= 0;
|
||||
$nth ||= 0;
|
||||
my $cs = ($vcs || 0) + ($ics || 0) ;
|
||||
printf(" %4.1f%% %6dM %6dM %6dM %7d %7d %7d %7d", $cpu, $mem, $dsk, $net, $nof, $pro, $nth, $cs);
|
||||
push(@output, sprintf(" %4.1f%% %6dM %6dM %6dM %7d %7d %7d %7d", $cpu, $mem, $dsk, $net, $nof, $pro, $nth, $cs));
|
||||
}
|
||||
$e++;
|
||||
}
|
||||
print("\n");
|
||||
push(@output, "\n");
|
||||
}
|
||||
print(" </pre>\n");
|
||||
push(@output, " </pre>\n");
|
||||
if($title) {
|
||||
print(" </td>\n");
|
||||
print(" </tr>\n");
|
||||
main::graph_footer();
|
||||
push(@output, " </td>\n");
|
||||
push(@output, " </tr>\n");
|
||||
push(@output, main::graph_footer());
|
||||
}
|
||||
print(" <br>\n");
|
||||
return;
|
||||
push(@output, " <br>\n");
|
||||
return @output;
|
||||
}
|
||||
|
||||
|
||||
|
@ -478,10 +479,10 @@ sub process_cgi {
|
|||
my @lp = split(',', $process->{list}->{$pg});
|
||||
|
||||
if($e) {
|
||||
print(" <br>\n");
|
||||
push(@output, " <br>\n");
|
||||
}
|
||||
if($title) {
|
||||
main::graph_header($title, 2);
|
||||
push(@output, main::graph_header($title, 2));
|
||||
}
|
||||
|
||||
@riglim = @{setup_riglim($rigid[0], $limit[0])};
|
||||
|
@ -503,8 +504,8 @@ sub process_cgi {
|
|||
}
|
||||
}
|
||||
if($title) {
|
||||
print(" <tr>\n");
|
||||
print(" <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
push(@output, " <tr>\n");
|
||||
push(@output, " <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
}
|
||||
if(lc($config->{show_gaps}) eq "y") {
|
||||
push(@tmp, "AREA:wrongdata#$colors->{gap}:");
|
||||
|
@ -542,7 +543,7 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 10]",
|
||||
|
@ -570,13 +571,13 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10]: $err\n") if $err;
|
||||
}
|
||||
$e2 = $e . "1";
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /process$e2/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
|
@ -585,16 +586,16 @@ sub process_cgi {
|
|||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10] . "'>\n");
|
||||
push(@output, " <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
if($title) {
|
||||
print(" </td>\n");
|
||||
print(" <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
|
||||
push(@output, " </td>\n");
|
||||
push(@output, " <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
|
||||
}
|
||||
@riglim = @{setup_riglim($rigid[1], $limit[1])};
|
||||
undef(@tmp);
|
||||
|
@ -663,7 +664,7 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 1]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 1]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 10 + 1]",
|
||||
|
@ -701,13 +702,13 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 1]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 1]: $err\n") if $err;
|
||||
}
|
||||
$e2 = $e . "2";
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /process$e2/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 1] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 1] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 1] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 1] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
|
@ -716,10 +717,10 @@ sub process_cgi {
|
|||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 1] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 1] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 1] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 1] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 1] . "'>\n");
|
||||
push(@output, " <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 1] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -742,8 +743,8 @@ sub process_cgi {
|
|||
}
|
||||
}
|
||||
if($title) {
|
||||
print(" <tr>\n");
|
||||
print(" <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
push(@output, " <tr>\n");
|
||||
push(@output, " <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
}
|
||||
if(lc($config->{show_gaps}) eq "y") {
|
||||
push(@tmp, "AREA:wrongdata#$colors->{gap}:");
|
||||
|
@ -791,7 +792,7 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 2]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 2]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 10 + 2]",
|
||||
|
@ -829,13 +830,13 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 2]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 2]: $err\n") if $err;
|
||||
}
|
||||
$e2 = $e . "3";
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /process$e2/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 2] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 2] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 2] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 2] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
|
@ -844,16 +845,16 @@ sub process_cgi {
|
|||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 2] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 2] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 2] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 2] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 2] . "'>\n");
|
||||
push(@output, " <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 2] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
if($title) {
|
||||
print(" </td>\n");
|
||||
print(" <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
|
||||
push(@output, " </td>\n");
|
||||
push(@output, " <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
|
||||
}
|
||||
@riglim = @{setup_riglim($rigid[3], $limit[3])};
|
||||
undef(@tmp);
|
||||
|
@ -935,7 +936,7 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 3]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 3]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 10 + 3]",
|
||||
|
@ -963,13 +964,13 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 3]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 3]: $err\n") if $err;
|
||||
}
|
||||
$e2 = $e . "4";
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /process$e2/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 3] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 3] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 3] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 3] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
|
@ -978,10 +979,10 @@ sub process_cgi {
|
|||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 3] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 3] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 3] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 3] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 3] . "'>\n");
|
||||
push(@output, " <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 3] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1004,8 +1005,8 @@ sub process_cgi {
|
|||
}
|
||||
}
|
||||
if($title) {
|
||||
print(" <tr>\n");
|
||||
print(" <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
push(@output, " <tr>\n");
|
||||
push(@output, " <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
}
|
||||
if(lc($config->{show_gaps}) eq "y") {
|
||||
push(@tmp, "AREA:wrongdata#$colors->{gap}:");
|
||||
|
@ -1043,7 +1044,7 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 4]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 4]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 10 + 4]",
|
||||
|
@ -1071,13 +1072,13 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 4]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 4]: $err\n") if $err;
|
||||
}
|
||||
$e2 = $e . "5";
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /process$e2/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 4] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 4] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 4] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 4] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
|
@ -1086,16 +1087,16 @@ sub process_cgi {
|
|||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 4] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 4] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 4] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 4] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 4] . "'>\n");
|
||||
push(@output, " <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 4] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
if($title) {
|
||||
print(" </td>\n");
|
||||
print(" <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
|
||||
push(@output, " </td>\n");
|
||||
push(@output, " <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
|
||||
}
|
||||
@riglim = @{setup_riglim($rigid[5], $limit[5])};
|
||||
undef(@tmp);
|
||||
|
@ -1154,7 +1155,7 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 5]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 5]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 10 + 5]",
|
||||
|
@ -1182,13 +1183,13 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 5]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 5]: $err\n") if $err;
|
||||
}
|
||||
$e2 = $e . "6";
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /process$e2/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 5] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 5] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 5] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 5] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
|
@ -1197,10 +1198,10 @@ sub process_cgi {
|
|||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 5] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 5] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 5] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 5] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 5] . "'>\n");
|
||||
push(@output, " <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 5] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -1225,8 +1226,8 @@ sub process_cgi {
|
|||
}
|
||||
}
|
||||
if($title) {
|
||||
print(" <tr>\n");
|
||||
print(" <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
push(@output, " <tr>\n");
|
||||
push(@output, " <td bgcolor='$colors->{title_bg_color}'>\n");
|
||||
}
|
||||
if(lc($config->{show_gaps}) eq "y") {
|
||||
push(@tmp, "AREA:wrongdata_p#$colors->{gap}:");
|
||||
|
@ -1298,7 +1299,7 @@ sub process_cgi {
|
|||
"CDEF:tcs9=vcs9,ics9,+",
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 6]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 6]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 10 + 6]",
|
||||
|
@ -1357,13 +1358,13 @@ sub process_cgi {
|
|||
"CDEF:tcs9=vcs9,ics9,+",
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 6]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 6]: $err\n") if $err;
|
||||
}
|
||||
$e2 = $e . "7";
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /process$e2/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 6] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 6] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 6] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 6] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
|
@ -1372,16 +1373,16 @@ sub process_cgi {
|
|||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 6] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 6] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 6] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 6] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 6] . "'>\n");
|
||||
push(@output, " <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 6] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
if($title) {
|
||||
print(" </td>\n");
|
||||
print(" <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
|
||||
push(@output, " </td>\n");
|
||||
push(@output, " <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
|
||||
}
|
||||
@riglim = @{setup_riglim($rigid[7], $limit[7])};
|
||||
undef(@tmp);
|
||||
|
@ -1440,7 +1441,7 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmp);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 7]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMG[$e * 10 + 7]: $err\n") if $err;
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
($width, $height) = split('x', $config->{graph_size}->{zoom});
|
||||
$picz = $rrd{$version}->("$IMG_DIR" . "$IMGz[$e * 10 + 7]",
|
||||
|
@ -1468,13 +1469,13 @@ sub process_cgi {
|
|||
@CDEF,
|
||||
@tmpz);
|
||||
$err = RRDs::error;
|
||||
print("ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 7]: $err\n") if $err;
|
||||
push(@output, "ERROR: while graphing $IMG_DIR" . "$IMGz[$e * 10 + 7]: $err\n") if $err;
|
||||
}
|
||||
$e2 = $e . "8";
|
||||
if($title || ($silent =~ /imagetag/ && $graph =~ /process$e2/)) {
|
||||
if(lc($config->{enable_zoom}) eq "y") {
|
||||
if(lc($config->{disable_javascript_void}) eq "y") {
|
||||
print(" <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 7] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 7] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 7] . "\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 7] . "' border='0'></a>\n");
|
||||
} else {
|
||||
if($version eq "new") {
|
||||
$picz_width = $picz->{image_width} * $config->{global_zoom};
|
||||
|
@ -1483,22 +1484,22 @@ sub process_cgi {
|
|||
$picz_width = $width + 115;
|
||||
$picz_height = $height + 100;
|
||||
}
|
||||
print(" <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 7] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 7] . "' border='0'></a>\n");
|
||||
push(@output, " <a href=\"javascript:void(window.open('" . $config->{url} . "/" . $config->{imgs_dir} . $IMGz[$e * 10 + 7] . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 7] . "' border='0'></a>\n");
|
||||
}
|
||||
} else {
|
||||
print(" <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 7] . "'>\n");
|
||||
push(@output, " <img src='" . $config->{url} . "/" . $config->{imgs_dir} . $IMG[$e * 10 + 7] . "'>\n");
|
||||
}
|
||||
}
|
||||
|
||||
if($title) {
|
||||
print(" </td>\n");
|
||||
print(" </tr>\n");
|
||||
main::graph_footer();
|
||||
push(@output, " </td>\n");
|
||||
push(@output, " </tr>\n");
|
||||
push(@output, main::graph_footer());
|
||||
}
|
||||
$e++;
|
||||
}
|
||||
print(" <br>\n");
|
||||
return;
|
||||
push(@output, " <br>\n");
|
||||
return @output;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
Loading…
Reference in New Issue