-
Notifications
You must be signed in to change notification settings - Fork 260
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[cassandra] YAML configuration template versioning
* Enhance `DatadogMonitor` resource with a `version` attribute. * Use `version` attribute in `cassandra` recipe to version, i.e. select the appriopriate YAML configuration file. Two versions are currently available * `1` (Default): Legacy YAML configuration file, compatible with Cassandra < 2.2. * `2`: Required for Cassandra > 2.2, use the YAML configuration file * introduced with DataDog/dd-agent@2df7566 * Enable `cassandra_aliasing` option to comply with DataDog/dd-agent#2035 More information: DataDog/dd-agent#2142
- Loading branch information
1 parent
6c0d3e6
commit 876af73
Showing
9 changed files
with
297 additions
and
26 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 @@ | ||
default['datadog']['cassandra']['version'] = 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
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 |
---|---|---|
@@ -1,29 +1,41 @@ | ||
include_recipe 'datadog::dd-agent' | ||
|
||
# Monitor cassandra | ||
# | ||
# Assuming you have 2 clusters "test" and "prod", | ||
# one with and one without authentication | ||
# you need to set up the following attributes | ||
# | ||
# node['datadog']['cassandra']['instances'] = [ | ||
# { | ||
# host: 'localhost', | ||
# port: 7199, | ||
# name: 'prod', | ||
# user: 'username', | ||
# password: 'secret' | ||
# }, | ||
# { | ||
# server: 'localhost', | ||
# port: 8199, | ||
# name: 'test' | ||
# } | ||
# ] | ||
# | ||
# See here for more configuration values: | ||
# https://github.com/DataDog/dd-agent/blob/master/conf.d/cassandra.yaml.example | ||
# | ||
# Monitor Cassandra | ||
|
||
# Set the following attributes | ||
# * `instances` (required) | ||
# List of Cassandra clusters to monitor. Each cluster is generally a dictionary with a `host`, `port` and a `name`. | ||
# More attributes are available. For more information, please refer to : https://github.com/DataDog/dd-agent/blob/master/conf.d/cassandra.yaml.example | ||
# * `version` (optional) | ||
# Select the appropriate configuration file template. Available options are: | ||
# * `1` (Default, recommended for Cassandra < 2.2). | ||
# Use Cassandra legacy metrics, i.e. https://github.com/DataDog/dd-agent/blob/5.6.x/conf.d/cassandra.yaml.example#L23-L74 | ||
# * `2` (recommended for Cassandra >= 2.2). | ||
# Use Cassandra expanded metrics (CASSANDRA-4009) introduced in 1.2 (https://wiki.apache.org/cassandra/Metrics), | ||
# i.e. https://github.com/DataDog/dd-agent/blob/master/conf.d/cassandra.yaml.example#L23-L102 | ||
|
||
# Example: | ||
|
||
# ``` | ||
# node['datadog']['cassandra'] = | ||
# instances: [ | ||
# { | ||
# host: 'localhost', | ||
# port: 7199, | ||
# name: 'prod', | ||
# user: 'username', | ||
# password: 'secret' | ||
# }, | ||
# { | ||
# server: 'localhost', | ||
# port: 8199, | ||
# name: 'test' | ||
# }], | ||
# version: 2 | ||
# } | ||
# ``` | ||
|
||
datadog_monitor 'cassandra' do | ||
instances node['datadog']['cassandra']['instances'] | ||
version node['datadog']['cassandra']['version'] | ||
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
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
1 change: 1 addition & 0 deletions
1
test/integration/datadog_cassandra_greater_22/serverspec/Gemfile
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 @@ | ||
../../helpers/serverspec/Gemfile |
152 changes: 152 additions & 0 deletions
152
test/integration/datadog_cassandra_greater_22/serverspec/cassandra_spec.rb
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,152 @@ | ||
# Encoding: utf-8 | ||
require 'spec_helper' | ||
|
||
AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/cassandra.yaml') | ||
|
||
describe service(@agent_service_name) 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' => [ | ||
{ | ||
host: 'localhost', | ||
port: 7199, | ||
user: 'someuser', | ||
password: 'somepass', | ||
process_name_regex: '.*cassandra.*', | ||
cassandra_aliasing: true | ||
} | ||
], | ||
'init_config' => { | ||
conf: [ | ||
{ | ||
include: { | ||
domain: 'org.apache.cassandra.metrics', | ||
type: 'ClientRequest', | ||
scope: [ | ||
'Read', | ||
'Write' | ||
], | ||
name: [ | ||
'Latency', | ||
'Timeouts', | ||
'Unavailables' | ||
], | ||
attribute: [ | ||
'Count', | ||
'OneMinuteRate' | ||
] | ||
} | ||
}, | ||
{ | ||
include: { | ||
domain: 'org.apache.cassandra.metrics', | ||
type: 'ClientRequest', | ||
scope: [ | ||
'Read', | ||
'Write' | ||
], | ||
name: [ | ||
'TotalLatency' | ||
] | ||
} | ||
}, | ||
{ | ||
include: { | ||
domain: 'org.apache.cassandra.metrics', | ||
type: 'Storage', | ||
name: [ | ||
'Load', | ||
'Exceptions' | ||
] | ||
} | ||
}, | ||
{ | ||
include: { | ||
domain: 'org.apache.cassandra.metrics', | ||
type: 'ColumnFamily', | ||
name: %w( | ||
TotalDiskSpaceUsed | ||
BloomFilterDiskSpaceUsed | ||
BloomFilterFalsePositives | ||
BloomFilterFalseRatio | ||
CompressionRatio | ||
LiveDiskSpaceUsed | ||
LiveSSTableCount | ||
MaxRowSize | ||
MeanRowSize | ||
MemtableColumnsCount | ||
MemtableLiveDataSize | ||
MemtableSwitchCount | ||
MinRowSize) | ||
}, | ||
exclude: { | ||
keyspace: [ | ||
'system', | ||
'system_auth', | ||
'system_distributed', | ||
'system_traces' | ||
] | ||
} | ||
}, | ||
{ | ||
include: { | ||
domain: 'org.apache.cassandra.metrics', | ||
type: 'Cache', | ||
name: [ | ||
'Capacity', | ||
'Size' | ||
], | ||
attribute: [ | ||
'Value' | ||
] | ||
} | ||
}, | ||
{ | ||
include: { | ||
domain: 'org.apache.cassandra.metrics', | ||
type: 'Cache', | ||
name: [ | ||
'Hits', | ||
'Requests' | ||
], | ||
attribute: [ | ||
'Count' | ||
] | ||
} | ||
}, | ||
{ | ||
include: { | ||
domain: 'org.apache.cassandra.metrics', | ||
type: 'ThreadPools', | ||
path: 'request', | ||
name: [ | ||
'ActiveTasks', | ||
'CompletedTasks', | ||
'PendingTasks', | ||
'CurrentlyBlockedTasks' | ||
] | ||
} | ||
}, | ||
{ | ||
include: { | ||
domain: 'org.apache.cassandra.db', | ||
attribute: [ | ||
'UpdateInterval' | ||
] | ||
} | ||
} | ||
] | ||
} | ||
} | ||
|
||
expect(generated.to_json).to be_json_eql expected.to_json | ||
end | ||
end |