Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

turbotstat: Add LogicalCoreNames option #815

Merged
merged 1 commit into from
Jun 13, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 2 additions & 1 deletion manifests/plugin/turbostat.pp
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,12 @@
Optional[Boolean] $digital_temperature_sensor = undef,
Optional[Integer] $tcc_activation_temp = undef,
Optional[Integer] $running_average_power_limit = undef,
Optional[Boolean] $logical_core_names = undef,
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

datatypes \o/

) {
include ::collectd

collectd::plugin { 'turbostat':
ensure => $ensure,
content => template('collectd/plugin/turbostat.conf.erb'),
content => epp('collectd/plugin/turbostat.conf.epp'),
}
}
18 changes: 18 additions & 0 deletions spec/classes/collectd_plugin_turbostat_spec.rb
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,24 @@
end
end

context ':ensure => present and :logical_core_names => true and collectd 5.7' do
let :facts do
facts.merge(collectd_version: '5.7')
end

let :params do
{ logical_core_names: true }
end

it "Will create #{options[:plugin_conf_dir]}/10-turbostat.conf" do
is_expected.to contain_file('turbostat.load').with(
ensure: 'present',
path: "#{options[:plugin_conf_dir]}/10-turbostat.conf",
content: %r{LogicalCoreNames "true"}m
)
end
end

context ':ensure => present and :tcc_activation_temp => 40' do
let :params do
{ tcc_activation_temp: 40 }
Expand Down
25 changes: 25 additions & 0 deletions templates/plugin/turbostat.conf.epp
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
<Plugin turbostat>
<% if $collectd::plugin::turbostat::core_c_states { -%>
CoreCstates "<%= $collectd::plugin::turbostat::core_c_states %>"
<% } -%>
<% if $collectd::plugin::turbostat::package_c_states { -%>
PackageCstates "<%= $collectd::plugin::turbostat::package_c_states %>"
<% } -%>
<% if $collectd::plugin::turbostat::system_management_interrupt != undef { -%>
SystemManagementInterrupt "<%= $collectd::plugin::turbostat::system_management_interrupt %>"
<% } -%>
<% if $collectd::plugin::turbostat::digital_temperature_sensor != undef { -%>
DigitalTemperatureSensor "<%= $collectd::plugin::turbostat::digital_temperature_sensor %>"
<% } -%>
<% if $collectd::plugin::turbostat::tcc_activation_temp { -%>
TCCActivationTemp "<%= $collectd::plugin::turbostat::tcc_activation_temp %>"
<% } -%>
<% if $collectd::plugin::turbostat::running_average_power_limit { -%>
RunningAveragePowerLimit "<%= $collectd::plugin::turbostat::running_average_power_limit %>"
<% } -%>
<% if versioncmp($collectd::collectd_version_real, '5.7') >= 0 { -%>
<% if $collectd::plugin::turbostat::logical_core_names { -%>
LogicalCoreNames "<%= $collectd::plugin::turbostat::logical_core_names %>"
<% } -%>
<% } -%>
</Plugin>
20 changes: 0 additions & 20 deletions templates/plugin/turbostat.conf.erb

This file was deleted.