Skip to content

Commit fbb8dff

Browse files
author
Alvin Huang
committed
additional params for rabbitmq.yaml template per dd example
1 parent c9edde6 commit fbb8dff

2 files changed

Lines changed: 69 additions & 11 deletions

File tree

manifests/integrations/rabbitmq.pp

Lines changed: 46 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,30 @@
1111
# If your service uses basic authentication, you can optionally
1212
# specify a username and password that will be used in the check.
1313
# (it's set to guest/guest by RabbitMQ on setup)
14+
# $tag_families
15+
# Tag queues "families" based on regex match
16+
# $ssl_verify
17+
# Skip verification of the RabbitMQ management web endpoint
18+
# SSL certificate
19+
# $nodes
20+
# $nodes_regexes
21+
# Specify the nodes to collect metrics on (up to 100 nodes).
22+
# If you have less than 100 nodes, metrics will be collected on all nodes
23+
# by default.
24+
# $queues
25+
# $queues_regexes
26+
# Specify the queues to collect metrics on (up to 200 queues).
27+
#
28+
# If you have less than 200 queues, metrics will be collected on all queues
29+
# by default.
30+
#
31+
# If vhosts are set, set queue names as `vhost_name/queue_name`
32+
#
33+
# If `tag families` are enabled, the first capture group in the regex will
34+
# be used as the queue_family tag
35+
# $vhosts
36+
# List of vhosts to monitor with service checks. By default, a list of all
37+
# vhosts is fetched and each one will be checked using the aliveness API.
1438
#
1539
# Sample Usage:
1640
#
@@ -22,12 +46,28 @@
2246
#
2347

2448
class datadog_agent::integrations::rabbitmq (
25-
$url = undef,
26-
$username = undef,
27-
$password = undef,
28-
$queues = undef,
29-
$vhosts = undef,
49+
$url = undef,
50+
$username = 'guest',
51+
$password = 'guest',
52+
$ssl_verify = true,
53+
$tag_families = false,
54+
$nodes = [],
55+
$nodes_regexes = [],
56+
$queues = [],
57+
$queues_regexes = [],
58+
$vhosts = [],
3059
) inherits datadog_agent::params {
60+
61+
validate_string($url)
62+
validate_string($username)
63+
validate_string($password)
64+
validate_bool($ssl_verify)
65+
validate_bool($tag_families)
66+
validate_array($nodes)
67+
validate_array($nodes_regexes)
68+
validate_array($queues)
69+
validate_array($queues_regexes)
70+
validate_array($vhosts)
3171
include datadog_agent
3272

3373
file { "${datadog_agent::params::conf_dir}/rabbitmq.yaml":
@@ -37,6 +77,6 @@
3777
mode => '0600',
3878
content => template('datadog_agent/agent-conf.d/rabbitmq.yaml.erb'),
3979
require => Package[$datadog_agent::params::package_name],
40-
notify => Service[$datadog_agent::params::service_name]
80+
notify => Service[$datadog_agent::params::service_name],
4181
}
4282
}

templates/agent-conf.d/rabbitmq.yaml.erb

Lines changed: 23 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,22 +2,40 @@ init_config:
22

33
instances:
44
- rabbitmq_api_url: <%= @url %>
5-
<% if @username -%>
65
rabbitmq_user: <%= @username %>
7-
<% end -%>
8-
<% if @password -%>
96
rabbitmq_pass: <%= @password %>
7+
ssl_verify: <%= @ssl_verify %>
8+
tag_families: <%= @tag_families %>
9+
10+
<% unless @nodes.empty? -%>
11+
nodes:
12+
<% @nodes.each do |x| -%>
13+
- <%= x %>
14+
<% end -%>
1015
<% end -%>
1116

12-
<% if @queues -%>
17+
<% unless @nodes_regexes.empty? -%>
18+
nodes_regexes:
19+
<% @nodes_regexes.each do |x| -%>
20+
- <%= x %>
21+
<% end -%>
22+
<% end -%>
23+
24+
<% unless @queues.empty? -%>
1325
queues:
1426
<% @queues.each do |x| -%>
1527
- <%= x %>
1628
<% end -%>
1729
<% end -%>
1830

31+
<% unless @queues_regexes.empty? -%>
32+
queues_regexes:
33+
<% @queues_regexes.each do |x| -%>
34+
- <%= x %>
35+
<% end -%>
36+
<% end -%>
1937

20-
<% if @vhosts -%>
38+
<% unless @vhosts.empty? -%>
2139
vhosts:
2240
<% @vhosts.each do |x| -%>
2341
- <%= x %>

0 commit comments

Comments
 (0)