Correctly cleanup self-monitoring sandboxes

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

View File

@ -118,24 +118,23 @@ define lma_collector::heka (
$heka_monitoring_ensure = absent
}
if $heka_monitoring {
heka::filter::sandbox { "heka_monitoring_${title}":
ensure => $heka_monitoring_ensure,
config_dir => $config_dir,
filename => "${lma_collector::params::plugins_dir}/filters/heka_monitoring.lua",
message_matcher => "Type == 'heka.all-report'",
require => ::Heka[$title],
module_directory => $lua_modules_dir,
notify => Class[$service_class],
}
heka::filter::sandbox { "heka_monitoring_${title}":
ensure => $heka_monitoring_ensure,
config_dir => $config_dir,
filename => "${lma_collector::params::plugins_dir}/filters/heka_monitoring.lua",
message_matcher => "Type == 'heka.all-report'",
require => ::Heka[$title],
module_directory => $lua_modules_dir,
notify => Class[$service_class],
}
# Dashboard is required to enable monitoring messages
heka::output::dashboard { "dashboard_${title}":
config_dir => $config_dir,
dashboard_address => $lma_collector::params::dashboard_address,
dashboard_port => $dashboard_port,
require => ::Heka[$title],
notify => Class[$service_class],
}
# Dashboard is required to enable monitoring messages
heka::output::dashboard { "dashboard_${title}":
ensure => $heka_monitoring_ensure,
config_dir => $config_dir,
dashboard_address => $lma_collector::params::dashboard_address,
dashboard_port => $dashboard_port,
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__decoder__sandbox('metric' )
is_expected.to_not contain_heka__filter__sandbox('heka_monitoring_metric_collector')
is_expected.to_not contain_heka__output__dashboard('dashboard_metric_collector' )
should contain_heka__filter__sandbox('heka_monitoring_metric_collector').with(
'ensure' => 'absent'
)
should contain_heka__output__dashboard('dashboard_metric_collector' ).with(
'ensure' => 'absent'
)
}
end
end