-
-
Notifications
You must be signed in to change notification settings - Fork 269
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
In collectd 5.7, the hugepages plugin have been added. This change adds it in puppet-collectd.
- Loading branch information
Showing
4 changed files
with
155 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,59 @@ | ||
#== Class: collectd::plugin::hugepages | ||
# | ||
# Class to manage hugepages write plugin for collectd | ||
# | ||
# Documentation: | ||
# https://collectd.org/documentation/manpages/collectd.conf.5.shtml#plugin_hugepages | ||
# | ||
# === Parameters | ||
# | ||
# [*ensure*] | ||
# Ensure param for collectd::plugin type. | ||
# Defaults to 'ensure' | ||
# | ||
# [*interval*] | ||
# Interval setting for the plugin | ||
# Defaults to undef | ||
# | ||
# [*report_per_node_hp*] | ||
# If enabled, information will be collected from the hugepage counters in | ||
# "/sys/devices/system/node/*/hugepages". This is used to check the per-node | ||
# hugepage statistics on a NUMA system. | ||
# Defaults to true | ||
# | ||
# [*report_root_hp*] | ||
# If enabled, information will be collected from the hugepage counters in | ||
# "/sys/kernel/mm/hugepages". This can be used on both NUMA and non-NUMA | ||
# systems to check the overall hugepage statistics. | ||
# Defaults to true | ||
# | ||
# [*values_pages*] | ||
# Whether to report hugepages metrics in number of pages | ||
# Defaults to true | ||
# | ||
# [*values_bytes*] | ||
# Whether to report hugepages metrics in bytes | ||
# Defaults to false | ||
# | ||
# [*values_percentage*] | ||
# Whether to report hugepages metrics in percentage | ||
# Defaults to false | ||
# | ||
class collectd::plugin::hugepages ( | ||
Enum['present', 'absent'] $ensure = 'present', | ||
Optional[Integer] $interval = undef, | ||
Boolean $report_per_node_hp = true, | ||
Boolean $report_root_hp = true, | ||
Boolean $values_pages = true, | ||
Boolean $values_bytes = false, | ||
Boolean $values_percentage = false, | ||
) { | ||
|
||
include collectd | ||
|
||
collectd::plugin { 'hugepages': | ||
ensure => $ensure, | ||
interval => $interval, | ||
content => epp('collectd/plugin/hugepages.conf.epp'), | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
require 'spec_helper' | ||
|
||
describe 'collectd::plugin::hugepages', type: :class do | ||
on_supported_os(baseline_os_hash).each do |os, facts| | ||
context "on #{os} " do | ||
let :facts do | ||
facts | ||
end | ||
|
||
options = os_specific_options(facts) | ||
context 'default' do | ||
it 'defaults' do | ||
content = <<EOS | ||
# Generated by Puppet | ||
<LoadPlugin hugepages> | ||
Globals false | ||
</LoadPlugin> | ||
<Plugin "hugepages"> | ||
ReportPerNodeHP true | ||
ReportRootHP true | ||
ValuesPages true | ||
ValuesBytes false | ||
ValuesPercentage false | ||
</Plugin> | ||
EOS | ||
|
||
is_expected.to compile.with_all_deps | ||
is_expected.to contain_file('hugepages.load').with( | ||
content: content, | ||
path: "#{options[:plugin_conf_dir]}/10-hugepages.conf" | ||
) | ||
end | ||
end | ||
|
||
options = os_specific_options(facts) | ||
context 'all set' do | ||
let :params do | ||
{ | ||
'report_per_node_hp' => false, | ||
'report_root_hp' => false, | ||
'values_pages' => false, | ||
'values_bytes' => true, | ||
'values_percentage' => true | ||
} | ||
end | ||
|
||
it 'overrides defaults' do | ||
content = <<EOS | ||
# Generated by Puppet | ||
<LoadPlugin hugepages> | ||
Globals false | ||
</LoadPlugin> | ||
<Plugin "hugepages"> | ||
ReportPerNodeHP false | ||
ReportRootHP false | ||
ValuesPages false | ||
ValuesBytes true | ||
ValuesPercentage true | ||
</Plugin> | ||
EOS | ||
|
||
is_expected.to compile.with_all_deps | ||
is_expected.to contain_class('collectd') | ||
is_expected.to contain_file('hugepages.load').with( | ||
content: content, | ||
path: "#{options[:plugin_conf_dir]}/10-hugepages.conf" | ||
) | ||
end | ||
end | ||
end | ||
end | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
<Plugin "hugepages"> | ||
ReportPerNodeHP <%= $collectd::plugin::hugepages::report_per_node_hp %> | ||
ReportRootHP <%= $collectd::plugin::hugepages::report_root_hp %> | ||
ValuesPages <%= $collectd::plugin::hugepages::values_pages %> | ||
ValuesBytes <%= $collectd::plugin::hugepages::values_bytes %> | ||
ValuesPercentage <%= $collectd::plugin::hugepages::values_percentage %> | ||
</Plugin> |