Re: munin plugin with multiple instances of varnish
On 15/12/09 15:21, Kristian Lyngstol wrote: > On Fri, Dec 11, 2009 at 05:10:39PM +, Paul Mansfield wrote: >> I revamped my hacks and have attached my munin plugin, I renamed it to >> vanishm_ for multi instance. > > Could you provide a diff/patch? Easier to read... sure, it's appended > Is it compatible with varnish_ syntax? (Ie: should we just replace it?) yes, you can use either "multi-varnish syntax" varnishm_NAME__ASPECT or single varnish instance syntax as before varnishm_ASPECT since you seem to be happy to replace yours (I didn't want to tread on your toes and assume my hack was worthy!), I've renamed my plugin to varnish_; I've attached it too. > Also: you may want to add your own copyright notice below ours if you've > done significant work. I added a comment below your copyright to reflect my simple amendment Hope it proves useful to someone. We are using varnish quite extensively now and it's pretty good, thanks! Paul $ diff varnish_.old varnish_ 3c3 < # varnish_ - Munin plugin to for Varnish --- > # varnish_ - Munin plugin for Multiple Varnish Servers 7c7,9 < # --- > # Modified by Paul Mansfield so that it can be used with multiple > # varnish instances > # 641c643,645 < print "$title $values{$value}{$field}\n"; --- > print "$title $values{$value}{$field}"; > print " - $varnishname" if ($title eq 'graph_title'); > print "\n"; 684c688,689 < # Read and verify the aspect ($self). --- > # Read and verify the aspect ($self) - > # the format is varnish_NAME__aspect or varnish_aspect 688a694,699 > > if ($self =~ /^(\w+)__(.*)$/) > { > $varnishname = $1; > $self = $2; > } 788a800 > #print "$varnishname.$value.value "; 792a805,806 > > # end varnish_ plugin #!/usr/bin/perl -w # # varnish_ - Munin plugin for Multiple Varnish Servers # Copyright (C) 2009 Redpill Linpro AS # # Author: Kristian Lyngstøl # Modified by Paul Mansfield so that it can be used with multiple # varnish instances # # 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. use strict; # Set to 1 to enable output when a variable is defined in a graph but # omitted because it doesn't exist in varnishstat. my $DEBUG = 0; # Set to 1 to ignore 'DEBUG' and suggest all available aspects. my $FULL_SUGGEST = 0; # Varnishstat executable. Include full path if it's not in your path. my $varnishstatexec = exists $ENV{'varnishstat'} ? $ENV{'varnishstat'} : "varnishstat"; # For multiple instances my $varnishname = exists $ENV{'name'} ? $ENV{'name'} : undef; my %varnishstat = (); my %varnishstatnames = (); my $self; # Haha, myself, what a clever pun. # Parameters that can be defined on top level of a graph. Config will print # them as "graph_$foo $value\n" my @graph_parameters = ('title','total','order','scale','vlabel','args'); # Parameters that can be defined on a value-to-value basis and will be # blindly passed to config. Printed as "$fieldname.$param $value\n". # # 'label' is hardcoded as it defaults to a varnishstat-description if not # set. my @field_parameters = ('graph', 'min', 'max', 'draw', 'cdef', 'warning', 'colour', 'info', 'type'); # Data structure that defines all possible graphs (aspects) and how they # are to be plotted. Every top-level entry is a graph/aspect. Each top-level graph # MUST have title set and 'values'. # # The 'values' hash must have at least one value definition. The actual # value used is either fetched from varnishstat based on the value-name, or # if 'rpn' is defined: calculated. 'type' SHOULD be set. # # Graphs with 'DEBUG' set to anything is omitted from 'suggest'. # # 'rpn' on values allows easy access to graphs consisting of multiple # values from varnishstat. (Reverse polish notation). The RPN # implementation only accepts +-*/ and varnishstat-values. # # With the exception of 'label', which is filled with the # varnishstat-description if left undefined, any value left undefined will # be left up to Munin to define/ignore/yell about. # # See munin documentation or rrdgraph/rrdtool for more information. my %ASPECTS = ( 'request_rate' => { 'title' => 'Request rates', 'order' => 'cache_hit cache_hitpass cache_miss ' . 'backend_conn backend_
Re: munin plugin with multiple instances of varnish
On Fri, Dec 11, 2009 at 05:10:39PM +, Paul Mansfield wrote: > I revamped my hacks and have attached my munin plugin, I renamed it to > vanishm_ for multi instance. Could you provide a diff/patch? Easier to read... Is it compatible with varnish_ syntax? (Ie: should we just replace it?) Also: you may want to add your own copyright notice below ours if you've done significant work. -- Kristian Lyngstøl Redpill Linpro AS Tlf: +47 21544179 Mob: +47 99014497 pgpaJvJp9wEY2.pgp Description: PGP signature ___ varnish-dev mailing list varnish-dev@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-dev
Re: munin plugin with multiple instances of varnish
I revamped my hacks and have attached my munin plugin, I renamed it to vanishm_ for multi instance. Paul binH6JURJI4oe.bin Description: application/http-index-format #!/usr/bin/perl -w # # varnishm_ - Munin plugin for Multiple Varnish Servers # Copyright (C) 2009 Redpill Linpro AS # # Author: Kristian Lyngstøl # Modified by Paul Mansfield so that it can be used with multiple # varnish instances # # 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. use strict; # Set to 1 to enable output when a variable is defined in a graph but # omitted because it doesn't exist in varnishstat. my $DEBUG = 0; # Set to 1 to ignore 'DEBUG' and suggest all available aspects. my $FULL_SUGGEST = 0; # Varnishstat executable. Include full path if it's not in your path. my $varnishstatexec = exists $ENV{'varnishstat'} ? $ENV{'varnishstat'} : "varnishstat"; # For multiple instances my $varnishname = exists $ENV{'name'} ? $ENV{'name'} : undef; my %varnishstat = (); my %varnishstatnames = (); my $self; # Haha, myself, what a clever pun. # Parameters that can be defined on top level of a graph. Config will print # them as "graph_$foo $value\n" my @graph_parameters = ('title','total','order','scale','vlabel','args'); # Parameters that can be defined on a value-to-value basis and will be # blindly passed to config. Printed as "$fieldname.$param $value\n". # # 'label' is hardcoded as it defaults to a varnishstat-description if not # set. my @field_parameters = ('graph', 'min', 'max', 'draw', 'cdef', 'warning', 'colour', 'info', 'type'); # Data structure that defines all possible graphs (aspects) and how they # are to be plotted. Every top-level entry is a graph/aspect. Each top-level graph # MUST have title set and 'values'. # # The 'values' hash must have at least one value definition. The actual # value used is either fetched from varnishstat based on the value-name, or # if 'rpn' is defined: calculated. 'type' SHOULD be set. # # Graphs with 'DEBUG' set to anything is omitted from 'suggest'. # # 'rpn' on values allows easy access to graphs consisting of multiple # values from varnishstat. (Reverse polish notation). The RPN # implementation only accepts +-*/ and varnishstat-values. # # With the exception of 'label', which is filled with the # varnishstat-description if left undefined, any value left undefined will # be left up to Munin to define/ignore/yell about. # # See munin documentation or rrdgraph/rrdtool for more information. my %ASPECTS = ( 'request_rate' => { 'title' => 'Request rates', 'order' => 'cache_hit cache_hitpass cache_miss ' . 'backend_conn backend_unhealthy ' . 'client_req client_conn' , 'values' => { 'client_conn' => { 'type' => 'DERIVE', 'min' => '0', 'colour' => '44', 'graph' => 'ON' }, 'client_req' => { 'type' => 'DERIVE', 'colour' => '11', 'min' => '0' }, 'cache_hit' => { 'type' => 'DERIVE', 'draw' => 'AREA', 'colour' => '00FF00', 'min' => '0' }, 'cache_hitpass' => { 'info' => 'Hitpass are cached passes: An ' . 'entry in the cache instructing ' . 'Varnish to pass. Typically ' . 'achieved after a pass in ' . 'vcl_fetch.', 'type' => 'DERIVE', 'draw' => 'STACK', 'colour' => '00', 'min' => '0' }, 'cache_miss' => { 'type' => 'DERIVE', 'colour' => 'FF',
Re: munin plugin with multiple instances of varnish
d'oh, I realised that you couldn't tell the difference between the graphs of difference instances new version attached unfortunately this means you lose your old graphs. Maybe someone with better munin fu can fix what I hacked up? #!/usr/bin/perl -w # # varnish_ - Munin plugin to for Varnish # Copyright (C) 2009 Redpill Linpro AS # # Author: Kristian Lyngstøl # Modified by Paul Mansfield so that it can be used with multiple # varnish instances # # 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. use strict; # Set to 1 to enable output when a variable is defined in a graph but # omitted because it doesn't exist in varnishstat. my $DEBUG = 0; # Set to 1 to ignore 'DEBUG' and suggest all available aspects. my $FULL_SUGGEST = 0; # Varnishstat executable. Include full path if it's not in your path. my $varnishstatexec = exists $ENV{'varnishstat'} ? $ENV{'varnishstat'} : "varnishstat"; # For multiple instances my $varnishname = exists $ENV{'name'} ? $ENV{'name'} : undef; my %varnishstat = (); my %varnishstatnames = (); my $self; # Haha, myself, what a clever pun. # Parameters that can be defined on top level of a graph. Config will print # them as "graph_$foo $value\n" my @graph_parameters = ('title','total','order','scale','vlabel','args'); # Parameters that can be defined on a value-to-value basis and will be # blindly passed to config. Printed as "$fieldname.$param $value\n". # # 'label' is hardcoded as it defaults to a varnishstat-description if not # set. my @field_parameters = ('graph', 'min', 'max', 'draw', 'cdef', 'warning', 'colour', 'info', 'type'); # Data structure that defines all possible graphs (aspects) and how they # are to be plotted. Every top-level entry is a graph/aspect. Each top-level graph # MUST have title set and 'values'. # # The 'values' hash must have at least one value definition. The actual # value used is either fetched from varnishstat based on the value-name, or # if 'rpn' is defined: calculated. 'type' SHOULD be set. # # Graphs with 'DEBUG' set to anything is omitted from 'suggest'. # # 'rpn' on values allows easy access to graphs consisting of multiple # values from varnishstat. (Reverse polish notation). The RPN # implementation only accepts +-*/ and varnishstat-values. # # With the exception of 'label', which is filled with the # varnishstat-description if left undefined, any value left undefined will # be left up to Munin to define/ignore/yell about. # # See munin documentation or rrdgraph/rrdtool for more information. my %ASPECTS = ( 'request_rate' => { 'title' => 'Request rates', 'order' => 'cache_hit cache_hitpass cache_miss ' . 'backend_conn backend_unhealthy ' . 'client_req client_conn' , 'values' => { 'client_conn' => { 'type' => 'DERIVE', 'min' => '0', 'colour' => '44', 'graph' => 'ON' }, 'client_req' => { 'type' => 'DERIVE', 'colour' => '11', 'min' => '0' }, 'cache_hit' => { 'type' => 'DERIVE', 'draw' => 'AREA', 'colour' => '00FF00', 'min' => '0' }, 'cache_hitpass' => { 'info' => 'Hitpass are cached passes: An ' . 'entry in the cache instructing ' . 'Varnish to pass. Typically ' . 'achieved after a pass in ' . 'vcl_fetch.', 'type' => 'DERIVE', 'draw' => 'STACK', 'colour' => '00', 'min' => '0' }, 'cache_miss' => { 'type' => 'DERIVE',
Re: munin plugin with multiple instances of varnish
On 08/12/09 10:34, Paul Mansfield wrote: > here's a one-liner that will do the job; I opted to copy the RRDs rather > than rename, just in case... > > for Y in $X; do Z=`echo $Y | sed 's/varnish_/varnish_NAME__/'`; echo $Y > $Z; cp -p $Y $Z ; done oops, there was a preceding line missing so it should be X=`ls HOSTNAME*-varnish_* | grep -v varnish__` for Y in $X; do Z=`echo $Y | sed 's/varnish_/varnish_NAME__/'`; echo $Y $Z; cp -p $Y $Z ; done ___ varnish-dev mailing list varnish-dev@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-dev
Re: munin plugin with multiple instances of varnish
On 07/12/09 14:22, Paul Mansfield wrote: > hello, I've tried out the munin plugin and had to set "env.name > varnish1" so that I can measure the performance of the first of several > varnish instances > > is there a way please of monitoring more than one varnish instance with > the plugin written by Kristian Lyngstøl? I decided to go ahead and tweak the plugin to do this, by simply extending the formatting of the plugin name and retain backwards compatibility. It's attached. old format: varnish_hit_rate - still works varnish_NAME__hit_rate - produces stats for varnish instance NAME note the double underscore just in case your varnish instance has an underscore in its name! so all you have to do is rename existing plugins to reflect your varnish instance, and of course rename the RRD files on the master node. then you can create additional instances of the plugins for any additional instances of varnish! here's a one-liner that will do the job; I opted to copy the RRDs rather than rename, just in case... for Y in $X; do Z=`echo $Y | sed 's/varnish_/varnish_NAME__/'`; echo $Y $Z; cp -p $Y $Z ; done #!/usr/bin/perl -w # # varnish_ - Munin plugin to for Varnish # Copyright (C) 2009 Redpill Linpro AS # # Author: Kristian Lyngstøl # Modified by Paul Mansfield so that it can be used with multiple # varnish instances # # 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. use strict; # Set to 1 to enable output when a variable is defined in a graph but # omitted because it doesn't exist in varnishstat. my $DEBUG = 0; # Set to 1 to ignore 'DEBUG' and suggest all available aspects. my $FULL_SUGGEST = 0; # Varnishstat executable. Include full path if it's not in your path. my $varnishstatexec = exists $ENV{'varnishstat'} ? $ENV{'varnishstat'} : "varnishstat"; # For multiple instances my $varnishname = exists $ENV{'name'} ? $ENV{'name'} : undef; my %varnishstat = (); my %varnishstatnames = (); my $self; # Haha, myself, what a clever pun. # Parameters that can be defined on top level of a graph. Config will print # them as "graph_$foo $value\n" my @graph_parameters = ('title','total','order','scale','vlabel','args'); # Parameters that can be defined on a value-to-value basis and will be # blindly passed to config. Printed as "$fieldname.$param $value\n". # # 'label' is hardcoded as it defaults to a varnishstat-description if not # set. my @field_parameters = ('graph', 'min', 'max', 'draw', 'cdef', 'warning', 'colour', 'info', 'type'); # Data structure that defines all possible graphs (aspects) and how they # are to be plotted. Every top-level entry is a graph/aspect. Each top-level graph # MUST have title set and 'values'. # # The 'values' hash must have at least one value definition. The actual # value used is either fetched from varnishstat based on the value-name, or # if 'rpn' is defined: calculated. 'type' SHOULD be set. # # Graphs with 'DEBUG' set to anything is omitted from 'suggest'. # # 'rpn' on values allows easy access to graphs consisting of multiple # values from varnishstat. (Reverse polish notation). The RPN # implementation only accepts +-*/ and varnishstat-values. # # With the exception of 'label', which is filled with the # varnishstat-description if left undefined, any value left undefined will # be left up to Munin to define/ignore/yell about. # # See munin documentation or rrdgraph/rrdtool for more information. my %ASPECTS = ( 'request_rate' => { 'title' => 'Request rates', 'order' => 'cache_hit cache_hitpass cache_miss ' . 'backend_conn backend_unhealthy ' . 'client_req client_conn' , 'values' => { 'client_conn' => { 'type' => 'DERIVE', 'min' => '0', 'colour' => '44', 'graph' => 'ON' }, 'client_req' => { 'type' => 'DERIVE', 'colour' => '11', 'min' => '0' }, 'cache_hit' => { 'type' => 'DERIVE',
munin plugin with multiple instances of varnish
hello, I've tried out the munin plugin and had to set "env.name varnish1" so that I can measure the performance of the first of several varnish instances is there a way please of monitoring more than one varnish instance with the plugin written by Kristian Lyngstøl? thanks Paul ___ varnish-dev mailing list varnish-dev@projects.linpro.no http://projects.linpro.no/mailman/listinfo/varnish-dev