Skip to content

Commit

Permalink
Merge pull request #572 from matejzero/Interface-ReportInactive
Browse files Browse the repository at this point in the history
Add support for Interface plugin option ReportInactive
  • Loading branch information
jyaworski committed Nov 1, 2016
2 parents 4c81223 + 8df6390 commit 0a90335
Show file tree
Hide file tree
Showing 3 changed files with 27 additions and 1 deletion.
6 changes: 5 additions & 1 deletion manifests/plugin/interface.pp
Original file line number Diff line number Diff line change
Expand Up @@ -3,13 +3,17 @@
$ensure = 'present',
$interfaces = [],
$ignoreselected = false,
$reportinactive = true,
$interval = undef,
) {

include ::collectd

validate_array($interfaces)
validate_bool($ignoreselected)
validate_bool(
$ignoreselected,
$reportinactive,
)

collectd::plugin { 'interface':
ensure => $ensure,
Expand Down
19 changes: 19 additions & 0 deletions spec/classes/collectd_plugin_interface_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -38,4 +38,23 @@
is_expected.to compile.and_raise_error(%r{String})
end
end

context 'interface options should be set with collectd 5.6' do
let :facts do
{
osfamily: 'RedHat',
collectd_version: '5.6.0',
operatingsystemmajrelease: '7'
}
end
let :params do
{
reportinactive: true
}
end

it 'Will include ValuesPercentage in /etc/collectd.d/10-interface.conf' do
should contain_file('interface.load').with_content(%r{ReportInactive true})
end
end
end
3 changes: 3 additions & 0 deletions templates/plugin/interface.conf.erb
Original file line number Diff line number Diff line change
Expand Up @@ -3,4 +3,7 @@
Interface "<%=interface %>"
<% end -%>
IgnoreSelected <%= @ignoreselected %>
<% if scope.lookupvar('collectd::collectd_version_real') and scope.function_versioncmp([scope.lookupvar('collectd::collectd_version_real'), '5.6']) >= 0 -%>
ReportInactive <%= @reportinactive %>
<% end -%>
</Plugin>

0 comments on commit 0a90335

Please sign in to comment.