forked from DataDog/chef-datadog
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request DataDog#235 from mubi/add-etcd
Adding recipe and template for etcd integration.
- Loading branch information
Showing
5 changed files
with
91 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
include_recipe 'datadog::dd-agent' | ||
|
||
# Monitor etcd | ||
# | ||
# API endpoint of your etcd instance | ||
# - url: "https://server:port" | ||
# Change the time to wait on an etcd API request | ||
# timeout: 5 | ||
# | ||
# If certificate-based authentication of clients is enabled on your etcd server, | ||
# specify the key file and the certificate file that the check should use. | ||
# ssl_keyfile: /path/to/key/file | ||
# ssl_certfile: /path/to/certificate/file | ||
# | ||
# Set to `false` to disable the validation of the server's SSL certificates (default: true). | ||
# ssl_cert_validation: true | ||
# | ||
# If ssl_cert_validation is enabled, you can provide a custom file | ||
# that lists trusted CA certificates (optional). | ||
# ssl_ca_certs: /path/to/CA/certificate/file | ||
|
||
datadog_monitor 'etcd' do | ||
instances node['datadog']['etcd']['instances'] | ||
end |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
instances: | ||
<% @instances.each do |i| -%> | ||
- url: <%= i['url'] %> | ||
<% if i['timeout'] -%>timeout: <%= i['timeout'] %><% end -%> | ||
<% if i['ssl_keyfile'] -%>ssl_keyfile: <%= i['ssl_keyfile'] %><% end -%> | ||
<% if i['ssl_certfile'] -%>ssl_certfile: <%= i['ssl_certfile'] %><% end -%> | ||
<% if i['ssl_cert_validation'] -%>ssl_cert_validation: <%= i['ssl_cert_validation'] %><% end -%> | ||
<% if i['ssl_ca_certs'] -%>ssl_ca_certs: <%= i['ssl_ca_certs'] %><% end -%> | ||
<% end -%> | ||
|
||
# Nothing to configure here | ||
init_config: |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
source 'https://rubygems.org' | ||
|
||
gem 'json_spec', '~> 1.1' |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
# Encoding: utf-8 | ||
require 'json_spec' | ||
require 'serverspec' | ||
require 'yaml' | ||
|
||
set :backend, :exec | ||
set :path, '/sbin:/usr/local/sbin:$PATH' | ||
|
||
AGENT_CONFIG = '/etc/dd-agent/conf.d/etcd.yaml' | ||
|
||
describe service('datadog-agent') do | ||
it { should be_running } | ||
end | ||
|
||
describe file(AGENT_CONFIG) do | ||
it { should be_a_file } | ||
|
||
it 'is valid yaml matching input values' do | ||
generated = YAML.load_file(AGENT_CONFIG) | ||
|
||
expected = { | ||
'instances' => [ | ||
{ | ||
'url' => 'http://localhost:2379', | ||
'timeout' => 5, | ||
'ssl_keyfile' => '/etc/etcd/ssl.key', | ||
'ssl_certfile' => '/etc/etcd/ssl.crt', | ||
'ssl_cert_validation' => true, | ||
'ssl_ca_certs' => '/etc/etcd/ca-certs.crt' | ||
} | ||
], | ||
'init_config' => nil | ||
} | ||
|
||
expect(generated.to_json).to be_json_eql expected.to_json | ||
end | ||
end |