diff --git a/manifests/integrations/redis.pp b/manifests/integrations/redis.pp index 109788ff..a537b277 100644 --- a/manifests/integrations/redis.pp +++ b/manifests/integrations/redis.pp @@ -17,6 +17,8 @@ # Optional array of tags # $keys # Optional array of keys to check length +# $command_stats +# Collect INFO COMMANDSTATS output as metrics # # Sample Usage: # @@ -34,12 +36,15 @@ $tags = [], $keys = [], $warn_on_missing_keys = true, + $command_stats = false, + ) inherits datadog_agent::params { include datadog_agent validate_array($tags) validate_array($keys) validate_bool($warn_on_missing_keys) + validate_bool($command_stats) if $ports == undef { $_ports = [ $port ] diff --git a/spec/classes/datadog_agent_integrations_redis_spec.rb b/spec/classes/datadog_agent_integrations_redis_spec.rb index cc10fbe8..e15d9017 100644 --- a/spec/classes/datadog_agent_integrations_redis_spec.rb +++ b/spec/classes/datadog_agent_integrations_redis_spec.rb @@ -28,6 +28,7 @@ it { should contain_file(conf_file).without_content(%r{tags:}) } it { should contain_file(conf_file).without_content(%r{\bkeys:}) } it { should contain_file(conf_file).with_content(%r{warn_on_missing_keys: true}) } + it { should contain_file(conf_file).with_content(%r{command_stats: false}) } end context 'with parameters set' do @@ -39,6 +40,7 @@ tags: %w{foo bar}, keys: %w{baz bat}, warn_on_missing_keys: false, + command_stats: true, }} it { should contain_file(conf_file).with_content(%r{host: redis1}) } it { should contain_file(conf_file).with_content(%r{^[^#]*password: hunter2}) } @@ -47,6 +49,7 @@ it { should contain_file(conf_file).with_content(%r{tags:.*\s+- foo\s+- bar}) } it { should contain_file(conf_file).with_content(%r{keys:.*\s+- baz\s+- bat}) } it { should contain_file(conf_file).with_content(%r{warn_on_missing_keys: false}) } + it { should contain_file(conf_file).with_content(%r{command_stats: true}) } end end diff --git a/templates/agent-conf.d/redisdb.yaml.erb b/templates/agent-conf.d/redisdb.yaml.erb index 99c61e61..c522c45e 100644 --- a/templates/agent-conf.d/redisdb.yaml.erb +++ b/templates/agent-conf.d/redisdb.yaml.erb @@ -9,6 +9,7 @@ instances: - host: <%= @host %> port: <%= port %> warn_on_missing_keys: <%= @warn_on_missing_keys %> + command_stats: <%= @command_stats %> <% if @password.empty? %># <%end %>password: <%= @password %> # unix_socket_path: /var/run/redis/redis.sock # optional, can be used in lieu of host/port <% if @slowlog_max_len.empty? %># <%end %>slowlog-max-len: <%= @slowlog_max_len %>