From 5562eec22d2d15cb181cf937f334f4e6b66ef311 Mon Sep 17 00:00:00 2001 From: Kjetil Torgrim Homme Date: Fri, 13 Nov 2020 15:02:00 +0100 Subject: [PATCH] support multiple instances of varnish If you make a symlink like varnish4_shop_request_rate (etc.), you can add plugin configuration [varnish4_shop_*] env.name shop and it will run all commands with -n shop to get the stats for that instance. --- plugins/varnish/varnish4_ | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/plugins/varnish/varnish4_ b/plugins/varnish/varnish4_ index 54ecd3fa..8b74f0fd 100755 --- a/plugins/varnish/varnish4_ +++ b/plugins/varnish/varnish4_ @@ -631,15 +631,15 @@ my %ASPECTS = ( }, 'bans_tested' => { 'type' => 'DERIVE', - 'min' => '0' + 'min' => '0' }, 'bans_obj_killed' => { 'type' => 'DERIVE', - 'min' => '0' + 'min' => '0' }, 'bans_tests_tested' => { 'type' => 'DERIVE', - 'min' => '0' + 'min' => '0' }, 'bans_dups' => { 'type' => 'GAUGE' @@ -1031,6 +1031,9 @@ sub set_aspect { $self = $0; $self =~ s/^.*\/varnish[0-9]?_//; + return if defined($ASPECTS{$self}); + # remove instance name and try again + $self =~ s/^.*?_//; if (!defined($ASPECTS{$self}) && @ARGV == 0) { usage "No such aspect"; }