File tree 5 files changed +91
-0
lines changed
test/integration/datadog_etcd/serverspec
5 files changed +91
-0
lines changed Original file line number Diff line number Diff line change @@ -124,6 +124,21 @@ suites:
124
124
user : someuser
125
125
password : somepass
126
126
127
+ - name : datadog_etcd
128
+ run_list :
129
+ - recipe[datadog::etcd]
130
+ attributes :
131
+ datadog :
132
+ << : *DATADOG
133
+ etcd :
134
+ instances :
135
+ - url : http://localhost:2379
136
+ timeout : 5
137
+ ssl_keyfile : /etc/etcd/ssl.key
138
+ ssl_certfile : /etc/etcd/ssl.crt
139
+ ssl_cert_validation : true
140
+ ssl_ca_certs : /etc/etcd/ca-certs.crt
141
+
127
142
- name : datadog_docker
128
143
run_list :
129
144
- recipe[datadog::docker]
Original file line number Diff line number Diff line change
1
+ include_recipe 'datadog::dd-agent'
2
+
3
+ # Monitor etcd
4
+ #
5
+ # API endpoint of your etcd instance
6
+ # - url: "https://server:port"
7
+ # Change the time to wait on an etcd API request
8
+ # timeout: 5
9
+ #
10
+ # If certificate-based authentication of clients is enabled on your etcd server,
11
+ # specify the key file and the certificate file that the check should use.
12
+ # ssl_keyfile: /path/to/key/file
13
+ # ssl_certfile: /path/to/certificate/file
14
+ #
15
+ # Set to `false` to disable the validation of the server's SSL certificates (default: true).
16
+ # ssl_cert_validation: true
17
+ #
18
+ # If ssl_cert_validation is enabled, you can provide a custom file
19
+ # that lists trusted CA certificates (optional).
20
+ # ssl_ca_certs: /path/to/CA/certificate/file
21
+
22
+ datadog_monitor 'etcd' do
23
+ instances node [ 'datadog' ] [ 'etcd' ] [ 'instances' ]
24
+ end
Original file line number Diff line number Diff line change
1
+ instances:
2
+ <% @instances.each do |i| -%>
3
+ - url: <%= i['url'] %>
4
+ <% if i['timeout'] -%> timeout: <%= i['timeout'] %> <% end -%>
5
+ <% if i['ssl_keyfile'] -%> ssl_keyfile: <%= i['ssl_keyfile'] %> <% end -%>
6
+ <% if i['ssl_certfile'] -%> ssl_certfile: <%= i['ssl_certfile'] %> <% end -%>
7
+ <% if i['ssl_cert_validation'] -%> ssl_cert_validation: <%= i['ssl_cert_validation'] %> <% end -%>
8
+ <% if i['ssl_ca_certs'] -%> ssl_ca_certs: <%= i['ssl_ca_certs'] %> <% end -%>
9
+ <% end -%>
10
+
11
+ # Nothing to configure here
12
+ init_config:
Original file line number Diff line number Diff line change
1
+ source 'https://rubygems.org'
2
+
3
+ gem 'json_spec' , '~> 1.1'
Original file line number Diff line number Diff line change
1
+ # Encoding: utf-8
2
+ require 'json_spec'
3
+ require 'serverspec'
4
+ require 'yaml'
5
+
6
+ set :backend , :exec
7
+ set :path , '/sbin:/usr/local/sbin:$PATH'
8
+
9
+ AGENT_CONFIG = '/etc/dd-agent/conf.d/etcd.yaml'
10
+
11
+ describe service ( 'datadog-agent' ) do
12
+ it { should be_running }
13
+ end
14
+
15
+ describe file ( AGENT_CONFIG ) do
16
+ it { should be_a_file }
17
+
18
+ it 'is valid yaml matching input values' do
19
+ generated = YAML . load_file ( AGENT_CONFIG )
20
+
21
+ expected = {
22
+ 'instances' => [
23
+ {
24
+ 'url' => 'http://localhost:2379' ,
25
+ 'timeout' => 5 ,
26
+ 'ssl_keyfile' => '/etc/etcd/ssl.key' ,
27
+ 'ssl_certfile' => '/etc/etcd/ssl.crt' ,
28
+ 'ssl_cert_validation' => true ,
29
+ 'ssl_ca_certs' => '/etc/etcd/ca-certs.crt'
30
+ }
31
+ ] ,
32
+ 'init_config' => nil
33
+ }
34
+
35
+ expect ( generated . to_json ) . to be_json_eql expected . to_json
36
+ end
37
+ end
You can’t perform that action at this time.
0 commit comments