Browse Source

Merge "Collectd network configuration"

changes/00/803500/1
Zuul 2 months ago
committed by Gerrit Code Review
parent
commit
15e648ee57
  1. 3
      puppet-manifests/src/hieradata/global.yaml
  2. 26
      puppet-manifests/src/modules/platform/manifests/collectd.pp
  3. 7
      puppet-manifests/src/modules/platform/templates/collectd.conf.erb

3
puppet-manifests/src/hieradata/global.yaml

@ -32,8 +32,7 @@ platform::collectd::params::write_threads: 1
platform::collectd::params::max_read_interval: 86400
platform::collectd::params::write_queue_limit_high: 1000000
platform::collectd::params::write_queue_limit_low: 800000
platform::collectd::params::server_addrs: []
platform::collectd::params::server_port: 25826
platform::collectd::params::default_server_port: 25826
platform::collectd::params::collectd_d_dir: '/etc/collectd.d/starlingx'
# collectd: module named plugins

26
puppet-manifests/src/modules/platform/manifests/collectd.pp

@ -5,10 +5,11 @@ class platform::collectd::params (
$write_threads = undef,
$write_queue_limit_high = undef,
$write_queue_limit_low = undef,
$server_addrs = [],
$server_port = undef,
$max_read_interval = undef,
$network_servers = [],
$default_server_port = undef,
# python plugin controls
$module_path = undef,
$plugins = [],
@ -22,6 +23,27 @@ class platform::collectd::params (
class platform::collectd
inherits ::platform::collectd::params {
#Get port or set default one
$server_ports = $network_servers.map |$elem| {
if(split($elem, ':').size() > 2) {
if(']:' in $elem) {
split($elem, ':')[-1]
} else {
$default_server_port
}
} else {
if(':' in $elem) {
split($elem, ':')[-1]
} else {
$default_server_port
}
}
}
#Get address
$server_ips = $network_servers.map | $i, $elem| {
$address = regsubst($elem.delete(":${server_ports[$i]}"),'[\[\]]','','G')
}
file { '/etc/collectd.conf':
ensure => 'present',
replace => true,

7
puppet-manifests/src/modules/platform/templates/collectd.conf.erb

@ -81,12 +81,15 @@ WriteQueueLimitLow <%= @write_queue_limit_low %>
# LogLevel info
#</Plugin>
<% if @server_ips != [] -%>
# Have collectd send to these servers on server_port
<Plugin network>
<%- @server_addrs.each do |server_addr| -%>
Server "<%= server_addr %>" "<%= @server_port %>"
<%- @server_ips.each_with_index do |ip, index| -%>
Server "<%= ip %>" "<%= @server_ports[index] %>"
<%- end -%>
</Plugin>
<% end -%>
LoadPlugin python
<Plugin python>

Loading…
Cancel
Save