Skip to content

Commit 2c5e030

Browse files
author
Piotr Popieluch
committed
add new cpu plugin options introduced in collectd 5.5
1 parent 27c81f6 commit 2c5e030

3 files changed

Lines changed: 24 additions & 4 deletions

File tree

README.md

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -157,7 +157,9 @@ class { 'collectd::plugin::conntrack':
157157
```
158158

159159
####Class: `collectd::plugin::cpu`
160-
160+
reportbystate => true,
161+
reportbycpu => true,
162+
valuespercentage => true,
161163
```puppet
162164
class { 'collectd::plugin::cpu':
163165
}
@@ -977,4 +979,4 @@ This module shall not use unsupported configuration directives. Look at [templat
977979

978980
Please make use of the search by branch/tags on the collectd github to see when a function has been first released.
979981

980-
Reading the [collectd.conf.pod](https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod) file is good, validating the presence of the code in the .c files is even better.
982+
Reading the [collectd.conf.pod](https://github.com/collectd/collectd/blob/master/src/collectd.conf.pod) file is good, validating the presence of the code in the .c files is even better.

manifests/plugin/cpu.pp

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,21 @@
11
# https://collectd.org/wiki/index.php/Plugin:CPU
22
class collectd::plugin::cpu (
3-
$ensure = present,
4-
$interval = undef,
3+
$ensure = present,
4+
$reportbystate = true,
5+
$reportbycpu = true,
6+
$valuespercentage = false,
7+
$interval = undef,
58
) {
9+
10+
validate_bool(
11+
$reportbystate,
12+
$reportbycpu,
13+
$valuespercentage,
14+
)
15+
616
collectd::plugin {'cpu':
717
ensure => $ensure,
18+
content => template('collectd/plugin/cpu.conf.erb'),
819
interval => $interval,
920
}
1021
}

templates/plugin/cpu.conf.erb

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
<Plugin cpu>
2+
<% if @collectd_version and (scope.function_versioncmp([@collectd_version, '5.5']) >= 0) -%>
3+
ReportByState = <%= @reportbystate %>
4+
ReportByCpu = <%= @reportbycpu %>
5+
ValuesPercentage = <%= @valuespercentage %>
6+
<% end -%>
7+
</Plugin>

0 commit comments

Comments
 (0)