mirror of https://github.com/mikaku/Monitorix.git
1464 lines
49 KiB
Perl
1464 lines
49 KiB
Perl
#
|
|
# Monitorix - A lightweight system monitoring tool.
|
|
#
|
|
# Copyright (C) 2005-2013 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
|
|
# the Free Software Foundation; either version 2 of the License, or
|
|
# (at your option) any later version.
|
|
#
|
|
# This program is distributed in the hope that it will be useful,
|
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
# GNU General Public License for more details.
|
|
#
|
|
# You should have received a copy of the GNU General Public License along
|
|
# with this program; if not, write to the Free Software Foundation, Inc.,
|
|
# 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
|
|
#
|
|
|
|
package squid;
|
|
|
|
use strict;
|
|
use warnings;
|
|
use Monitorix;
|
|
use RRDs;
|
|
use Exporter 'import';
|
|
our @EXPORT = qw(squid_init squid_update squid_cgi);
|
|
|
|
sub squid_init {
|
|
my $myself = (caller(0))[3];
|
|
my ($package, $config, $debug) = @_;
|
|
my $rrd = $config->{base_lib} . $package . ".rrd";
|
|
|
|
if(!(-e $rrd)) {
|
|
logger("Creating '$rrd' file.");
|
|
eval {
|
|
RRDs::create($rrd,
|
|
"--step=60",
|
|
"DS:squid_g1_1:GAUGE:120:0:U",
|
|
"DS:squid_g1_2:GAUGE:120:0:U",
|
|
"DS:squid_g1_3:GAUGE:120:0:U",
|
|
"DS:squid_g1_4:GAUGE:120:0:U",
|
|
"DS:squid_g1_5:GAUGE:120:0:U",
|
|
"DS:squid_g1_6:GAUGE:120:0:U",
|
|
"DS:squid_g1_7:GAUGE:120:0:U",
|
|
"DS:squid_g1_8:GAUGE:120:0:U",
|
|
"DS:squid_g1_9:GAUGE:120:0:U",
|
|
"DS:squid_g2_1:GAUGE:120:0:U",
|
|
"DS:squid_g2_2:GAUGE:120:0:U",
|
|
"DS:squid_g2_3:GAUGE:120:0:U",
|
|
"DS:squid_g2_4:GAUGE:120:0:U",
|
|
"DS:squid_g2_5:GAUGE:120:0:U",
|
|
"DS:squid_g2_6:GAUGE:120:0:U",
|
|
"DS:squid_g2_7:GAUGE:120:0:U",
|
|
"DS:squid_g2_8:GAUGE:120:0:U",
|
|
"DS:squid_g2_9:GAUGE:120:0:U",
|
|
"DS:squid_rq_1:GAUGE:120:0:U",
|
|
"DS:squid_rq_2:GAUGE:120:0:U",
|
|
"DS:squid_rq_3:GAUGE:120:0:U",
|
|
"DS:squid_rq_4:GAUGE:120:0:U",
|
|
"DS:squid_rq_5:GAUGE:120:0:U",
|
|
"DS:squid_rq_6:GAUGE:120:0:U",
|
|
"DS:squid_rq_7:GAUGE:120:0:U",
|
|
"DS:squid_rq_8:GAUGE:120:0:U",
|
|
"DS:squid_rq_9:GAUGE:120:0:U",
|
|
"DS:squid_m_1:GAUGE:120:0:U",
|
|
"DS:squid_m_2:GAUGE:120:0:U",
|
|
"DS:squid_m_3:GAUGE:120:0:U",
|
|
"DS:squid_m_4:GAUGE:120:0:U",
|
|
"DS:squid_m_5:GAUGE:120:0:U",
|
|
"DS:squid_ic_1:GAUGE:120:0:U",
|
|
"DS:squid_ic_2:GAUGE:120:0:U",
|
|
"DS:squid_ic_3:GAUGE:120:0:U",
|
|
"DS:squid_ic_4:GAUGE:120:0:U",
|
|
"DS:squid_ic_5:GAUGE:120:0:U",
|
|
"DS:squid_io_1:GAUGE:120:0:U",
|
|
"DS:squid_io_2:GAUGE:120:0:U",
|
|
"DS:squid_io_3:GAUGE:120:0:U",
|
|
"DS:squid_io_4:GAUGE:120:0:U",
|
|
"DS:squid_io_5:GAUGE:120:0:U",
|
|
"DS:squid_s_1:GAUGE:120:0:U",
|
|
"DS:squid_s_2:GAUGE:120:0:U",
|
|
"DS:squid_s_3:GAUGE:120:0:U",
|
|
"DS:squid_s_4:GAUGE:120:0:U",
|
|
"DS:squid_s_5:GAUGE:120:0:U",
|
|
"DS:squid_tc_1:GAUGE:120:0:U",
|
|
"DS:squid_tc_2:GAUGE:120:0:U",
|
|
"DS:squid_tc_3:GAUGE:120:0:U",
|
|
"DS:squid_ts_1:GAUGE:120:0:U",
|
|
"DS:squid_ts_2:GAUGE:120:0:U",
|
|
"DS:squid_ts_3:GAUGE:120:0:U",
|
|
"RRA:AVERAGE:0.5:1:1440",
|
|
"RRA:AVERAGE:0.5:30:336",
|
|
"RRA:AVERAGE:0.5:60:744",
|
|
"RRA:AVERAGE:0.5:1440:365",
|
|
"RRA:MIN:0.5:1:1440",
|
|
"RRA:MIN:0.5:30:336",
|
|
"RRA:MIN:0.5:60:744",
|
|
"RRA:MIN:0.5:1440:365",
|
|
"RRA:MAX:0.5:1:1440",
|
|
"RRA:MAX:0.5:30:336",
|
|
"RRA:MAX:0.5:60:744",
|
|
"RRA:MAX:0.5:1440:365",
|
|
"RRA:LAST:0.5:1:1440",
|
|
"RRA:LAST:0.5:30:336",
|
|
"RRA:LAST:0.5:60:744",
|
|
"RRA:LAST:0.5:1440:365",
|
|
);
|
|
};
|
|
my $err = RRDs::error;
|
|
if($@ || $err) {
|
|
logger("$@") unless !$@;
|
|
if($err) {
|
|
logger("ERROR: while creating $rrd: $err");
|
|
if($err eq "RRDs::error") {
|
|
logger("... is the RRDtool Perl package installed?");
|
|
}
|
|
}
|
|
return;
|
|
}
|
|
}
|
|
|
|
$config->{squid_hist} = ();
|
|
push(@{$config->{func_update}}, $package);
|
|
logger("$myself: Ok") if $debug;
|
|
}
|
|
|
|
sub squid_update {
|
|
my $myself = (caller(0))[3];
|
|
my ($package, $config, $debug) = @_;
|
|
my $rrd = $config->{base_lib} . $package . ".rrd";
|
|
my $squid = $config->{squid};
|
|
|
|
my %g12 = ();
|
|
my $seek_pos;
|
|
my $logsize;
|
|
my @data;
|
|
my $all;
|
|
my $value;
|
|
my $g_result;
|
|
my $g_status;
|
|
|
|
my $rq_client_http_req;
|
|
my $rq_client_http_hit;
|
|
my $rq_server_http_req;
|
|
my $rq_server_ftp_req;
|
|
my $rq_server_other_req;
|
|
my $rq_aborted_req;
|
|
my $rq_swap_files_cleaned;
|
|
my $rq_unlink_requests;
|
|
|
|
my $tc_client_http_in;
|
|
my $tc_client_http_out;
|
|
my $ts_server_all_in;
|
|
my $ts_server_all_out;
|
|
|
|
my $m_alloc;
|
|
my $m_inuse;
|
|
|
|
my $ic_requests;
|
|
my $ic_hits;
|
|
my $ic_misses;
|
|
|
|
my $io_http;
|
|
my $io_ftp;
|
|
my $io_gopher;
|
|
my $io_wais;
|
|
|
|
my $s_entries;
|
|
my $s_maximum;
|
|
my $s_current;
|
|
|
|
my $n;
|
|
my $rrdata = "N";
|
|
|
|
$seek_pos = $config->{squid_hist}->{'seek_pos'} || 0;
|
|
open(IN, $config->{squid_log});
|
|
if(!seek(IN, 0, 2)) {
|
|
logger("Couldn't seek to the end ($config->{squid_log}): $!");
|
|
return;
|
|
}
|
|
$logsize = tell(IN);
|
|
if($logsize < $seek_pos) {
|
|
$seek_pos = 0;
|
|
}
|
|
if(!seek(IN, $seek_pos, 0)) {
|
|
logger("Couldn't seek to $seek_pos ($config->{squid_log}): $!");
|
|
return;
|
|
}
|
|
if(defined($config->{squid_hist}->{'seek_pos'})) { # avoid initial spike
|
|
while(<IN>) {
|
|
(undef, undef, undef, $value) = split(' ', $_);
|
|
($g_result, $g_status) = split('/', $value);
|
|
$g12{$g_result}++;
|
|
$g12{$g_status}++;
|
|
}
|
|
}
|
|
close(IN);
|
|
foreach my $code (my @sl = split(',', $squid->{graph_0})) {
|
|
$code = trim($code);
|
|
$rrdata .= ":";
|
|
$rrdata .= defined($g12{$code}) ? int($g12{$code}) : 0;
|
|
}
|
|
foreach my $code (my @sl = split(',', $squid->{graph_1})) {
|
|
$code = trim($code);
|
|
$rrdata .= ":";
|
|
$rrdata .= defined($g12{$code}) ? int($g12{$code}) : 0;
|
|
}
|
|
$config->{squid_hist}->{'seek_pos'} = $logsize;
|
|
|
|
open(IN, "$squid->{cmd} mgr:counters |");
|
|
while(<IN>) {
|
|
if(/^client_http\.requests = (\d+)$/) {
|
|
$rq_client_http_req = $1 - ($config->{squid_hist}->{'rq_client_http_req'} || 0);
|
|
$rq_client_http_req = 0 unless $rq_client_http_req != $1;
|
|
$rq_client_http_req /= 60;
|
|
$config->{squid_hist}->{'rq_client_http_req'} = $1;
|
|
next;
|
|
}
|
|
if(/^client_http\.hits = (\d+)$/) {
|
|
$rq_client_http_hit = $1 - ($config->{squid_hist}->{'rq_client_http_hit'} || 0);
|
|
$rq_client_http_hit = 0 unless $rq_client_http_hit != $1;
|
|
$rq_client_http_hit /= 60;
|
|
$config->{squid_hist}->{'rq_client_http_hit'} = $1;
|
|
next;
|
|
}
|
|
if(/^client_http\.kbytes_in = (\d+)$/) {
|
|
$tc_client_http_in = $1 - ($config->{squid_hist}->{'tc_client_http_in'} || 0);
|
|
$tc_client_http_in = 0 unless $tc_client_http_in != $1;
|
|
$tc_client_http_in *= 1024;
|
|
$tc_client_http_in /= 60;
|
|
$config->{squid_hist}->{'tc_client_http_in'} = $1;
|
|
next;
|
|
}
|
|
if(/^client_http\.kbytes_out = (\d+)$/) {
|
|
$tc_client_http_out = $1 - ($config->{squid_hist}->{'tc_client_http_out'} || 0);
|
|
$tc_client_http_out = 0 unless $tc_client_http_out != $1;
|
|
$tc_client_http_out *= 1024;
|
|
$tc_client_http_out /= 60;
|
|
$config->{squid_hist}->{'tc_client_http_out'} = $1;
|
|
next;
|
|
}
|
|
if(/^server\.all\.kbytes_in = (\d+)$/) {
|
|
$ts_server_all_in = $1 - ($config->{squid_hist}->{'ts_server_all_in'} || 0);
|
|
$ts_server_all_in = 0 unless $ts_server_all_in != $1;
|
|
$ts_server_all_in *= 1024;
|
|
$ts_server_all_in /= 60;
|
|
$config->{squid_hist}->{'ts_server_all_in'} = $1;
|
|
next;
|
|
}
|
|
if(/^server\.all\.kbytes_out = (\d+)$/) {
|
|
$ts_server_all_out = $1 - ($config->{squid_hist}->{'ts_server_all_out'} || 0);
|
|
$ts_server_all_out = 0 unless $ts_server_all_out != $1;
|
|
$ts_server_all_out *= 1024;
|
|
$ts_server_all_out /= 60;
|
|
$config->{squid_hist}->{'ts_server_all_out'} = $1;
|
|
next;
|
|
}
|
|
if(/^server\.http\.requests = (\d+)$/) {
|
|
$rq_server_http_req = $1 - ($config->{squid_hist}->{'rq_server_http_req'} || 0);
|
|
$rq_server_http_req = 0 unless $rq_server_http_req != $1;
|
|
$rq_server_http_req /= 60;
|
|
$config->{squid_hist}->{'rq_server_http_req'} = $1;
|
|
next;
|
|
}
|
|
if(/^server\.ftp\.requests = (\d+)$/) {
|
|
$rq_server_ftp_req = $1 - ($config->{squid_hist}->{'rq_server_ftp_req'} || 0);
|
|
$rq_server_ftp_req = 0 unless $rq_server_ftp_req != $1;
|
|
$rq_server_ftp_req /= 60;
|
|
$config->{squid_hist}->{'rq_server_ftp_req'} = $1;
|
|
next;
|
|
}
|
|
if(/^server\.other\.requests = (\d+)$/) {
|
|
$rq_server_other_req = $1 - ($config->{squid_hist}->{'rq_server_other_req'} || 0);
|
|
$rq_server_other_req = 0 unless $rq_server_other_req != $1;
|
|
$rq_server_other_req /= 60;
|
|
$config->{squid_hist}->{'rq_server_other_req'} = $1;
|
|
next;
|
|
}
|
|
if(/^unlink\.requests = (\d+)$/) {
|
|
$rq_unlink_requests = $1 - ($config->{squid_hist}->{'rq_unlink_requests'} || 0);
|
|
$rq_unlink_requests = 0 unless $rq_unlink_requests != $1;
|
|
$rq_unlink_requests /= 60;
|
|
$config->{squid_hist}->{'rq_unlink_requests'} = $1;
|
|
next;
|
|
}
|
|
if(/^swap\.files_cleaned = (\d+)$/) {
|
|
$rq_swap_files_cleaned = $1 - ($config->{squid_hist}->{'rq_swap_files_cleaned'} || 0);
|
|
$rq_swap_files_cleaned = 0 unless $rq_swap_files_cleaned != $1;
|
|
$rq_swap_files_cleaned /= 60;
|
|
$config->{squid_hist}->{'rq_swap_files_cleaned'} = $1;
|
|
next;
|
|
}
|
|
if(/^aborted_requests = (\d+)$/) {
|
|
$rq_aborted_req = $1 - ($config->{squid_hist}->{'rq_aborted_req'} || 0);
|
|
$rq_aborted_req = 0 unless $rq_aborted_req != $1;
|
|
$rq_aborted_req /= 60;
|
|
$config->{squid_hist}->{'rq_aborted_req'} = $1;
|
|
last;
|
|
}
|
|
}
|
|
close(IN);
|
|
$rrdata .= ":$rq_client_http_req:$rq_client_http_hit:$rq_server_http_req:$rq_server_ftp_req:$rq_server_other_req:$rq_aborted_req:$rq_swap_files_cleaned:$rq_unlink_requests:0";
|
|
|
|
open(IN, "$squid->{cmd} mgr:mem |");
|
|
while(<IN>) {
|
|
if(/^Total /) {
|
|
(undef, undef, $m_alloc, undef, undef, undef, undef, $m_inuse) = split(' ', $_);
|
|
chomp($m_alloc);
|
|
chomp($m_inuse);
|
|
last;
|
|
}
|
|
}
|
|
close(IN);
|
|
$rrdata .= ":$m_alloc:$m_inuse:0:0:0";
|
|
|
|
open(IN, "$squid->{cmd} mgr:ipcache |");
|
|
while(<IN>) {
|
|
if(/^IPcache Requests:\s+(\d+)$/) {
|
|
$ic_requests = $1 - ($config->{squid_hist}->{'ic_requests'} || 0);
|
|
$ic_requests = 0 unless $ic_requests != $1;
|
|
$ic_requests /= 60;
|
|
$config->{squid_hist}->{'ic_requests'} = $1;
|
|
next;
|
|
}
|
|
if(/^IPcache Hits:\s+(\d+)$/) {
|
|
$ic_hits = $1 - ($config->{squid_hist}->{'ic_hits'} || 0);
|
|
$ic_hits = 0 unless $ic_hits != $1;
|
|
$ic_hits /= 60;
|
|
$config->{squid_hist}->{'ic_hits'} = $1;
|
|
next;
|
|
}
|
|
if(/^IPcache Misses:\s+(\d+)$/) {
|
|
$ic_misses = $1 - ($config->{squid_hist}->{'ic_misses'} || 0);
|
|
$ic_misses = 0 unless $ic_misses != $1;
|
|
$ic_misses /= 60;
|
|
$config->{squid_hist}->{'ic_misses'} = $1;
|
|
last;
|
|
}
|
|
}
|
|
close(IN);
|
|
$rrdata .= ":$ic_requests:$ic_hits:$ic_misses:0:0";
|
|
|
|
open(IN, "$squid->{cmd} mgr:io |");
|
|
@data = <IN>;
|
|
close(IN);
|
|
$all = join('', @data);
|
|
$all =~ s/\n/ /g;
|
|
($value) = ($all =~ m/ HTTP I\/O number of reads.*?(\d+)/g);
|
|
chomp($value);
|
|
$io_http = $value - ($config->{squid_hist}->{'io_http'} || 0);
|
|
$io_http = 0 unless $io_http != $value;
|
|
$io_http /= 60;
|
|
$config->{squid_hist}->{'io_http'} = $value;
|
|
($value) = ($all =~ m/ FTP I\/O number of reads.*?(\d+)/g);
|
|
chomp($value);
|
|
$io_ftp = $value - ($config->{squid_hist}->{'io_ftp'} || 0);
|
|
$io_ftp = 0 unless $io_ftp != $value;
|
|
$io_ftp /= 60;
|
|
$config->{squid_hist}->{'io_ftp'} = $value;
|
|
($value) = ($all =~ m/ Gopher I\/O number of reads.*?(\d+)/g);
|
|
chomp($value);
|
|
$io_gopher = $value - ($config->{squid_hist}->{'io_gopher'} || 0);
|
|
$io_gopher = 0 unless $io_gopher != $value;
|
|
$io_gopher /= 60;
|
|
$config->{squid_hist}->{'io_gopher'} = $value;
|
|
($value) = ($all =~ m/ WAIS I\/O number of reads.*?(\d+)/g);
|
|
$value = 0 unless defined($value);
|
|
chomp($value);
|
|
$io_wais = $value - ($config->{squid_hist}->{'io_wais'} || 0);
|
|
$io_wais = 0 unless $io_wais != $value;
|
|
$io_wais /= 60;
|
|
$config->{squid_hist}->{'io_wais'} = $value;
|
|
$rrdata .= ":$io_http:$io_ftp:$io_gopher:$io_wais:0";
|
|
|
|
open(IN, "$squid->{cmd} mgr:storedir |");
|
|
while(<IN>) {
|
|
if(/^Store Entries\s+:\s+(\d+)$/) {
|
|
$s_entries = $1;
|
|
next;
|
|
}
|
|
if(/^Maximum Swap Size\s+:\s+(\d+)/) {
|
|
$s_maximum = $1;
|
|
next;
|
|
}
|
|
if(/^Current Store Swap Size\s*:\s+(\d+)/) {
|
|
$s_current = $1;
|
|
last;
|
|
}
|
|
}
|
|
close(IN);
|
|
$rrdata .= ":$s_entries:$s_maximum:$s_current:0:0";
|
|
$rrdata .= ":$tc_client_http_in:$tc_client_http_out:0";
|
|
$rrdata .= ":$ts_server_all_in:$ts_server_all_out:0";
|
|
RRDs::update($rrd, $rrdata);
|
|
logger("$myself: $rrdata") if $debug;
|
|
my $err = RRDs::error;
|
|
logger("ERROR: while updating $rrd: $err") if $err;
|
|
}
|
|
|
|
sub squid_cgi {
|
|
my ($package, $config, $cgi) = @_;
|
|
|
|
my $squid = $config->{squid};
|
|
my @rigid = split(',', $squid->{rigid});
|
|
my @limit = split(',', $squid->{limit});
|
|
my $tf = $cgi->{tf};
|
|
my $colors = $cgi->{colors};
|
|
my $graph = $cgi->{graph};
|
|
my $silent = $cgi->{silent};
|
|
|
|
my $u = "";
|
|
my $width;
|
|
my $height;
|
|
my @riglim;
|
|
my @tmp;
|
|
my @tmpz;
|
|
my $i;
|
|
my @DEF;
|
|
my $n;
|
|
my $str;
|
|
my $err;
|
|
my @AC = (
|
|
"#FFA500",
|
|
"#44EEEE",
|
|
"#44EE44",
|
|
"#4444EE",
|
|
"#448844",
|
|
"#EE4444",
|
|
"#EE44EE",
|
|
"#EEEE44",
|
|
"#963C74",
|
|
"#CCCCCC",
|
|
);
|
|
my @LC = (
|
|
"#FFA500",
|
|
"#00EEEE",
|
|
"#00EE00",
|
|
"#0000EE",
|
|
"#448844",
|
|
"#EE0000",
|
|
"#EE00EE",
|
|
"#EEEE00",
|
|
"#B4B444",
|
|
"#888888",
|
|
);
|
|
|
|
my $rrd = $config->{base_lib} . $package . ".rrd";
|
|
my $title = $config->{graph_title}->{$package};
|
|
my $PNG_DIR = $config->{base_dir} . "/" . $config->{imgs_dir};
|
|
|
|
$title = !$silent ? $title : "";
|
|
|
|
|
|
# text mode
|
|
#
|
|
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");
|
|
}
|
|
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;
|
|
my $str;
|
|
my $line1;
|
|
my $line2;
|
|
my $line3;
|
|
print(" <pre style='font-size: 12px; color: $colors->{fg_color}';>\n");
|
|
for($n = 0; $n < scalar(my @sl = split(',', $squid->{graph_0})); $n++) {
|
|
$line2 .= sprintf("%6d", $n + 1);
|
|
$str .= "------";
|
|
}
|
|
$line3 .= $str;
|
|
$i = length($str);
|
|
$line1 .= sprintf(" %${i}s", "Statistics graph 1");
|
|
undef($str);
|
|
$line2 .= " ";
|
|
$line3 .= "-";
|
|
for($n = 0; $n < scalar(my @sl = split(',', $squid->{graph_1})); $n++) {
|
|
$line2 .= sprintf("%6d", $n + 1);
|
|
$str .= "------";
|
|
}
|
|
$line3 .= $str;
|
|
$i = length($str);
|
|
$line1 .= sprintf(" %${i}s", "Statistics graph 2");
|
|
$line1 .= " Overall I/O";
|
|
$line2 .= " cHTTPr cHTTPh sHTTPr sFTPr sOther Abortr SwpFcl Unlnkr";
|
|
$line3 .= "---------------------------------------------------------";
|
|
$line1 .= " Memory usage (MB)";
|
|
$line2 .= " Alloct InUse % ";
|
|
$line3 .= "----------------------";
|
|
$line1 .= " Storage usage (MB)";
|
|
$line2 .= " Alloct InUse % ";
|
|
$line3 .= "------------------------";
|
|
$line1 .= " IP Cache";
|
|
$line2 .= " Reqs Hits Miss";
|
|
$line3 .= "----------------";
|
|
$line1 .= " Network Protocols";
|
|
$line2 .= " HTTP FTP Goph WAIS";
|
|
$line3 .= "---------------------";
|
|
$line1 .= " Client Traffic";
|
|
$line2 .= " Input Output";
|
|
$line3 .= "----------------";
|
|
$line1 .= " Server Traffic";
|
|
$line2 .= " Input Output";
|
|
$line3 .= "----------------";
|
|
print(" $line1\n");
|
|
print("Time $line2\n");
|
|
print("-----$line3 \n");
|
|
my $line;
|
|
my @row;
|
|
my $time;
|
|
my @g1;
|
|
my @g2;
|
|
my $n2;
|
|
for($n = 0, $time = $tf->{tb}; $n < ($tf->{tb} * $tf->{ts}); $n++) {
|
|
$line = @$data[$n];
|
|
undef($line1);
|
|
undef(@row);
|
|
(@g1) = @$line[0..scalar(my @sg0 = split(',', $squid->{graph_0})) - 1];
|
|
for($n2 = 0; $n2 < scalar(@sg0); $n2++) {
|
|
push(@row, $g1[$n2] || 0);
|
|
$line1 .= "%5d ";
|
|
}
|
|
(@g2) = @$line[9..9 + scalar(my @sg1 = split(',', $squid->{graph_1})) - 1];
|
|
$line1 .= " ";
|
|
for($n2 = 0; $n2 < scalar(@sg1); $n2++) {
|
|
push(@row, $g2[$n2] || 0);
|
|
$line1 .= "%5d ";
|
|
}
|
|
$line1 .= " ";
|
|
foreach(@$line[18..25]) {
|
|
push(@row, $_ || 0);
|
|
}
|
|
$line1 .= "%6d %6d %6d %6d %6d %6d %6d %6d ";
|
|
$line1 .= " ";
|
|
foreach(@$line[27..28]) {
|
|
push(@row, $_ || 0);
|
|
}
|
|
@$line[28] = @$line[28] || 0;
|
|
push(@row, (@$line[28] * 100) / (@$line[27] || 1));
|
|
$line1 .= "%7d %7d %3.1f ";
|
|
$line1 .= " ";
|
|
foreach(@$line[43..44]) {
|
|
push(@row, $_ || 0);
|
|
}
|
|
@$line[44] = @$line[44] || 0;
|
|
push(@row, (@$line[44] * 100) / (@$line[43] || 1));
|
|
$line1 .= "%8d %8d %3.1f ";
|
|
$line1 .= " ";
|
|
foreach(@$line[32..34]) {
|
|
push(@row, $_ || 0);
|
|
}
|
|
$line1 .= "%4d %4d %4d ";
|
|
$line1 .= " ";
|
|
foreach(@$line[37..40]) {
|
|
push(@row, $_ || 0);
|
|
}
|
|
$line1 .= "%4d %4d %4d %4d ";
|
|
$line1 .= " ";
|
|
foreach(@$line[47..48]) {
|
|
push(@row, $_ || 0);
|
|
}
|
|
$line1 .= " %6d %6d ";
|
|
$line1 .= " ";
|
|
foreach(@$line[50..51]) {
|
|
push(@row, $_ || 0);
|
|
}
|
|
$line1 .= " %6d %6d ";
|
|
$time = $time - (1 / $tf->{ts});
|
|
printf(" %2d$tf->{tc} $line1\n", $time, @row);
|
|
}
|
|
print(" </pre>\n");
|
|
if($title) {
|
|
print(" </td>\n");
|
|
print(" </tr>\n");
|
|
main::graph_footer();
|
|
}
|
|
print(" <br>\n");
|
|
return;
|
|
}
|
|
|
|
|
|
# graph mode
|
|
#
|
|
if($silent eq "yes" || $silent eq "imagetag") {
|
|
$colors->{fg_color} = "#000000"; # visible color for text mode
|
|
$u = "_";
|
|
}
|
|
if($silent eq "imagetagbig") {
|
|
$colors->{fg_color} = "#000000"; # visible color for text mode
|
|
$u = "";
|
|
}
|
|
my $PNG1 = $u . $package . "1." . $tf->{when} . ".png";
|
|
my $PNG2 = $u . $package . "2." . $tf->{when} . ".png";
|
|
my $PNG3 = $u . $package . "3." . $tf->{when} . ".png";
|
|
my $PNG4 = $u . $package . "4." . $tf->{when} . ".png";
|
|
my $PNG5 = $u . $package . "5." . $tf->{when} . ".png";
|
|
my $PNG6 = $u . $package . "6." . $tf->{when} . ".png";
|
|
my $PNG7 = $u . $package . "7." . $tf->{when} . ".png";
|
|
my $PNG8 = $u . $package . "8." . $tf->{when} . ".png";
|
|
my $PNG9 = $u . $package . "9." . $tf->{when} . ".png";
|
|
my $PNG1z = $u . $package . "1z." . $tf->{when} . ".png";
|
|
my $PNG2z = $u . $package . "2z." . $tf->{when} . ".png";
|
|
my $PNG3z = $u . $package . "3z." . $tf->{when} . ".png";
|
|
my $PNG4z = $u . $package . "4z." . $tf->{when} . ".png";
|
|
my $PNG5z = $u . $package . "5z." . $tf->{when} . ".png";
|
|
my $PNG6z = $u . $package . "6z." . $tf->{when} . ".png";
|
|
my $PNG7z = $u . $package . "7z." . $tf->{when} . ".png";
|
|
my $PNG8z = $u . $package . "8z." . $tf->{when} . ".png";
|
|
my $PNG9z = $u . $package . "9z." . $tf->{when} . ".png";
|
|
unlink ("$PNG_DIR" . "$PNG1",
|
|
"$PNG_DIR" . "$PNG2",
|
|
"$PNG_DIR" . "$PNG3",
|
|
"$PNG_DIR" . "$PNG4",
|
|
"$PNG_DIR" . "$PNG5",
|
|
"$PNG_DIR" . "$PNG6",
|
|
"$PNG_DIR" . "$PNG7",
|
|
"$PNG_DIR" . "$PNG8",
|
|
"$PNG_DIR" . "$PNG9");
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
unlink ("$PNG_DIR" . "$PNG1z",
|
|
"$PNG_DIR" . "$PNG2z",
|
|
"$PNG_DIR" . "$PNG3z",
|
|
"$PNG_DIR" . "$PNG4z",
|
|
"$PNG_DIR" . "$PNG5z",
|
|
"$PNG_DIR" . "$PNG6z",
|
|
"$PNG_DIR" . "$PNG7z",
|
|
"$PNG_DIR" . "$PNG8z",
|
|
"$PNG_DIR" . "$PNG9z");
|
|
}
|
|
if($title) {
|
|
main::graph_header($title, 2);
|
|
}
|
|
if(trim($rigid[0]) eq 1) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[0]));
|
|
} else {
|
|
if(trim($rigid[0]) eq 2) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[0]));
|
|
push(@riglim, "--rigid");
|
|
}
|
|
}
|
|
if($title) {
|
|
print(" <tr>\n");
|
|
print(" <td valign='top' bgcolor='$colors->{title_bg_color}'>\n");
|
|
}
|
|
my @sg0 = split(',', $squid->{graph_0});
|
|
for($n = 0, $i = 1; $n < 9; $n++, $i++) {
|
|
if(trim($sg0[$n])) {
|
|
$str = sprintf("%-34s", trim($sg0[$n]));
|
|
$str = substr($str, 0, 23);
|
|
push(@DEF, "DEF:squid_g1_$i=$rrd:squid_g1_$i:AVERAGE");
|
|
push(@tmp, "LINE1:squid_g1_$i$AC[$n]:$str");
|
|
push(@tmp, "GPRINT:squid_g1_$i:LAST:Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_g1_$i:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_g1_$i:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_g1_$i:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmpz, "LINE2:squid_g1_$i$AC[$n]:" . trim($sg0[$n]));
|
|
} else {
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
}
|
|
($width, $height) = split('x', $config->{graph_size}->{main});
|
|
if($silent =~ /imagetag/) {
|
|
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
|
|
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
|
|
@tmp = @tmpz;
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
RRDs::graph("$PNG_DIR" . "$PNG1",
|
|
"--title=$config->{graphs}->{_squid1} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Values/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$colors->{graph_colors}},
|
|
@DEF,
|
|
@tmp);
|
|
$err = RRDs::error;
|
|
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",
|
|
"--title=$config->{graphs}->{_squid1} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Values/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$colors->{graph_colors}},
|
|
@DEF,
|
|
@tmpz);
|
|
$err = RRDs::error;
|
|
print("ERROR: while graphing $PNG_DIR" . "$PNG1z: $err\n") if $err;
|
|
}
|
|
if($title || ($silent =~ /imagetag/ && $graph =~ /squid1/)) {
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
if(lc($config->{disable_javascript_void}) eq "y") {
|
|
print(" <a href=\"" . $config->{url} . $config->{imgs_dir} . $PNG1z . "\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG1 . "' border='0'></a>\n");
|
|
}
|
|
else {
|
|
print(" <a href=\"javascript:void(window.open('" . $config->{url} . $config->{imgs_dir} . $PNG1z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG1 . "' border='0'></a>\n");
|
|
}
|
|
} else {
|
|
print(" <img src='" . $config->{url} . $config->{imgs_dir} . $PNG1 . "'>\n");
|
|
}
|
|
}
|
|
|
|
undef(@riglim);
|
|
if(trim($rigid[1]) eq 1) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[1]));
|
|
} else {
|
|
if(trim($rigid[1]) eq 2) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[1]));
|
|
push(@riglim, "--rigid");
|
|
}
|
|
}
|
|
undef(@tmp);
|
|
undef(@tmpz);
|
|
undef(@DEF);
|
|
my @sg1 = split(',', $squid->{graph_1});
|
|
for($n = 0, $i = 1; $n < 9; $n++, $i++) {
|
|
if(trim($sg1[$n])) {
|
|
$str = sprintf("%-34s", trim($sg1[$n]));
|
|
$str = substr($str, 0, 23);
|
|
push(@DEF, "DEF:squid_g2_$i=$rrd:squid_g2_$i:AVERAGE");
|
|
push(@tmp, "LINE1:squid_g2_$i$AC[$n]:$str");
|
|
push(@tmp, "GPRINT:squid_g2_$i:LAST:Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_g2_$i:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_g2_$i:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_g2_$i:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmpz, "LINE2:squid_g2_$i$AC[$n]:" . trim($sg1[$n]));
|
|
} else {
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
}
|
|
($width, $height) = split('x', $config->{graph_size}->{main});
|
|
if($silent =~ /imagetag/) {
|
|
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
|
|
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
|
|
@tmp = @tmpz;
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
RRDs::graph("$PNG_DIR" . "$PNG2",
|
|
"--title=$config->{graphs}->{_squid2} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Values/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$colors->{graph_colors}},
|
|
@DEF,
|
|
@tmp);
|
|
$err = RRDs::error;
|
|
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",
|
|
"--title=$config->{graphs}->{_squid2} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Values/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$colors->{graph_colors}},
|
|
@DEF,
|
|
@tmpz);
|
|
$err = RRDs::error;
|
|
print("ERROR: while graphing $PNG_DIR" . "$PNG2z: $err\n") if $err;
|
|
}
|
|
if($title || ($silent =~ /imagetag/ && $graph =~ /squid2/)) {
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
if(lc($config->{disable_javascript_void}) eq "y") {
|
|
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");
|
|
}
|
|
} else {
|
|
print(" <img src='" . $config->{url} . $config->{imgs_dir} . $PNG2 . "'>\n");
|
|
}
|
|
}
|
|
|
|
undef(@riglim);
|
|
if(trim($rigid[2]) eq 1) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[2]));
|
|
} else {
|
|
if(trim($rigid[2]) eq 2) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[2]));
|
|
push(@riglim, "--rigid");
|
|
}
|
|
}
|
|
undef(@tmp);
|
|
undef(@tmpz);
|
|
undef(@DEF);
|
|
push(@tmp, "LINE1:squid_rq_1$AC[0]:Client HTTP requests");
|
|
push(@tmp, "GPRINT:squid_rq_1:LAST: Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_1:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_1:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_1:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmp, "LINE1:squid_rq_2$AC[1]:Client HTTP hits");
|
|
push(@tmp, "GPRINT:squid_rq_2:LAST: Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_2:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_2:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_2:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmp, "LINE1:squid_rq_3$AC[2]:Server HTTP requests");
|
|
push(@tmp, "GPRINT:squid_rq_3:LAST: Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_3:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_3:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_3:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmp, "LINE1:squid_rq_4$AC[3]:Server FTP requests");
|
|
push(@tmp, "GPRINT:squid_rq_4:LAST: Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_4:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_4:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_4:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmp, "LINE1:squid_rq_5$AC[4]:Server Other requests");
|
|
push(@tmp, "GPRINT:squid_rq_5:LAST: Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_5:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_5:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_5:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmp, "LINE1:squid_rq_6$AC[5]:Aborted requests");
|
|
push(@tmp, "GPRINT:squid_rq_6:LAST: Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_6:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_6:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_6:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmp, "LINE1:squid_rq_7$AC[6]:Swap files cleaned");
|
|
push(@tmp, "GPRINT:squid_rq_7:LAST: Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_7:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_7:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_7:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmp, "LINE1:squid_rq_8$AC[7]:Unlink requests");
|
|
push(@tmp, "GPRINT:squid_rq_8:LAST: Cur\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_8:AVERAGE: Avg\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_8:MIN: Min\\: %6.1lf");
|
|
push(@tmp, "GPRINT:squid_rq_8:MAX: Max\\: %6.1lf\\n");
|
|
push(@tmpz, "LINE2:squid_rq_1$AC[0]:Client HTTP requests");
|
|
push(@tmpz, "LINE2:squid_rq_2$AC[1]:Client HTTP hits");
|
|
push(@tmpz, "LINE2:squid_rq_3$AC[2]:Server HTTP requests");
|
|
push(@tmpz, "LINE2:squid_rq_4$AC[3]:Server FTP requests");
|
|
push(@tmpz, "LINE2:squid_rq_5$AC[4]:Server Other requests");
|
|
push(@tmpz, "LINE2:squid_rq_6$AC[5]:Aborted requests");
|
|
push(@tmpz, "LINE2:squid_rq_7$AC[6]:Swap files cleaned");
|
|
push(@tmpz, "LINE2:squid_rq_8$AC[7]:Unlink requests");
|
|
($width, $height) = split('x', $config->{graph_size}->{main});
|
|
if($silent =~ /imagetag/) {
|
|
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
|
|
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
|
|
@tmp = @tmpz;
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
RRDs::graph("$PNG_DIR" . "$PNG3",
|
|
"--title=$config->{graphs}->{_squid3} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Values/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:squid_rq_1=$rrd:squid_rq_1:AVERAGE",
|
|
"DEF:squid_rq_2=$rrd:squid_rq_2:AVERAGE",
|
|
"DEF:squid_rq_3=$rrd:squid_rq_3:AVERAGE",
|
|
"DEF:squid_rq_4=$rrd:squid_rq_4:AVERAGE",
|
|
"DEF:squid_rq_5=$rrd:squid_rq_5:AVERAGE",
|
|
"DEF:squid_rq_6=$rrd:squid_rq_6:AVERAGE",
|
|
"DEF:squid_rq_7=$rrd:squid_rq_7:AVERAGE",
|
|
"DEF:squid_rq_8=$rrd:squid_rq_8:AVERAGE",
|
|
"DEF:squid_rq_9=$rrd:squid_rq_9:AVERAGE",
|
|
@tmp);
|
|
$err = RRDs::error;
|
|
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",
|
|
"--title=$config->{graphs}->{_squid3} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Values/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:squid_rq_1=$rrd:squid_rq_1:AVERAGE",
|
|
"DEF:squid_rq_2=$rrd:squid_rq_2:AVERAGE",
|
|
"DEF:squid_rq_3=$rrd:squid_rq_3:AVERAGE",
|
|
"DEF:squid_rq_4=$rrd:squid_rq_4:AVERAGE",
|
|
"DEF:squid_rq_5=$rrd:squid_rq_5:AVERAGE",
|
|
"DEF:squid_rq_6=$rrd:squid_rq_6:AVERAGE",
|
|
"DEF:squid_rq_7=$rrd:squid_rq_7:AVERAGE",
|
|
"DEF:squid_rq_8=$rrd:squid_rq_8:AVERAGE",
|
|
"DEF:squid_rq_9=$rrd:squid_rq_9:AVERAGE",
|
|
@tmpz);
|
|
$err = RRDs::error;
|
|
print("ERROR: while graphing $PNG_DIR" . "$PNG3z: $err\n") if $err;
|
|
}
|
|
if($title || ($silent =~ /imagetag/ && $graph =~ /squid3/)) {
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
if(lc($config->{disable_javascript_void}) eq "y") {
|
|
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");
|
|
}
|
|
} else {
|
|
print(" <img src='" . $config->{url} . $config->{imgs_dir} . $PNG3 . "'>\n");
|
|
}
|
|
}
|
|
|
|
if($title) {
|
|
print(" </td>\n");
|
|
print(" <td valign='top' bgcolor='" . $colors->{title_bg_color} . "'>\n");
|
|
}
|
|
undef(@riglim);
|
|
if(trim($rigid[3]) eq 1) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[3]));
|
|
} else {
|
|
if(trim($rigid[3]) eq 2) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[3]));
|
|
push(@riglim, "--rigid");
|
|
}
|
|
}
|
|
undef(@tmp);
|
|
undef(@tmpz);
|
|
push(@tmp, "LINE1:m_alloc#EEEE44:Allocated");
|
|
push(@tmp, "GPRINT:m_alloc:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "AREA:m_inuse#44AAEE:In use");
|
|
push(@tmp, "LINE1:m_inuse#00AAEE:");
|
|
push(@tmp, "GPRINT:m_inuse:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "GPRINT:m_perc:LAST: In use\\: %5.1lf%%\\n");
|
|
push(@tmpz, "LINE2:m_alloc#EEEE44:Allocated");
|
|
push(@tmpz, "AREA:m_inuse#44AAEE:In use");
|
|
push(@tmpz, "LINE2:m_inuse#00AAEE:");
|
|
($width, $height) = split('x', $config->{graph_size}->{small});
|
|
if($silent =~ /imagetag/) {
|
|
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
|
|
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
|
|
@tmp = @tmpz;
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
RRDs::graph("$PNG_DIR" . "$PNG4",
|
|
"--title=$config->{graphs}->{_squid4} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Megabytes",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:squid_m_1=$rrd:squid_m_1:AVERAGE",
|
|
"DEF:squid_m_2=$rrd:squid_m_2:AVERAGE",
|
|
"CDEF:m_alloc=squid_m_1,1024,/",
|
|
"CDEF:m_inuse=squid_m_2,1024,/",
|
|
"CDEF:m_perc=squid_m_2,100,*,squid_m_1,/",
|
|
@tmp);
|
|
$err = RRDs::error;
|
|
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",
|
|
"--title=$config->{graphs}->{_squid4} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Megabytes",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:squid_m_1=$rrd:squid_m_1:AVERAGE",
|
|
"DEF:squid_m_2=$rrd:squid_m_2:AVERAGE",
|
|
"CDEF:m_alloc=squid_m_1,1024,/",
|
|
"CDEF:m_inuse=squid_m_2,1024,/",
|
|
"CDEF:m_perc=squid_m_2,100,*,squid_m_1,/",
|
|
@tmpz);
|
|
$err = RRDs::error;
|
|
print("ERROR: while graphing $PNG_DIR" . "$PNG4z: $err\n") if $err;
|
|
}
|
|
if($title || ($silent =~ /imagetag/ && $graph =~ /squid4/)) {
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
if(lc($config->{disable_javascript_void}) eq "y") {
|
|
print(" <a href=\"" . $config->{url} . $config->{imgs_dir} . $PNG4z . "\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG4 . "' border='0'></a>\n");
|
|
}
|
|
else {
|
|
print(" <a href=\"javascript:void(window.open('" . $config->{url} . $config->{imgs_dir} . $PNG4z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG4 . "' border='0'></a>\n");
|
|
}
|
|
} else {
|
|
print(" <img src='" . $config->{url} . $config->{imgs_dir} . $PNG4 . "'>\n");
|
|
}
|
|
}
|
|
|
|
undef(@riglim);
|
|
if(trim($rigid[4]) eq 1) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[4]));
|
|
} else {
|
|
if(trim($rigid[4]) eq 2) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[4]));
|
|
push(@riglim, "--rigid");
|
|
}
|
|
}
|
|
undef(@tmp);
|
|
undef(@tmpz);
|
|
push(@tmp, "LINE1:s_alloc#EEEE44:Allocated");
|
|
push(@tmp, "GPRINT:s_alloc:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "AREA:s_inuse#44AAEE:In use");
|
|
push(@tmp, "GPRINT:s_inuse:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "LINE1:s_inuse#00AAEE:");
|
|
push(@tmp, "GPRINT:s_perc:LAST: In use\\: %5.1lf%%\\n");
|
|
push(@tmpz, "LINE2:s_alloc#EEEE44:Allocated");
|
|
push(@tmpz, "AREA:s_inuse#44AAEE:In use");
|
|
push(@tmpz, "LINE2:s_inuse#00AAEE:");
|
|
($width, $height) = split('x', $config->{graph_size}->{small});
|
|
if($silent =~ /imagetag/) {
|
|
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
|
|
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
|
|
@tmp = @tmpz;
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
RRDs::graph("$PNG_DIR" . "$PNG5",
|
|
"--title=$config->{graphs}->{_squid5} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Megabytes",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:squid_s_2=$rrd:squid_s_2:AVERAGE",
|
|
"DEF:squid_s_3=$rrd:squid_s_3:AVERAGE",
|
|
"CDEF:s_alloc=squid_s_2,1024,/",
|
|
"CDEF:s_inuse=squid_s_3,1024,/",
|
|
"CDEF:s_perc=squid_s_3,100,*,squid_s_2,/",
|
|
@tmp);
|
|
$err = RRDs::error;
|
|
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",
|
|
"--title=$config->{graphs}->{_squid5} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Megabytes",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:squid_s_2=$rrd:squid_s_2:AVERAGE",
|
|
"DEF:squid_s_3=$rrd:squid_s_3:AVERAGE",
|
|
"CDEF:s_alloc=squid_s_2,1024,/",
|
|
"CDEF:s_inuse=squid_s_3,1024,/",
|
|
"CDEF:s_perc=squid_s_3,100,*,squid_s_2,/",
|
|
@tmpz);
|
|
$err = RRDs::error;
|
|
print("ERROR: while graphing $PNG_DIR" . "$PNG5z: $err\n") if $err;
|
|
}
|
|
if($title || ($silent =~ /imagetag/ && $graph =~ /squid5/)) {
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
if(lc($config->{disable_javascript_void}) eq "y") {
|
|
print(" <a href=\"" . $config->{url} . $config->{imgs_dir} . $PNG5z . "\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG5 . "' border='0'></a>\n");
|
|
}
|
|
else {
|
|
print(" <a href=\"javascript:void(window.open('" . $config->{url} . $config->{imgs_dir} . $PNG5z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG5 . "' border='0'></a>\n");
|
|
}
|
|
} else {
|
|
print(" <img src='" . $config->{url} . $config->{imgs_dir} . $PNG5 . "'>\n");
|
|
}
|
|
}
|
|
|
|
undef(@riglim);
|
|
if(trim($rigid[5]) eq 1) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[5]));
|
|
} else {
|
|
if(trim($rigid[5]) eq 2) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[5]));
|
|
push(@riglim, "--rigid");
|
|
}
|
|
}
|
|
undef(@tmp);
|
|
undef(@tmpz);
|
|
push(@tmp, "AREA:ic_requests#44EEEE:Requests");
|
|
push(@tmp, "GPRINT:ic_requests:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "AREA:ic_hits#4444EE:Hits");
|
|
push(@tmp, "GPRINT:ic_hits:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "AREA:ic_misses#EE44EE:Misses");
|
|
push(@tmp, "GPRINT:ic_misses:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "LINE1:ic_requests#00EEEE");
|
|
push(@tmp, "LINE1:ic_hits#0000EE");
|
|
push(@tmp, "LINE1:ic_misses#EE00EE");
|
|
push(@tmpz, "AREA:ic_requests#44EEEE:Requests");
|
|
push(@tmpz, "AREA:ic_hits#4444EE:Hits");
|
|
push(@tmpz, "AREA:ic_misses#EE44EE:Misses");
|
|
push(@tmpz, "LINE1:ic_requests#00EEEE");
|
|
push(@tmpz, "LINE1:ic_hits#0000EE");
|
|
push(@tmpz, "LINE1:ic_misses#EE00EE");
|
|
($width, $height) = split('x', $config->{graph_size}->{small});
|
|
if($silent =~ /imagetag/) {
|
|
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
|
|
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
|
|
@tmp = @tmpz;
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
RRDs::graph("$PNG_DIR" . "$PNG6",
|
|
"--title=$config->{graphs}->{_squid6} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Values/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:ic_requests=$rrd:squid_ic_1:AVERAGE",
|
|
"DEF:ic_hits=$rrd:squid_ic_2:AVERAGE",
|
|
"DEF:ic_misses=$rrd:squid_ic_3:AVERAGE",
|
|
@tmp);
|
|
$err = RRDs::error;
|
|
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",
|
|
"--title=$config->{graphs}->{_squid6} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Values/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:ic_requests=$rrd:squid_ic_1:AVERAGE",
|
|
"DEF:ic_hits=$rrd:squid_ic_2:AVERAGE",
|
|
"DEF:ic_misses=$rrd:squid_ic_3:AVERAGE",
|
|
@tmpz);
|
|
$err = RRDs::error;
|
|
print("ERROR: while graphing $PNG_DIR" . "$PNG6z: $err\n") if $err;
|
|
}
|
|
if($title || ($silent =~ /imagetag/ && $graph =~ /squid6/)) {
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
if(lc($config->{disable_javascript_void}) eq "y") {
|
|
print(" <a href=\"" . $config->{url} . $config->{imgs_dir} . $PNG6z . "\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG6 . "' border='0'></a>\n");
|
|
}
|
|
else {
|
|
print(" <a href=\"javascript:void(window.open('" . $config->{url} . $config->{imgs_dir} . $PNG6z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG6 . "' border='0'></a>\n");
|
|
}
|
|
} else {
|
|
print(" <img src='" . $config->{url} . $config->{imgs_dir} . $PNG6 . "'>\n");
|
|
}
|
|
}
|
|
|
|
undef(@riglim);
|
|
if(trim($rigid[6]) eq 1) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[6]));
|
|
} else {
|
|
if(trim($rigid[6]) eq 2) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[6]));
|
|
push(@riglim, "--rigid");
|
|
}
|
|
}
|
|
undef(@tmp);
|
|
undef(@tmpz);
|
|
push(@tmp, "AREA:io_http#44EEEE:HTTP");
|
|
push(@tmp, "GPRINT:io_http:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "AREA:io_ftp#4444EE:FTP");
|
|
push(@tmp, "GPRINT:io_ftp:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "AREA:io_gopher#EE44EE:Gopher");
|
|
push(@tmp, "GPRINT:io_gopher:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "AREA:io_wais#EEEE44:WAIS");
|
|
push(@tmp, "GPRINT:io_wais:LAST: Current\\: %7.1lf\\n");
|
|
push(@tmp, "LINE1:io_http#00EEEE");
|
|
push(@tmp, "LINE1:io_ftp#0000EE");
|
|
push(@tmp, "LINE1:io_gopher#EE00EE");
|
|
push(@tmp, "LINE1:io_wais#EEEE00");
|
|
push(@tmpz, "AREA:io_http#44EEEE:HTTP");
|
|
push(@tmpz, "AREA:io_ftp#4444EE:FTP");
|
|
push(@tmpz, "AREA:io_gopher#EE44EE:Gopher");
|
|
push(@tmpz, "AREA:io_wais#EEEE44:WAIS");
|
|
push(@tmpz, "LINE1:io_http#44EEEE");
|
|
push(@tmpz, "LINE1:io_ftp#4444EE");
|
|
push(@tmpz, "LINE1:io_gopher#EE44EE");
|
|
push(@tmpz, "LINE1:io_wais#EEEE44");
|
|
($width, $height) = split('x', $config->{graph_size}->{small});
|
|
if($silent =~ /imagetag/) {
|
|
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
|
|
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
|
|
@tmp = @tmpz;
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
RRDs::graph("$PNG_DIR" . "$PNG7",
|
|
"--title=$config->{graphs}->{_squid7} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Reads/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:io_http=$rrd:squid_io_1:AVERAGE",
|
|
"DEF:io_ftp=$rrd:squid_io_2:AVERAGE",
|
|
"DEF:io_gopher=$rrd:squid_io_3:AVERAGE",
|
|
"DEF:io_wais=$rrd:squid_io_4:AVERAGE",
|
|
@tmp);
|
|
$err = RRDs::error;
|
|
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",
|
|
"--title=$config->{graphs}->{_squid7} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=Reads/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:io_http=$rrd:squid_io_1:AVERAGE",
|
|
"DEF:io_ftp=$rrd:squid_io_2:AVERAGE",
|
|
"DEF:io_gopher=$rrd:squid_io_3:AVERAGE",
|
|
"DEF:io_wais=$rrd:squid_io_4:AVERAGE",
|
|
@tmpz);
|
|
$err = RRDs::error;
|
|
print("ERROR: while graphing $PNG_DIR" . "$PNG7z: $err\n") if $err;
|
|
}
|
|
if($title || ($silent =~ /imagetag/ && $graph =~ /squid7/)) {
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
if(lc($config->{disable_javascript_void}) eq "y") {
|
|
print(" <a href=\"" . $config->{url} . $config->{imgs_dir} . $PNG7z . "\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG7 . "' border='0'></a>\n");
|
|
}
|
|
else {
|
|
print(" <a href=\"javascript:void(window.open('" . $config->{url} . $config->{imgs_dir} . $PNG7z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG7 . "' border='0'></a>\n");
|
|
}
|
|
} else {
|
|
print(" <img src='" . $config->{url} . $config->{imgs_dir} . $PNG7 . "'>\n");
|
|
}
|
|
}
|
|
|
|
undef(@riglim);
|
|
if(trim($rigid[7]) eq 1) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[7]));
|
|
} else {
|
|
if(trim($rigid[7]) eq 2) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[7]));
|
|
push(@riglim, "--rigid");
|
|
}
|
|
}
|
|
undef(@tmp);
|
|
undef(@tmpz);
|
|
push(@tmp, "AREA:in#44EE44:Input");
|
|
push(@tmp, "AREA:out#4444EE:Output");
|
|
push(@tmp, "AREA:out#4444EE:");
|
|
push(@tmp, "AREA:in#44EE44:");
|
|
push(@tmp, "LINE1:out#0000EE");
|
|
push(@tmp, "LINE1:in#00EE00");
|
|
push(@tmpz, "AREA:in#44EE44:Input");
|
|
push(@tmpz, "AREA:out#4444EE:Output");
|
|
push(@tmpz, "AREA:out#4444EE:");
|
|
push(@tmpz, "AREA:in#44EE44:");
|
|
push(@tmpz, "LINE1:out#0000EE");
|
|
push(@tmpz, "LINE1:in#00EE00");
|
|
($width, $height) = split('x', $config->{graph_size}->{small});
|
|
if($silent =~ /imagetag/) {
|
|
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
|
|
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
|
|
@tmp = @tmpz;
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
RRDs::graph("$PNG_DIR" . "$PNG8",
|
|
"--title=$config->{graphs}->{_squid8} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=bytes/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:in=$rrd:squid_tc_1:AVERAGE",
|
|
"DEF:out=$rrd:squid_tc_2:AVERAGE",
|
|
@tmp);
|
|
$err = RRDs::error;
|
|
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",
|
|
"--title=$config->{graphs}->{_squid8} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=bytes/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:in=$rrd:squid_tc_1:AVERAGE",
|
|
"DEF:out=$rrd:squid_tc_2:AVERAGE",
|
|
@tmpz);
|
|
$err = RRDs::error;
|
|
print("ERROR: while graphing $PNG_DIR" . "$PNG8z: $err\n") if $err;
|
|
}
|
|
if($title || ($silent =~ /imagetag/ && $graph =~ /squid8/)) {
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
if(lc($config->{disable_javascript_void}) eq "y") {
|
|
print(" <a href=\"" . $config->{url} . $config->{imgs_dir} . $PNG8z . "\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG8 . "' border='0'></a>\n");
|
|
}
|
|
else {
|
|
print(" <a href=\"javascript:void(window.open('" . $config->{url} . $config->{imgs_dir} . $PNG8z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG8 . "' border='0'></a>\n");
|
|
}
|
|
} else {
|
|
print(" <img src='" . $config->{url} . $config->{imgs_dir} . $PNG8 . "'>\n");
|
|
}
|
|
}
|
|
|
|
undef(@riglim);
|
|
if(trim($rigid[8]) eq 1) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[8]));
|
|
} else {
|
|
if(trim($rigid[8]) eq 2) {
|
|
push(@riglim, "--upper-limit=" . trim($limit[8]));
|
|
push(@riglim, "--rigid");
|
|
}
|
|
}
|
|
undef(@tmp);
|
|
undef(@tmpz);
|
|
push(@tmp, "AREA:in#44EE44:Input");
|
|
push(@tmp, "AREA:out#4444EE:Output");
|
|
push(@tmp, "AREA:out#4444EE:");
|
|
push(@tmp, "AREA:in#44EE44:");
|
|
push(@tmp, "LINE1:out#0000EE");
|
|
push(@tmp, "LINE1:in#00EE00");
|
|
push(@tmpz, "AREA:in#44EE44:Input");
|
|
push(@tmpz, "AREA:out#4444EE:Output");
|
|
push(@tmpz, "AREA:out#4444EE:");
|
|
push(@tmpz, "AREA:in#44EE44:");
|
|
push(@tmpz, "LINE1:out#0000EE");
|
|
push(@tmpz, "LINE1:in#00EE00");
|
|
($width, $height) = split('x', $config->{graph_size}->{small});
|
|
if($silent =~ /imagetag/) {
|
|
($width, $height) = split('x', $config->{graph_size}->{remote}) if $silent eq "imagetag";
|
|
($width, $height) = split('x', $config->{graph_size}->{main}) if $silent eq "imagetagbig";
|
|
@tmp = @tmpz;
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
push(@tmp, "COMMENT: \\n");
|
|
}
|
|
RRDs::graph("$PNG_DIR" . "$PNG9",
|
|
"--title=$config->{graphs}->{_squid9} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=bytes/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:in=$rrd:squid_ts_1:AVERAGE",
|
|
"DEF:out=$rrd:squid_ts_2:AVERAGE",
|
|
@tmp);
|
|
$err = RRDs::error;
|
|
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",
|
|
"--title=$config->{graphs}->{_squid9} ($tf->{nwhen}$tf->{twhen})",
|
|
"--start=-$tf->{nwhen}$tf->{twhen}",
|
|
"--imgformat=PNG",
|
|
"--vertical-label=bytes/s",
|
|
"--width=$width",
|
|
"--height=$height",
|
|
@riglim,
|
|
"--lower-limit=0",
|
|
@{$cgi->{version12}},
|
|
@{$cgi->{version12_small}},
|
|
@{$colors->{graph_colors}},
|
|
"DEF:in=$rrd:squid_ts_1:AVERAGE",
|
|
"DEF:out=$rrd:squid_ts_2:AVERAGE",
|
|
@tmpz);
|
|
$err = RRDs::error;
|
|
print("ERROR: while graphing $PNG_DIR" . "$PNG9z: $err\n") if $err;
|
|
}
|
|
if($title || ($silent =~ /imagetag/ && $graph =~ /squid9/)) {
|
|
if(lc($config->{enable_zoom}) eq "y") {
|
|
if(lc($config->{disable_javascript_void}) eq "y") {
|
|
print(" <a href=\"" . $config->{url} . $config->{imgs_dir} . $PNG9z . "\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG9 . "' border='0'></a>\n");
|
|
}
|
|
else {
|
|
print(" <a href=\"javascript:void(window.open('" . $config->{url} . $config->{imgs_dir} . $PNG9z . "','','width=" . ($width + 115) . ",height=" . ($height + 100) . ",scrollbars=0,resizable=0'))\"><img src='" . $config->{url} . $config->{imgs_dir} . $PNG9 . "' border='0'></a>\n");
|
|
}
|
|
} else {
|
|
print(" <img src='" . $config->{url} . $config->{imgs_dir} . $PNG9 . "'>\n");
|
|
}
|
|
}
|
|
|
|
if($title) {
|
|
print(" </td>\n");
|
|
print(" </tr>\n");
|
|
main::graph_footer();
|
|
}
|
|
print(" <br>\n");
|
|
return;
|
|
}
|
|
|
|
1;
|