forked from redhat-openstack/openstack-puppet-modules
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request redhat-openstack#289 from kurpipio/master
add support for aggregation plugin and chains
- Loading branch information
Showing
6 changed files
with
208 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,16 @@ | ||
# | ||
class collectd::plugin::aggregation ( | ||
$ensure = present, | ||
$interval = undef, | ||
$aggregators = { }, | ||
) { | ||
|
||
collectd::plugin {'aggregation': | ||
ensure => $ensure, | ||
interval => $interval, | ||
} | ||
$defaults = { | ||
'ensure' => $ensure | ||
} | ||
create_resources(collectd::plugin::aggregation::aggregator, $aggregators, $defaults) | ||
} |
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,34 @@ | ||
# | ||
define collectd::plugin::aggregation::aggregator ( | ||
$ensure = 'present', | ||
$host = undef, | ||
$plugin = undef, | ||
$plugininstance = undef, | ||
$type = undef, | ||
$typeinstance = undef, | ||
$sethost = undef, | ||
$setplugin = undef, | ||
$setplugininstance = undef, | ||
$settypeinstance = undef, | ||
$groupby = [], | ||
$calculatesum = undef, | ||
$calculatenum = undef, | ||
$calculateaverage = undef, | ||
$calculateminimum = undef, | ||
$calculatemaximum = undef, | ||
$calculatestddev = undef, | ||
) { | ||
include collectd::params | ||
include collectd::plugin::aggregation | ||
|
||
$conf_dir = $collectd::params::plugin_conf_dir | ||
|
||
file { "${conf_dir}/aggregator-${name}.conf": | ||
ensure => $ensure, | ||
mode => '0640', | ||
owner => 'root', | ||
group => $collectd::params::root_group, | ||
content => template('collectd/plugin/aggregation-aggregator.conf.erb'), | ||
notify => Service['collectd'], | ||
} | ||
} |
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,20 @@ | ||
# | ||
class collectd::plugin::chain ( | ||
$chainname = 'Main', | ||
$ensure = 'present', | ||
$defaulttarget = 'write', | ||
$rules = [] | ||
) { | ||
include collectd::params | ||
|
||
$conf_dir = $collectd::params::plugin_conf_dir | ||
|
||
file { "${conf_dir}/99-chain-${chainname}.conf": | ||
ensure => $ensure, | ||
mode => '0640', | ||
owner => 'root', | ||
group => $collectd::params::root_group, | ||
content => template('collectd/plugin/chain.conf.erb'), | ||
notify => Service['collectd'], | ||
} | ||
} |
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,55 @@ | ||
<Plugin "aggregation"> | ||
<Aggregation> | ||
<% unless @host.nil? -%> | ||
Host "<%= @host %>" | ||
<% end -%> | ||
<% unless @plugin.nil? -%> | ||
Plugin "<%= @plugin %>" | ||
<% end -%> | ||
<% unless @plugininstance.nil? -%> | ||
PluginInstance "<%= @plugininstance %>" | ||
<% end -%> | ||
<% unless @type.nil? -%> | ||
Type "<%= @type %>" | ||
<% end -%> | ||
<% unless @typeinstance.nil? -%> | ||
TypeInstance "<%= @typeinstance %>" | ||
<% end -%> | ||
|
||
<% unless @sethost.nil? -%> | ||
SetHost "<%= @sethost %>" | ||
<% end -%> | ||
<% unless @setplugin.nil? -%> | ||
SetPlugin "<%= @setplugin %>" | ||
<% end -%> | ||
<% unless @setplugininstance.nil? -%> | ||
SetPluginInstance "<%= @setplugininstance %>" | ||
<% end -%> | ||
<% unless @settypeinstance.nil? -%> | ||
SetTypeInstance "<%= @settypeinstance %>" | ||
<% end -%> | ||
|
||
<% @groupby.each do |groupby| -%> | ||
GroupBy "<%= groupby %>" | ||
<% end -%> | ||
|
||
<% unless @calculatesum.nil? -%> | ||
CalculateSum <%= @calculatesum %> | ||
<% end -%> | ||
<% unless @calculatenum.nil? -%> | ||
CalculateNum <%= @calculatenum %> | ||
<% end -%> | ||
<% unless @calculateaverage.nil? -%> | ||
CalculateAverage <%= @calculateaverage %> | ||
<% end -%> | ||
<% unless @calculateminimum.nil? -%> | ||
CalculateMinimum <%= @calculateminimum %> | ||
<% end -%> | ||
<% unless @calculatemaximum.nil? -%> | ||
CalculateMaximum <%= @calculatemaximum %> | ||
<% end -%> | ||
<% unless @calculatestddev.nil? -%> | ||
CalculateStddev <%= @calculatestddev %> | ||
<% end -%> | ||
</Aggregation> | ||
</Plugin> |
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,23 @@ | ||
<Chain "<%= @chainname %>"> | ||
<% @rules.each do |rule| -%> | ||
<Rule> | ||
<Match "<%= rule['match']['type'] %>"> | ||
<% rule['match']["matches"].each do |key, value| -%> | ||
<%= key %> "<%= value %>" | ||
<% end -%> | ||
</Match> | ||
<% rule['targets'].each do |target| -%> | ||
<% if target['attributes'].nil? -%> | ||
Target "<%= target['type'] %>" | ||
<% else -%> | ||
<Target "<%= target['type'] %>"> | ||
<% target['attributes'].each do |key, value| -%> | ||
<%= key %> "<%= value %>" | ||
<% end -%> | ||
</Target> | ||
<% end -%> | ||
<% end -%> | ||
</Rule> | ||
<% end -%> | ||
Target "<%= @defaulttarget %>" | ||
</Chain> |