From aaf55c9ebfa0e34f63b2ca3c2b660e1d164026dd Mon Sep 17 00:00:00 2001 From: Ewoud Kohl van Wijngaarden Date: Mon, 6 May 2013 18:13:12 +0200 Subject: lintify --- manifests/plugins/interfaces.pp | 30 +++++++++++++----------------- 1 file changed, 13 insertions(+), 17 deletions(-) (limited to 'manifests/plugins/interfaces.pp') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index da89ed0..b92802b 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,25 +1,21 @@ # handle if_ and if_err_ plugins -class munin::plugins::interfaces { +class munin::plugins::interfaces { + + $if_err_plugin = $::operatingsystem ? { + 'openbsd' => 'if_errcoll_', + default => 'if_err_', + } # filter out many of the useless interfaces that show up $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') - $ifs = regsubst($real_ifs, '(.+)', "if_\\1") + $ifs = regsubst($real_ifs, '(.+)', 'if_\1') + $if_errs = regsubst($real_ifs, '(.+)', "${if_err_plugin}\1") - munin::plugin { - $ifs: ensure => 'if_'; + munin::plugin { $ifs: + ensure => 'if_', } - case $::operatingsystem { - openbsd: { - $if_errs = regsubst($real_ifs, '(.+)', "if_errcoll_\\1") - munin::plugin{ - $if_errs: ensure => 'if_errcoll_'; - } - } - default: { - $if_errs = regsubst($real_ifs, '(.+)', "if_err_\\1") - munin::plugin{ - $if_errs: ensure => 'if_err_'; - } - } + + munin::plugin { $if_errs: + ensure => $if_err_plugin, } } -- cgit v1.2.3 From 03c50709169ee38cd5d759c461389b2a476fcc64 Mon Sep 17 00:00:00 2001 From: mh Date: Sun, 3 Nov 2013 17:52:36 +0100 Subject: use rather the stdlib prefix function than the good old regsubst hack --- manifests/plugins/interfaces.pp | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) (limited to 'manifests/plugins/interfaces.pp') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index b92802b..b795bc0 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -1,15 +1,16 @@ # handle if_ and if_err_ plugins class munin::plugins::interfaces { + # filter out many of the useless interfaces that show up + $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') + + $ifs = prefix($real_ifs, 'if_') + $if_err_plugin = $::operatingsystem ? { 'openbsd' => 'if_errcoll_', default => 'if_err_', } - - # filter out many of the useless interfaces that show up - $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') - $ifs = regsubst($real_ifs, '(.+)', 'if_\1') - $if_errs = regsubst($real_ifs, '(.+)', "${if_err_plugin}\1") + $if_errs = prefix($real_ifs, $if_err_plugin) munin::plugin { $ifs: ensure => 'if_', -- cgit v1.2.3 From 7e03247a9e219fe8e57d544957eb06e305e69fc1 Mon Sep 17 00:00:00 2001 From: intrigeri Date: Fri, 5 Dec 2014 20:07:47 +0000 Subject: Ignore vnet\d+ network interfaces, just like veth, virbr etc. --- manifests/plugins/interfaces.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/plugins/interfaces.pp') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index da89ed0..c57e887 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -2,7 +2,7 @@ class munin::plugins::interfaces { # filter out many of the useless interfaces that show up - $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|__tmp\d+') + $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|vnet\d+|__tmp\d+') $ifs = regsubst($real_ifs, '(.+)', "if_\\1") munin::plugin { -- cgit v1.2.3 From 6d7494bfe90819273bb6343911f410071b5561a8 Mon Sep 17 00:00:00 2001 From: Jerome Charaoui Date: Tue, 24 Feb 2015 11:25:56 -0500 Subject: Add class parameter to allow customisation of if plugin filter --- manifests/plugins/interfaces.pp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'manifests/plugins/interfaces.pp') diff --git a/manifests/plugins/interfaces.pp b/manifests/plugins/interfaces.pp index 35b41fd..2bbc1c6 100644 --- a/manifests/plugins/interfaces.pp +++ b/manifests/plugins/interfaces.pp @@ -2,7 +2,7 @@ class munin::plugins::interfaces { # filter out many of the useless interfaces that show up - $real_ifs = reject(split($::interfaces, ' |,'), 'eth\d+_\d+|sit0|virbr\d+_nic|vif\d+_\d+|veth\d+|vnet\d+|__tmp\d+') + $real_ifs = reject(split($::interfaces, ' |,'), $munin::if_filter) $ifs = prefix($real_ifs, 'if_') $if_err_plugin = $::operatingsystem ? { -- cgit v1.2.3