Puppet config options for AMQP1 sensubility transport

This patch introduces configuration options to setup collectd
sensubility to use the AMQP1 transport. This is primarily for
STF compatability.

Change-Id: I5a153004e0175f6826bfd10ac25b7e6f9ce09b96
(cherry picked from commit 275dfedb9d)
This commit is contained in:
pleimer 2020-10-15 14:49:28 -04:00 committed by Paul Leimer
parent 58a2ab94a0
commit 0ed0f2a2e9
2 changed files with 38 additions and 12 deletions

View File

@ -104,6 +104,19 @@
# (Optional) String. Rule which will be saved in /etc/sudoers.d for user specified
# by parameter exec_user.
# Defaults to undef
#
# [*results_format*]
# (Optional) String. Set message format compatability. Options are
# [smartgateway,sensu]
# Defaults to smartgateway
#
# [*results_channel*]
# String. Target AMQP1 channel address to which messages should be sent
# Defaults to undef
#
# [*transport*]
# String. Bus type for message transport. Options are 'sensu' (rabbitmq) or 'amqp1'
# Defaults to 'sensu'
class tripleo::profile::base::metrics::collectd::sensubility (
$ensure = 'present',
$config_path = '/etc/collectd-sensubility.conf',
@ -124,7 +137,10 @@ class tripleo::profile::base::metrics::collectd::sensubility (
$amqp_password = undef,
$exec_user = 'collectd',
$exec_group = 'collectd',
$exec_sudo_rule = undef
$exec_sudo_rule = undef,
$results_format = 'smartgateway',
$results_channel = undef,
$transport = 'sensu'
) {
include collectd
include collectd::plugin::exec
@ -151,7 +167,10 @@ class tripleo::profile::base::metrics::collectd::sensubility (
amqp_host => $amqp_host,
amqp_port => $amqp_port,
amqp_user => $amqp_user,
amqp_password => $amqp_password
amqp_password => $amqp_password,
results_format => $results_format,
results_channel => $results_channel,
transport => $transport
})
}

View File

@ -10,9 +10,12 @@
Optional[Integer] $worker_count,
Optional[String] $checks,
Optional[String] $amqp_host,
Optional[String] $amqp_port,
Optional[Integer] $amqp_port,
Optional[String] $amqp_user,
Optional[String] $amqp_password
Optional[String] $amqp_password,
Optional[String] $results_format,
Optional[String] $results_channel,
Variant[Enum['sensu','amqp1']] $transport
| -%>
[default]
@ -24,6 +27,7 @@ log_level=<%=$log_level%>
<%- } -%>
[sensu]
<% if $transport == 'sensu' { -%>
<% unless $connection =~ Undef { -%>
connection=<%=$connection%>
<%- } -%>
@ -36,6 +40,7 @@ client_name=<%=$client_name%>
<% unless $client_address =~ Undef { -%>
client_address=<%=$client_address%>
<%- } -%>
<%- } -%>
<% unless $keepalive_interval =~ Undef { -%>
keepalive_interval=<%=$keepalive_interval%>
<%- } -%>
@ -53,15 +58,17 @@ checks=<%=$checks%>
<%- } -%>
[amqp1]
<% unless $amqp_host =~ Undef { -%>
host=<%=$amqp_host%>
<% if $transport == 'amqp1' { -%>
<% unless $client_address =~ Undef and $amqp_port =~ Undef { -%>
connection=amqp://<%=$client_address%>:<%=$amqp_port%>
<%- } -%>
<% unless $amqp_port =~ Undef { -%>
port=<%=$amqp_port%>
<% unless $results_channel =~ Undef { -%>
results_channel=<%=$results_channel%>
<%- } -%>
<% unless $amqp_user =~ Undef { -%>
user=<%=$amqp_user%>
<% unless $client_name =~ Undef { -%>
client_name=<%=$client_name%>
<%- } -%>
<% unless $results_format =~ Undef { -%>
results_format=<%=$results_format%>
<%- } -%>
<% unless $amqp_password =~ Undef { -%>
password=<%=$amqp_password%>
<%- } -%>