Correctly cleanup self-monitoring sandboxes

Change-Id: I88e794d7bbd4b056d86fcb6ca9a4cbf610370037
This commit is contained in:
Swann Croiset 2017-01-25 14:36:54 +01:00
parent 389648c515
commit b19fd832da
2 changed files with 23 additions and 20 deletions

View File

@ -118,24 +118,23 @@ define lma_collector::heka (
$heka_monitoring_ensure = absent $heka_monitoring_ensure = absent
} }
if $heka_monitoring { heka::filter::sandbox { "heka_monitoring_${title}":
heka::filter::sandbox { "heka_monitoring_${title}": ensure => $heka_monitoring_ensure,
ensure => $heka_monitoring_ensure, config_dir => $config_dir,
config_dir => $config_dir, filename => "${lma_collector::params::plugins_dir}/filters/heka_monitoring.lua",
filename => "${lma_collector::params::plugins_dir}/filters/heka_monitoring.lua", message_matcher => "Type == 'heka.all-report'",
message_matcher => "Type == 'heka.all-report'", require => ::Heka[$title],
require => ::Heka[$title], module_directory => $lua_modules_dir,
module_directory => $lua_modules_dir, notify => Class[$service_class],
notify => Class[$service_class], }
}
# Dashboard is required to enable monitoring messages # Dashboard is required to enable monitoring messages
heka::output::dashboard { "dashboard_${title}": heka::output::dashboard { "dashboard_${title}":
config_dir => $config_dir, ensure => $heka_monitoring_ensure,
dashboard_address => $lma_collector::params::dashboard_address, config_dir => $config_dir,
dashboard_port => $dashboard_port, dashboard_address => $lma_collector::params::dashboard_address,
require => ::Heka[$title], dashboard_port => $dashboard_port,
notify => Class[$service_class], require => ::Heka[$title],
} notify => Class[$service_class],
} }
} }

View File

@ -67,8 +67,12 @@ describe 'lma_collector::heka' do
) )
should contain_heka__input__tcp('metric') should contain_heka__input__tcp('metric')
should contain_heka__decoder__sandbox('metric' ) should contain_heka__decoder__sandbox('metric' )
is_expected.to_not contain_heka__filter__sandbox('heka_monitoring_metric_collector') should contain_heka__filter__sandbox('heka_monitoring_metric_collector').with(
is_expected.to_not contain_heka__output__dashboard('dashboard_metric_collector' ) 'ensure' => 'absent'
)
should contain_heka__output__dashboard('dashboard_metric_collector' ).with(
'ensure' => 'absent'
)
} }
end end
end end