Skip to content

Commit 3e39a36

Browse files
nicholas-devlinremeh
authored andcommitted
Update README.md (#639)
* Update README.md wasn't able to figure out how to set nested attributes using the `extra_configs` field, so I added an example * Re-order README examples.
1 parent 16da76a commit 3e39a36

File tree

1 file changed

+24
-10
lines changed

1 file changed

+24
-10
lines changed

README.md

+24-10
Original file line numberDiff line numberDiff line change
@@ -135,7 +135,7 @@ The `:remove` action disables an integration.
135135

136136
### Syntax
137137

138-
```
138+
```ruby
139139
datadog_monitor 'name' do
140140
init_config Hash # default value: {}
141141
instances Array # default value: []
@@ -164,7 +164,7 @@ This example enables the ElasticSearch integration by using the `datadog_monitor
164164

165165
Note that the Agent installation needs to be earlier in the run list.
166166

167-
```
167+
```ruby
168168
include_recipe 'datadog::dd-agent'
169169

170170
datadog_monitor 'elastic'
@@ -190,7 +190,7 @@ integration remove` command.
190190

191191
### Syntax
192192

193-
```
193+
```ruby
194194
datadog_integration 'name' do
195195
version String # version to install for :install action.
196196
action Symbol # defaults to :install if not specified
@@ -215,7 +215,7 @@ using the `datadog_integration` resource.
215215

216216
Note that the Agent installation needs to be earlier in the run list.
217217

218-
```
218+
```ruby
219219
include_recipe 'datadog::dd-agent'
220220

221221
datadog_integration 'datadog-elastic'
@@ -268,24 +268,38 @@ file accordingly.
268268

269269
E.g.
270270

271-
```
271+
```ruby
272272
default_attributes(
273273
'datadog' => {
274274
'extra_config' => {
275-
'secret_backend_command' => '/sbin/local-secrets'
275+
'secret_backend_command' => '/sbin/local-secrets'
276276
}
277277
}
278278
)
279-
```
279+
```
280+
or
281+
```
282+
default['datadog']['extra_config']['secret_backend_command'] = '/sbin/local-secrets'`
283+
```
280284

281285
This example will set the field `secret_backend_command` in the configuration
282286
file `datadog.yaml`.
283287

288+
For nested attributes, use object syntax:
289+
290+
E.g.
291+
292+
```ruby
293+
default['datadog']['extra_config']['logs_config'] = { 'use_port_443' => true }`
294+
```
295+
296+
This example will set the field `logs_config` in the configuration file `datadog.yaml`.
297+
284298
### Agent v5
285299

286300
Since `3.0.0`, the cookbook defaults installing Agent v6. You can still setup the Agent v5 by setting `node['datadog']['agent6']` to false.
287301

288-
```
302+
```ruby
289303
default_attributes(
290304
'datadog' => {
291305
'agent6' => false
@@ -315,7 +329,7 @@ Note that there are Agent v6 counterparts to several well known Agent v5 attribu
315329
316330
You will need to indicate that you want to setup an Agent v5 instead of v6, pin the Agent v5 version that you want to install and allow downgrade:
317331
318-
```
332+
```ruby
319333
default_attributes(
320334
'datadog' => {
321335
'agent6' => false,
@@ -342,7 +356,7 @@ You will need to indicate that you want to setup an Agent v5 instead of v6, pin
342356
4. Enable Agent integrations by including their recipes and configuration details in your role’s run-list and attributes.
343357
Note that you can also create additional integrations recipes by using the `datadog_monitor` resource.
344358
5. Associate the recipes with the desired `roles`, i.e. "role:chef-client" should contain "datadog::dd-handler" and a "role:base" should start the agent with "datadog::dd-agent". Here's an example role with both recipes plus the MongoDB integration enabled.
345-
```
359+
```ruby
346360
name 'example'
347361
description 'Example role using DataDog'
348362

0 commit comments

Comments
 (0)