From cfcf6203ebb8656a22e02ebf87fe8ec610c09bd1 Mon Sep 17 00:00:00 2001 From: Jordi Sanfeliu Date: Thu, 26 Feb 2015 15:42:22 +0100 Subject: [PATCH] added a complete graph for Varnish proxy cache --- lib/varnish.pm | 1150 ++++++++++++++++++++++++++++++++++++++++++++++++ monitorix.conf | 19 +- 2 files changed, 1167 insertions(+), 2 deletions(-) create mode 100644 lib/varnish.pm diff --git a/lib/varnish.pm b/lib/varnish.pm new file mode 100644 index 0000000..1afcf87 --- /dev/null +++ b/lib/varnish.pm @@ -0,0 +1,1150 @@ +# +# Monitorix - A lightweight system monitoring tool. +# +# Copyright (C) 2005-2015 by Jordi Sanfeliu +# +# 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 varnish; + +use strict; +use warnings; +use Monitorix; +use RRDs; +use IO::Socket; +use Exporter 'import'; +our @EXPORT = qw(varnish_init varnish_update varnish_cgi); + +sub varnish_init { + my $myself = (caller(0))[3]; + my ($package, $config, $debug) = @_; + my $rrd = $config->{base_lib} . $package . ".rrd"; + + my $info; + my @rra; + my @tmp; + my $n; + + my @average; + my @min; + my @max; + my @last; + + if(-e $rrd) { + $info = RRDs::info($rrd); + for my $key (keys %$info) { + if(index($key, 'rra[') == 0) { + if(index($key, '.rows') != -1) { + push(@rra, substr($key, 4, index($key, ']') - 4)); + } + } + } + if(scalar(@rra) < 12 + (4 * $config->{max_historic_years})) { + logger("$myself: Detected size mismatch between 'max_historic_years' (" . $config->{max_historic_years} . ") and $rrd (" . ((scalar(@rra) -12) / 4) . "). Resizing it accordingly. All historical data will be lost. Backup file created."); + rename($rrd, "$rrd.bak"); + } + } + + if(!(-e $rrd)) { + logger("Creating '$rrd' file."); + for($n = 1; $n <= $config->{max_historic_years}; $n++) { + push(@average, "RRA:AVERAGE:0.5:1440:" . (365 * $n)); + push(@min, "RRA:MIN:0.5:1440:" . (365 * $n)); + push(@max, "RRA:MAX:0.5:1440:" . (365 * $n)); + push(@last, "RRA:LAST:0.5:1440:" . (365 * $n)); + } + push(@tmp, "DS:varn" . "0" . "_cconn:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_cdrop:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_creq:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_chit:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_chitp:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_cmiss:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_bconn:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_bunhe:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_bbusy:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_bfail:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_breus:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_btool:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_brecy:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_bretr:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nwcre:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nwfai:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nwmax:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nwque:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nwdro:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nlnuk:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nlmov:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nsob:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nsoc:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nsoh:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_nswl:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_hdrb:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_bodb:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val01:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val02:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val03:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val04:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val05:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val06:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val07:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val08:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val09:GAUGE:120:0:U"); + push(@tmp, "DS:varn" . "0" . "_val10:GAUGE:120:0:U"); + eval { + RRDs::create($rrd, + "--step=60", + @tmp, + "RRA:AVERAGE:0.5:1:1440", + "RRA:AVERAGE:0.5:30:336", + "RRA:AVERAGE:0.5:60:744", + @average, + "RRA:MIN:0.5:1:1440", + "RRA:MIN:0.5:30:336", + "RRA:MIN:0.5:60:744", + @min, + "RRA:MAX:0.5:1:1440", + "RRA:MAX:0.5:30:336", + "RRA:MAX:0.5:60:744", + @max, + "RRA:LAST:0.5:1:1440", + "RRA:LAST:0.5:30:336", + "RRA:LAST:0.5:60:744", + @last, + ); + }; + 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->{varnish_hist} = (); + push(@{$config->{func_update}}, $package); + logger("$myself: Ok") if $debug; +} + +sub varnish_update { + my $myself = (caller(0))[3]; + my ($package, $config, $debug) = @_; + my $rrd = $config->{base_lib} . $package . ".rrd"; + my $varnish = $config->{varnish}; + + my $n; + my $rrdata = "N"; + + my $cconn = 0; + my $cdrop = 0; + my $creq = 0; + my $chit = 0; + my $chitp = 0; + my $cmiss = 0; + my $bconn = 0; + my $bunhe = 0; + my $bbusy = 0; + my $bfail = 0; + my $breus = 0; + my $btool = 0; + my $brecy = 0; + my $bretr = 0; + my $nwcre = 0; + my $nwfai = 0; + my $nwmax = 0; + my $nwque = 0; + my $nwdro = 0; + my $nlnuk = 0; + my $nlmov = 0; + my $nsob = 0; + my $nsoc = 0; + my $nsoh = 0; + my $nswl = 0; + my $hdrb = 0; + my $bodb = 0; + + my $e = 0; + my $str; + + open(IN, "varnishstat -1 |"); + while() { + if(/^client_conn\s+(\d+)\s+/) { + $str = $e . "cconn"; + $cconn = $1 - ($config->{varnish_hist}->{$str} || 0); + $cconn = 0 unless $cconn != $1; + $cconn /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^client_drop\s+(\d+)\s+/) { + $str = $e . "cdrop"; + $cdrop = $1 - ($config->{varnish_hist}->{$str} || 0); + $cdrop = 0 unless $cdrop != $1; + $cdrop /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^client_req\s+(\d+)\s+/) { + $str = $e . "creq"; + $creq = $1 - ($config->{varnish_hist}->{$str} || 0); + $creq = 0 unless $creq != $1; + $creq /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^cache_hit\s+(\d+)\s+/) { + $str = $e . "chit"; + $chit = $1 - ($config->{varnish_hist}->{$str} || 0); + $chit = 0 unless $chit != $1; + $chit /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^cache_hitpass\s+(\d+)\s+/) { + $str = $e . "chitp"; + $chitp = $1 - ($config->{varnish_hist}->{$str} || 0); + $chitp = 0 unless $chitp != $1; + $chitp /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^cache_miss\s+(\d+)\s+/) { + $str = $e . "cmiss"; + $cmiss = $1 - ($config->{varnish_hist}->{$str} || 0); + $cmiss = 0 unless $cmiss != $1; + $cmiss /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^backend_conn\s+(\d+)\s+/) { + $str = $e . "bconn"; + $bconn = $1 - ($config->{varnish_hist}->{$str} || 0); + $bconn = 0 unless $bconn != $1; + $bconn /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^backend_unhealthy\s+(\d+)\s+/) { + $str = $e . "bunhe"; + $bunhe = $1 - ($config->{varnish_hist}->{$str} || 0); + $bunhe = 0 unless $bunhe != $1; + $bunhe /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^backend_busy\s+(\d+)\s+/) { + $str = $e . "bbusy"; + $bbusy = $1 - ($config->{varnish_hist}->{$str} || 0); + $bbusy = 0 unless $bbusy != $1; + $bbusy /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^backend_fail\s+(\d+)\s+/) { + $str = $e . "bfail"; + $bfail = $1 - ($config->{varnish_hist}->{$str} || 0); + $bfail = 0 unless $bfail != $1; + $bfail /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^backend_reuse\s+(\d+)\s+/) { + $str = $e . "breus"; + $breus = $1 - ($config->{varnish_hist}->{$str} || 0); + $breus = 0 unless $breus != $1; + $breus /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^backend_toolate\s+(\d+)\s+/) { + $str = $e . "btool"; + $btool = $1 - ($config->{varnish_hist}->{$str} || 0); + $btool = 0 unless $btool != $1; + $btool /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^backend_recycle\s+(\d+)\s+/) { + $str = $e . "brecy"; + $brecy = $1 - ($config->{varnish_hist}->{$str} || 0); + $brecy = 0 unless $brecy != $1; + $brecy /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^backend_retry\s+(\d+)\s+/) { + $str = $e . "bretr"; + $bretr = $1 - ($config->{varnish_hist}->{$str} || 0); + $bretr = 0 unless $bretr != $1; + $bretr /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^n_wrk_create\s+(\d+)\s+/) { + $str = $e . "nwcre"; + $nwcre = $1 - ($config->{varnish_hist}->{$str} || 0); + $nwcre = 0 unless $nwcre != $1; + $nwcre /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^n_wrk_failed\s+(\d+)\s+/) { + $str = $e . "nwfai"; + $nwfai = $1 - ($config->{varnish_hist}->{$str} || 0); + $nwfai = 0 unless $nwfai != $1; + $nwfai /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^n_wrk_max\s+(\d+)\s+/) { + $str = $e . "nwmax"; + $nwmax = $1 - ($config->{varnish_hist}->{$str} || 0); + $nwmax = 0 unless $nwmax != $1; + $nwmax /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^n_wrk_queued\s+(\d+)\s+/) { + $str = $e . "nwque"; + $nwque = $1 - ($config->{varnish_hist}->{$str} || 0); + $nwque = 0 unless $nwque != $1; + $nwque /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^n_wrk_drop\s+(\d+)\s+/) { + $str = $e . "nwdro"; + $nwdro = $1 - ($config->{varnish_hist}->{$str} || 0); + $nwdro = 0 unless $nwdro != $1; + $nwdro /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^n_lru_nuked\s+(\d+)\s+/) { + $str = $e . "nlnuk"; + $nlnuk = $1 - ($config->{varnish_hist}->{$str} || 0); + $nlnuk = 0 unless $nlnuk != $1; + $nlnuk /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^n_lru_moved\s+(\d+)\s+/) { + $str = $e . "nlmov"; + $nlmov = $1 - ($config->{varnish_hist}->{$str} || 0); + $nlmov = 0 unless $nlmov != $1; + $nlmov /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^n_object\s+(\d+)\s+/) { + $nsob = $1; + } + if(/^n_objectcore\s+(\d+)\s+/) { + $nsoc = $1; + } + if(/^n_objecthead\s+(\d+)\s+/) { + $nsoh = $1; + } + if(/^n_waitinglist\s+(\d+)\s+/) { + $nswl = $1; + } + if(/^s_hdrbytes\s+(\d+)\s+/) { + $str = $e . "hdrb"; + $hdrb = $1 - ($config->{varnish_hist}->{$str} || 0); + $hdrb = 0 unless $hdrb != $1; + $hdrb /= 60; + $config->{varnish_hist}->{$str} = $1; + } + if(/^s_bodybytes\s+(\d+)\s+/) { + $str = $e . "bodb"; + $bodb = $1 - ($config->{varnish_hist}->{$str} || 0); + $bodb = 0 unless $bodb != $1; + $bodb /= 60; + $config->{varnish_hist}->{$str} = $1; + } + } + close(IN); + $rrdata .= ":$cconn:$cdrop:$creq:$chit:$chitp:$cmiss:$bconn:$bunhe:$bbusy:$bfail:$breus:$btool:$brecy:$bretr:$nwcre:$nwfai:$nwmax:$nwque:$nwdro:$nlnuk:$nlmov:$nsob:$nsoc:$nsoh:$nswl:$hdrb:$bodb:0:0:0:0:0:0:0:0:0:0"; + + RRDs::update($rrd, $rrdata); + logger("$myself: $rrdata") if $debug; + my $err = RRDs::error; + logger("ERROR: while updating $rrd: $err") if $err; +} + +sub varnish_cgi { + my $myself = (caller(0))[3]; + my ($package, $config, $cgi) = @_; + + my $varnish = $config->{varnish}; + my @rigid = split(',', ($varnish->{rigid} || "")); + my @limit = split(',', ($varnish->{limit} || "")); + my $tf = $cgi->{tf}; + my $colors = $cgi->{colors}; + 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; + my $height; + my @riglim; + my @tmp; + my @tmpz; + my @CDEF; + my $n; + my $err; + + $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}; + + $title = !$silent ? $title : ""; + + + # text mode + # + if(lc($config->{iface_mode}) eq "text") { + if($title) { + main::graph_header($title, 2); + print(" \n"); + print(" \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 $line1; + my $line2; + print("
\n");
+		print("    ");
+		$line1 = "    Cli.Conn Cli.Drop Cli.Reqs Cac.Hits Cac.HitP Cac.Miss Bac.Conn Bac.Unhe Bac.Busy Bac.Fail Bac.Reus Bac.Tool Bac.Recy Bac.Retr N.W.Crea N.W.FAil  N.W.Max N.W.Queu N.W.Drop N.L.Nuke N.L.Move N.S.Obje N.S.ObjC N.S.ObjH N.S.Wait Bytes_Hdr Bytes_Bdy";
+		$line2 = "--------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------";
+		print("\n");
+		print("Time$line1\n");
+		print("----$line2 \n");
+		my $line;
+		my @row;
+		my $time;
+		my $n2;
+		for($n = 0, $time = $tf->{tb}; $n < ($tf->{tb} * $tf->{ts}); $n++) {
+			$line = @$data[$n];
+			$time = $time - (1 / $tf->{ts});
+			printf(" %2d$tf->{tc}", $time);
+			undef(@row);
+			my ($cconn, $cdrop, $creq, $chit, $chitp, $cmiss, $bconn, $bunhe, $bbusy, $bfail, $breus, $btool, $brecy, $bretr, $nwcre, $nwfai, $nwmax, $nwque, $nwdro, $nlnuk, $nlmov, $nsob, $nsoc, $nsoh, $nswl, $hdrb, $bodb) = @$line[0..37];
+			printf("    %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8d %8d %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %8.1f %9d %9d", $cconn || 0, $cdrop || 0, $creq || 0, $chit || 0, $chitp || 0, $cmiss || 0, $bconn || 0, $bunhe || 0, $bbusy || 0, $bfail || 0, $breus || 0, $btool || 0, $brecy || 0, $bretr || 0, $nwcre || 0, $nwfai || 0, $nwmax || 0, $nwque || 0, $nwdro || 0, $nlnuk || 0, $nlmov || 0, $nsob || 0, $nsoc || 0, $nsoh || 0, $nswl || 0, $hdrb || 0, $bodb || 0);
+			print("\n");
+		}
+		print("    
\n"); + if($title) { + print(" \n"); + print(" \n"); + main::graph_footer(); + } + print("
\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 $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"; + unlink ("$PNG_DIR" . "$PNG1", + "$PNG_DIR" . "$PNG2", + "$PNG_DIR" . "$PNG3", + "$PNG_DIR" . "$PNG4", + "$PNG_DIR" . "$PNG5", + "$PNG_DIR" . "$PNG6"); + 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"); + } + + my $uptimeline = 0; + open(IN, "varnishstat -1 |"); + while() { + if(/^uptime\s+(\d+)\s+/) { + $uptimeline = $1; + last; + } + } + close(IN); + if($RRDs::VERSION > 1.2) { + $uptimeline = "COMMENT:uptime\\: " . uptime2str(trim($uptimeline)) . "\\c"; + } else { + $uptimeline = "COMMENT:uptime: " . uptime2str(trim($uptimeline)) . "\\c"; + } + + if($title) { + main::graph_header($title, 2); + print(" \n"); + print(" \n"); + } + + @riglim = @{setup_riglim($rigid[0], $limit[0])}; + push(@tmp, "LINE2:nwcre#44EE44:Worker threads created"); + push(@tmp, "GPRINT:nwcre:LAST:Current\\: %4.1lf"); + push(@tmp, "GPRINT:nwcre:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:nwcre:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:nwcre:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:nwfai#448844:Worker threads failed"); + push(@tmp, "GPRINT:nwfai:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:nwfai:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:nwfai:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:nwfai:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:nwmax#44EEEE:Worker threads limited"); + push(@tmp, "GPRINT:nwmax:LAST:Current\\: %4.1lf"); + push(@tmp, "GPRINT:nwmax:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:nwmax:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:nwmax:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:nwque#4444EE:Queued work requests"); + push(@tmp, "GPRINT:nwque:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:nwque:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:nwque:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:nwque:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:nwdro#EE44EE:Dropped work requests"); + push(@tmp, "GPRINT:nwdro:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:nwdro:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:nwdro:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:nwdro:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:nlnuk#EE4444:LRU nuked objects"); + push(@tmp, "GPRINT:nlnuk:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:nlnuk:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:nlnuk:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:nlnuk:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:nlmov#EEEE44:LRU moved objects"); + push(@tmp, "GPRINT:nlmov:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:nlmov:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:nlmov:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:nlmov:MAX: Max\\: %4.1lf\\n"); + push(@tmpz, "LINE2:nwcre#44EE44:Worker threads created"); + push(@tmpz, "LINE2:nwfai#448844:Worker threads failed"); + push(@tmpz, "LINE2:nwmax#44EEEE:Worker threads limited"); + push(@tmpz, "LINE2:nwque#4444EE:Queued work requests"); + push(@tmpz, "LINE2:nwdro#EE44EE:Dropped work requests"); + push(@tmpz, "LINE2:nlnuk#EE4444:LRU nuked objects"); + push(@tmpz, "LINE2:nlmov#EEEE44:LRU moved objects"); + if(lc($config->{show_gaps}) eq "y") { + push(@tmp, "AREA:wrongdata#$colors->{gap}:"); + push(@tmpz, "AREA:wrongdata#$colors->{gap}:"); + push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF"); + } + ($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; + } + $pic = $rrd{$version}->("$PNG_DIR" . "$PNG1", + "--title=$config->{graphs}->{_varnish1} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Values/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$colors->{graph_colors}}, + "DEF:nwcre=$rrd:varn0" . "_nwcre:AVERAGE", + "DEF:nwfai=$rrd:varn0" . "_nwfai:AVERAGE", + "DEF:nwmax=$rrd:varn0" . "_nwmax:AVERAGE", + "DEF:nwque=$rrd:varn0" . "_nwque:AVERAGE", + "DEF:nwdro=$rrd:varn0" . "_nwdro:AVERAGE", + "DEF:nlnuk=$rrd:varn0" . "_nlnuk:AVERAGE", + "DEF:nlmov=$rrd:varn0" . "_nlmov:AVERAGE", + "CDEF:allvalues=nwcre,nwfai,nwmax,nwque,nwdro,nlnuk,nlmov,+,+,+,+,+,+", + @CDEF, + @tmp, + "COMMENT: \\n", + $uptimeline); + $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}); + $picz = $rrd{$version}->("$PNG_DIR" . "$PNG1z", + "--title=$config->{graphs}->{_varnish1} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Values/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$colors->{graph_colors}}, + "DEF:nwcre=$rrd:varn0" . "_nwcre:AVERAGE", + "DEF:nwfai=$rrd:varn0" . "_nwfai:AVERAGE", + "DEF:nwmax=$rrd:varn0" . "_nwmax:AVERAGE", + "DEF:nwque=$rrd:varn0" . "_nwque:AVERAGE", + "DEF:nwdro=$rrd:varn0" . "_nwdro:AVERAGE", + "DEF:nlnuk=$rrd:varn0" . "_nlnuk:AVERAGE", + "DEF:nlmov=$rrd:varn0" . "_nlmov:AVERAGE", + "CDEF:allvalues=nwcre,nwfai,nwmax,nwque,nwdro,nlnuk,nlmov,+,+,+,+,+,+", + @CDEF, + @tmpz); + $err = RRDs::error; + print("ERROR: while graphing $PNG_DIR" . "$PNG1z: $err\n") if $err; + } + if($title || ($silent =~ /imagetag/ && $graph =~ /varnish1/)) { + if(lc($config->{enable_zoom}) eq "y") { + if(lc($config->{disable_javascript_void}) eq "y") { + print(" {url} . "/" . $config->{imgs_dir} . $PNG1z . "\">\n"); + } else { + if($version eq "new") { + $picz_width = $picz->{image_width} * $config->{global_zoom}; + $picz_height = $picz->{image_height} * $config->{global_zoom}; + } else { + $picz_width = $width + 115; + $picz_height = $height + 100; + } + print(" {url} . "/" . $config->{imgs_dir} . $PNG1z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n"); + } + } else { + print(" \n"); + } + } + + @riglim = @{setup_riglim($rigid[1], $limit[1])}; + undef(@tmp); + undef(@tmpz); + undef(@CDEF); + push(@tmp, "LINE2:bconn#44EEEE:Conn. success"); + push(@tmp, "GPRINT:bconn:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:bconn:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:bconn:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:bconn:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:bunhe#4444EE:Conn. not attempted"); + push(@tmp, "GPRINT:bunhe:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:bunhe:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:bunhe:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:bunhe:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:bbusy#EEEE44:Too many connections"); + push(@tmp, "GPRINT:bbusy:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:bbusy:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:bbusy:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:bbusy:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:bfail#FFA500:Conn. failures"); + push(@tmp, "GPRINT:bfail:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:bfail:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:bfail:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:bfail:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:breus#EE4444:Conn. reuses"); + push(@tmp, "GPRINT:breus:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:breus:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:breus:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:breus:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:btool#EE44EE:Conn. was closed"); + push(@tmp, "GPRINT:btool:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:btool:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:btool:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:btool:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:brecy#963C74:Conn. recycles"); + push(@tmp, "GPRINT:brecy:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:brecy:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:brecy:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:brecy:MAX: Max\\: %4.1lf\\n"); + push(@tmp, "LINE2:bretr#888888:Conn. retry"); + push(@tmp, "GPRINT:bretr:LAST: Current\\: %4.1lf"); + push(@tmp, "GPRINT:bretr:AVERAGE: Average\\: %4.1lf"); + push(@tmp, "GPRINT:bretr:MIN: Min\\: %4.1lf"); + push(@tmp, "GPRINT:bretr:MAX: Max\\: %4.1lf\\n"); + push(@tmpz, "LINE2:bconn#44EEEE:Conn. success"); + push(@tmpz, "LINE2:bunhe#4444EE:Conn. not attempted"); + push(@tmpz, "LINE2:bbusy#EEEE44:Too many connections"); + push(@tmpz, "LINE2:bfail#FFA500:Conn. failures"); + push(@tmpz, "LINE2:breus#EE4444:Conn. reuses"); + push(@tmpz, "LINE2:btool#EE44EE:Conn. was closed"); + push(@tmpz, "LINE2:brecy#963C74:Conn. recycles"); + push(@tmpz, "LINE2:bretr#888888:Conn. retry"); + if(lc($config->{show_gaps}) eq "y") { + push(@tmp, "AREA:wrongdata#$colors->{gap}:"); + push(@tmpz, "AREA:wrongdata#$colors->{gap}:"); + push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF"); + } + ($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; + } + $pic = $rrd{$version}->("$PNG_DIR" . "$PNG2", + "--title=$config->{graphs}->{_varnish2} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Values/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$colors->{graph_colors}}, + "DEF:bconn=$rrd:varn0" . "_bconn:AVERAGE", + "DEF:bunhe=$rrd:varn0" . "_bunhe:AVERAGE", + "DEF:bbusy=$rrd:varn0" . "_bbusy:AVERAGE", + "DEF:bfail=$rrd:varn0" . "_bfail:AVERAGE", + "DEF:breus=$rrd:varn0" . "_breus:AVERAGE", + "DEF:btool=$rrd:varn0" . "_btool:AVERAGE", + "DEF:brecy=$rrd:varn0" . "_brecy:AVERAGE", + "DEF:bretr=$rrd:varn0" . "_bretr:AVERAGE", + "CDEF:allvalues=bconn,bunhe,bbusy,bfail,breus,btool,brecy,bretr,+,+,+,+,+,+,+", + @CDEF, + @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}); + $picz = $rrd{$version}->("$PNG_DIR" . "$PNG2z", + "--title=$config->{graphs}->{_varnish2} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Values/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$colors->{graph_colors}}, + "DEF:bconn=$rrd:varn0" . "_bconn:AVERAGE", + "DEF:bunhe=$rrd:varn0" . "_bunhe:AVERAGE", + "DEF:bbusy=$rrd:varn0" . "_bbusy:AVERAGE", + "DEF:bfail=$rrd:varn0" . "_bfail:AVERAGE", + "DEF:breus=$rrd:varn0" . "_breus:AVERAGE", + "DEF:btool=$rrd:varn0" . "_btool:AVERAGE", + "DEF:brecy=$rrd:varn0" . "_brecy:AVERAGE", + "DEF:bretr=$rrd:varn0" . "_bretr:AVERAGE", + "CDEF:allvalues=bconn,bunhe,bbusy,bfail,breus,btool,brecy,bretr,+,+,+,+,+,+,+", + @CDEF, + @tmpz); + $err = RRDs::error; + print("ERROR: while graphing $PNG_DIR" . "$PNG2z: $err\n") if $err; + } + if($title || ($silent =~ /imagetag/ && $graph =~ /varnish2/)) { + if(lc($config->{enable_zoom}) eq "y") { + if(lc($config->{disable_javascript_void}) eq "y") { + print(" {url} . "/" . $config->{imgs_dir} . $PNG2z . "\">\n"); + } else { + if($version eq "new") { + $picz_width = $picz->{image_width} * $config->{global_zoom}; + $picz_height = $picz->{image_height} * $config->{global_zoom}; + } else { + $picz_width = $width + 115; + $picz_height = $height + 100; + } + print(" {url} . "/" . $config->{imgs_dir} . $PNG2z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n"); + } + } else { + print(" \n"); + } + } + + if($title) { + print(" \n"); + print(" \n"); + } + + @riglim = @{setup_riglim($rigid[2], $limit[2])}; + undef(@tmp); + undef(@tmpz); + undef(@CDEF); + push(@tmp, "LINE2:cconn#44EEEE:Conn. accepted"); + push(@tmp, "GPRINT:cconn:LAST: Current\\: %5.1lf\\n"); + push(@tmp, "LINE2:cdrop#EE4444:Conn. dropped"); + push(@tmp, "GPRINT:cdrop:LAST: Current\\: %5.1lf\\n"); + push(@tmp, "LINE2:creq#44EE44:Req. accepted"); + push(@tmp, "GPRINT:creq:LAST: Current\\: %5.1lf\\n"); + push(@tmpz, "LINE2:cconn#44EEEE:Conn. accepted"); + push(@tmpz, "LINE2:cdrop#EE4444:Conn. dropped"); + push(@tmpz, "LINE2:creq#44EE44:Req. accepted"); + if(lc($config->{show_gaps}) eq "y") { + push(@tmp, "AREA:wrongdata#$colors->{gap}:"); + push(@tmpz, "AREA:wrongdata#$colors->{gap}:"); + push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF"); + } + ($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"); + } + $pic = $rrd{$version}->("$PNG_DIR" . "$PNG3", + "--title=$config->{graphs}->{_varnish3} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Connections/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$cgi->{version12_small}}, + @{$colors->{graph_colors}}, + "DEF:cconn=$rrd:varn0" . "_cconn:AVERAGE", + "DEF:cdrop=$rrd:varn0" . "_cdrop:AVERAGE", + "DEF:creq=$rrd:varn0" . "_creq:AVERAGE", + "CDEF:allvalues=cconn,cdrop,creq,+,+", + @CDEF, + @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}); + $picz = $rrd{$version}->("$PNG_DIR" . "$PNG3z", + "--title=$config->{graphs}->{_varnish3} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Connections/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$cgi->{version12_small}}, + @{$colors->{graph_colors}}, + "DEF:cconn=$rrd:varn0" . "_cconn:AVERAGE", + "DEF:cdrop=$rrd:varn0" . "_cdrop:AVERAGE", + "DEF:creq=$rrd:varn0" . "_creq:AVERAGE", + "CDEF:allvalues=cconn,cdrop,creq,+,+", + @CDEF, + @tmpz); + $err = RRDs::error; + print("ERROR: while graphing $PNG_DIR" . "$PNG3z: $err\n") if $err; + } + if($title || ($silent =~ /imagetag/ && $graph =~ /varnish3/)) { + if(lc($config->{enable_zoom}) eq "y") { + if(lc($config->{disable_javascript_void}) eq "y") { + print(" {url} . "/" . $config->{imgs_dir} . $PNG3z . "\">\n"); + } else { + if($version eq "new") { + $picz_width = $picz->{image_width} * $config->{global_zoom}; + $picz_height = $picz->{image_height} * $config->{global_zoom}; + } else { + $picz_width = $width + 115; + $picz_height = $height + 100; + } + print(" {url} . "/" . $config->{imgs_dir} . $PNG3z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n"); + } + } else { + print(" \n"); + } + } + + @riglim = @{setup_riglim($rigid[3], $limit[3])}; + undef(@tmp); + undef(@tmpz); + undef(@CDEF); + push(@tmp, "LINE2:chit#44EEEE:Hits"); + push(@tmp, "GPRINT:chit:LAST: Current\\: %5.1lf\\n"); + push(@tmp, "LINE2:chitp#4444EE:Hits for pass"); + push(@tmp, "GPRINT:chitp:LAST: Current\\: %5.1lf\\n"); + push(@tmp, "LINE2:cmiss#EE44EE:Misses"); + push(@tmp, "GPRINT:cmiss:LAST: Current\\: %5.1lf\\n"); + push(@tmpz, "LINE2:chit#44EEEE:Hits"); + push(@tmpz, "LINE2:chitp#4444EE:Hits for pass"); + push(@tmpz, "LINE2:cmiss#EE44EE:Misses"); + if(lc($config->{show_gaps}) eq "y") { + push(@tmp, "AREA:wrongdata#$colors->{gap}:"); + push(@tmpz, "AREA:wrongdata#$colors->{gap}:"); + push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF"); + } + ($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"); + } + $pic = $rrd{$version}->("$PNG_DIR" . "$PNG4", + "--title=$config->{graphs}->{_varnish4} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Values/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$cgi->{version12_small}}, + @{$colors->{graph_colors}}, + "DEF:chit=$rrd:varn0" . "_chit:AVERAGE", + "DEF:chitp=$rrd:varn0" . "_chitp:AVERAGE", + "DEF:cmiss=$rrd:varn0" . "_cmiss:AVERAGE", + "CDEF:allvalues=chit,chitp,cmiss,+,+", + @CDEF, + @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}); + $picz = $rrd{$version}->("$PNG_DIR" . "$PNG4z", + "--title=$config->{graphs}->{_varnish4} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Values/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$cgi->{version12_small}}, + @{$colors->{graph_colors}}, + "DEF:chit=$rrd:varn0" . "_chit:AVERAGE", + "DEF:chitp=$rrd:varn0" . "_chitp:AVERAGE", + "DEF:cmiss=$rrd:varn0" . "_cmiss:AVERAGE", + "CDEF:allvalues=chit,chitp,cmiss,+,+", + @CDEF, + @tmpz); + $err = RRDs::error; + print("ERROR: while graphing $PNG_DIR" . "$PNG4z: $err\n") if $err; + } + if($title || ($silent =~ /imagetag/ && $graph =~ /varnish4/)) { + if(lc($config->{enable_zoom}) eq "y") { + if(lc($config->{disable_javascript_void}) eq "y") { + print(" {url} . "/" . $config->{imgs_dir} . $PNG4z . "\">\n"); + } else { + if($version eq "new") { + $picz_width = $picz->{image_width} * $config->{global_zoom}; + $picz_height = $picz->{image_height} * $config->{global_zoom}; + } else { + $picz_width = $width + 115; + $picz_height = $height + 100; + } + print(" {url} . "/" . $config->{imgs_dir} . $PNG4z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n"); + } + } else { + print(" \n"); + } + } + + @riglim = @{setup_riglim($rigid[4], $limit[4])}; + undef(@tmp); + undef(@tmpz); + undef(@CDEF); + push(@tmp, "LINE2:nsob#EEEE44:N struct object"); + push(@tmp, "GPRINT:nsob:LAST: Current\\: %5.0lf\\n"); + push(@tmp, "LINE2:nsoc#44EEEE:N struct objectcore"); + push(@tmp, "GPRINT:nsoc:LAST: Current\\: %5.0lf\\n"); + push(@tmp, "LINE2:nsoh#4444EE:N struct objecthead"); + push(@tmp, "GPRINT:nsoh:LAST: Current\\: %5.0lf\\n"); + push(@tmp, "LINE2:nswl#EE44EE:N struct waitinglist"); + push(@tmp, "GPRINT:nswl:LAST: Current\\: %5.0lf\\n"); + push(@tmpz, "LINE2:nsob#EEEE44:N struct object"); + push(@tmpz, "LINE2:nsoc#44EEEE:N struct objectcore"); + push(@tmpz, "LINE2:nsoh#4444EE:N struct objecthead"); + push(@tmpz, "LINE2:nswl#EE44EE:N struct waitinglist"); + if(lc($config->{show_gaps}) eq "y") { + push(@tmp, "AREA:wrongdata#$colors->{gap}:"); + push(@tmpz, "AREA:wrongdata#$colors->{gap}:"); + push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF"); + } + ($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"); + } + $pic = $rrd{$version}->("$PNG_DIR" . "$PNG5", + "--title=$config->{graphs}->{_varnish5} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Objects", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$cgi->{version12_small}}, + @{$colors->{graph_colors}}, + "DEF:nsob=$rrd:varn0" . "_nsob:AVERAGE", + "DEF:nsoc=$rrd:varn0" . "_nsoc:AVERAGE", + "DEF:nsoh=$rrd:varn0" . "_nsoh:AVERAGE", + "DEF:nswl=$rrd:varn0" . "_nswl:AVERAGE", + "CDEF:allvalues=nsob,nsoc,nsoh,nswl,+,+,+", + @CDEF, + @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}); + $picz = $rrd{$version}->("$PNG_DIR" . "$PNG5z", + "--title=$config->{graphs}->{_varnish5} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Objects", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$cgi->{version12_small}}, + @{$colors->{graph_colors}}, + "DEF:nsob=$rrd:varn0" . "_nsob:AVERAGE", + "DEF:nsoc=$rrd:varn0" . "_nsoc:AVERAGE", + "DEF:nsoh=$rrd:varn0" . "_nsoh:AVERAGE", + "DEF:nswl=$rrd:varn0" . "_nswl:AVERAGE", + "CDEF:allvalues=nsob,nsoc,nsoh,nswl,+,+,+", + @CDEF, + @tmpz); + $err = RRDs::error; + print("ERROR: while graphing $PNG_DIR" . "$PNG5z: $err\n") if $err; + } + if($title || ($silent =~ /imagetag/ && $graph =~ /varnish5/)) { + if(lc($config->{enable_zoom}) eq "y") { + if(lc($config->{disable_javascript_void}) eq "y") { + print(" {url} . "/" . $config->{imgs_dir} . $PNG5z . "\">\n"); + } else { + if($version eq "new") { + $picz_width = $picz->{image_width} * $config->{global_zoom}; + $picz_height = $picz->{image_height} * $config->{global_zoom}; + } else { + $picz_width = $width + 115; + $picz_height = $height + 100; + } + print(" {url} . "/" . $config->{imgs_dir} . $PNG5z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n"); + } + } else { + print(" \n"); + } + } + + @riglim = @{setup_riglim($rigid[6], $limit[6])}; + undef(@tmp); + undef(@tmpz); + undef(@CDEF); + push(@tmp, "AREA:hdrb#EE44EE:Header"); + push(@tmp, "AREA:bodb#963C74:Body"); + push(@tmp, "AREA:bodb#963C74:"); + push(@tmp, "AREA:hdrb#EE44EE:"); + push(@tmp, "LINE1:bodb#963C74"); + push(@tmp, "LINE1:hdrb#EE00EE"); + push(@tmpz, "AREA:hdrb#EE44EE:Header"); + push(@tmpz, "AREA:bodb#963C74:Body"); + push(@tmpz, "AREA:bodb#963C74:"); + push(@tmpz, "AREA:hdrb#EE44EE:"); + push(@tmpz, "LINE1:bodb#963C74"); + push(@tmpz, "LINE1:hdrb#EE00EE"); + if(lc($config->{show_gaps}) eq "y") { + push(@tmp, "AREA:wrongdata#$colors->{gap}:"); + push(@tmpz, "AREA:wrongdata#$colors->{gap}:"); + push(@CDEF, "CDEF:wrongdata=allvalues,UN,INF,UNKN,IF"); + } + ($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"); + } + $pic = $rrd{$version}->("$PNG_DIR" . "$PNG6", + "--title=$config->{graphs}->{_varnish6} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Bytes/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$cgi->{version12_small}}, + @{$colors->{graph_colors}}, + "DEF:hdrb=$rrd:varn0" . "_hdrb:AVERAGE", + "DEF:bodb=$rrd:varn0" . "_bodb:AVERAGE", + "CDEF:allvalues=hdrb,bodb,+", + @CDEF, + @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}); + $picz = $rrd{$version}->("$PNG_DIR" . "$PNG6z", + "--title=$config->{graphs}->{_varnish6} ($tf->{nwhen}$tf->{twhen})", + "--start=-$tf->{nwhen}$tf->{twhen}", + "--imgformat=PNG", + "--vertical-label=Bytes/s", + "--width=$width", + "--height=$height", + @riglim, + $zoom, + @{$cgi->{version12}}, + @{$cgi->{version12_small}}, + @{$colors->{graph_colors}}, + "DEF:hdrb=$rrd:varn0" . "_hdrb:AVERAGE", + "DEF:bodb=$rrd:varn0" . "_bodb:AVERAGE", + "CDEF:allvalues=hdrb,bodb,+", + @CDEF, + @tmpz); + $err = RRDs::error; + print("ERROR: while graphing $PNG_DIR" . "$PNG6z: $err\n") if $err; + } + if($title || ($silent =~ /imagetag/ && $graph =~ /varnish6/)) { + if(lc($config->{enable_zoom}) eq "y") { + if(lc($config->{disable_javascript_void}) eq "y") { + print(" {url} . "/" . $config->{imgs_dir} . $PNG6z . "\">\n"); + } else { + if($version eq "new") { + $picz_width = $picz->{image_width} * $config->{global_zoom}; + $picz_height = $picz->{image_height} * $config->{global_zoom}; + } else { + $picz_width = $width + 115; + $picz_height = $height + 100; + } + print(" {url} . "/" . $config->{imgs_dir} . $PNG6z . "','','width=" . $picz_width . ",height=" . $picz_height . ",scrollbars=0,resizable=0'))\">\n"); + } + } else { + print(" \n"); + } + } + + if($title) { + print(" \n"); + print(" \n"); + main::graph_footer(); + } + print("
\n"); + return; +} + +1; diff --git a/monitorix.conf b/monitorix.conf index 5e02108..9b5aae8 100644 --- a/monitorix.conf +++ b/monitorix.conf @@ -92,6 +92,7 @@ secure_log_date_format = %b %e nginx = n lighttpd = n mysql = n + varnish = n squid = n nfss = n nfsc = n @@ -397,6 +398,14 @@ secure_log_date_format = %b %e +# VARNISH graph +# ----------------------------------------------------------------------------- + + rigid = 0, 0, 0, 0, 0, 0 + limit = 100, 100, 100, 100, 100, 100 + + + # SQUID graph # ----------------------------------------------------------------------------- @@ -700,7 +709,7 @@ logo_bottom = logo_bot.png remote = 300x100 -graph_name = system, kern, proc, hptemp, lmsens, nvidia, disk, fs, net, netstat, libvirt, process, serv, mail, port, user, ftp, apache, nginx, lighttpd, mysql, squid, nfss, nfsc, bind, ntp, fail2ban, icecast, raspberrypi, phpapc, memcached, apcupsd, wowza, int, verlihub +graph_name = system, kern, proc, hptemp, lmsens, nvidia, disk, fs, net, netstat, libvirt, process, serv, mail, port, user, ftp, apache, nginx, lighttpd, mysql, varnish, squid, nfss, nfsc, bind, ntp, fail2ban, icecast, raspberrypi, phpapc, memcached, apcupsd, wowza, int, verlihub system = System load average and usage @@ -724,6 +733,7 @@ graph_name = system, kern, proc, hptemp, lmsens, nvidia, disk, fs, net, netstat, nginx = Nginx statistics lighttpd = Lighttpd statistics mysql = MySQL statistics + varnish = Varnish statistics squid = Squid statistics nfss = NFS server statistics nfsc = NFS client statistics @@ -738,7 +748,6 @@ graph_name = system, kern, proc, hptemp, lmsens, nvidia, disk, fs, net, netstat, wowza = Wowza Media Server int = Devices interrupt activity verlihub = VerliHub statistics - @@ -818,6 +827,12 @@ graph_name = system, kern, proc, hptemp, lmsens, nvidia, disk, fs, net, netstat, _mysql4 = MySQL queries _mysql5 = MySQL connections _mysql6 = MySQL traffic + _varnish1 = Varnish statistics + _varnish2 = Backend usage + _varnish3 = Client connections + _varnish4 = Cache utilization + _varnish5 = Objects + _varnish6 = Traffic _squid1 = Squid statistics 1 _squid2 = Squid statistics 2 _squid3 = Overall I/O