Skip to content

Commit

Permalink
[Integrations] Add support for Logs (#490)
Browse files Browse the repository at this point in the history
* [Logs] Add log-agent options to datadog.yaml

default to nil for all these options, as the log-agent itself
has sane default options when these parameters are missing

* [Integrations] Allow `logs` section to be taken into account

So we can generically add the logs section to the yaml integration files

* [Integrations] Update templates and recipes to include logs section
when configured.

See http://docs.datadoghq.com/logs/ for detailed configuration
  • Loading branch information
tmichelet authored and olivielpeau committed Nov 30, 2017
1 parent ebbe85b commit 168fb33
Show file tree
Hide file tree
Showing 153 changed files with 212 additions and 29 deletions.
7 changes: 7 additions & 0 deletions attributes/default.rb
Expand Up @@ -360,6 +360,13 @@
default['datadog']['process_agent']['container_interval'] = nil
default['datadog']['process_agent']['rtcontainer_interval'] = nil

# Logs functionality settings
# Set `enable_log_agent` to:
# * `true` to explicitly enable the log agent
# * `false` to explicitly disable it
# Leave it to `nil` to let the agent's default behavior decide whether to run the log-agent
default['datadog']['enable_logs_agent'] = nil

# For custom gem servers on restricted networks
# This attribute only works on Chef >= 12.3
# Change false to the URL of your custom gem server
Expand Down
3 changes: 2 additions & 1 deletion providers/monitor.rb
Expand Up @@ -25,7 +25,8 @@ def whyrun_supported?
variables(
init_config: new_resource.init_config,
instances: new_resource.instances,
version: new_resource.version
version: new_resource.version,
logs: new_resource.logs
)
cookbook new_resource.cookbook
sensitive true if Chef::Resource.instance_methods(false).include?(:sensitive)
Expand Down
1 change: 1 addition & 0 deletions recipes/activemq.rb
Expand Up @@ -22,4 +22,5 @@

datadog_monitor 'activemq' do
instances node['datadog']['activemq']['instances']
logs node['datadog']['activemq']['logs']
end
1 change: 1 addition & 0 deletions recipes/apache.rb
Expand Up @@ -19,4 +19,5 @@

datadog_monitor 'apache' do
instances node['datadog']['apache']['instances']
logs node['datadog']['apache']['logs']
end
1 change: 1 addition & 0 deletions recipes/cacti.rb
Expand Up @@ -40,4 +40,5 @@

datadog_monitor 'cacti' do
instances node['datadog']['cacti']['instances']
logs node['datadog']['cacti']['logs']
end
1 change: 1 addition & 0 deletions recipes/cassandra.rb
Expand Up @@ -38,4 +38,5 @@
datadog_monitor 'cassandra' do
instances node['datadog']['cassandra']['instances']
version node['datadog']['cassandra']['version']
logs node['datadog']['cassandra']['logs']
end
1 change: 1 addition & 0 deletions recipes/consul.rb
Expand Up @@ -30,4 +30,5 @@

datadog_monitor 'consul' do
instances node['datadog']['consul']['instances']
logs node['datadog']['consul']['logs']
end
1 change: 1 addition & 0 deletions recipes/couchbase.rb
Expand Up @@ -18,4 +18,5 @@

datadog_monitor 'couchbase' do
instances node['datadog']['couchbase']['instances']
logs node['datadog']['couchbase']['logs']
end
1 change: 1 addition & 0 deletions recipes/couchdb.rb
Expand Up @@ -20,4 +20,5 @@
datadog_monitor 'couch' do
init_config nil
instances node['datadog']['couch']['instances']
logs node['datadog']['couch']['logs']
end
1 change: 1 addition & 0 deletions recipes/directory.rb
Expand Up @@ -13,4 +13,5 @@

datadog_monitor 'directory' do
instances node['datadog']['directory']['instances']
logs node['datadog']['directory']['logs']
end
1 change: 1 addition & 0 deletions recipes/disk.rb
Expand Up @@ -32,4 +32,5 @@
datadog_monitor 'disk' do
instances node['datadog']['disk']['instances']
init_config nil
logs node['datadog']['disk']['logs']
end
1 change: 1 addition & 0 deletions recipes/dns_check.rb
Expand Up @@ -30,4 +30,5 @@

datadog_monitor 'dns_check' do
instances node['datadog']['dns_check']['instances']
logs node['datadog']['dns_check']['logs']
end
1 change: 1 addition & 0 deletions recipes/docker.rb
Expand Up @@ -46,4 +46,5 @@
datadog_monitor 'docker' do
init_config node['datadog']['docker']['init_config']
instances node['datadog']['docker']['instances']
logs node['datadog']['docker']['logs']
end
1 change: 1 addition & 0 deletions recipes/docker_daemon.rb
Expand Up @@ -76,4 +76,5 @@
datadog_monitor 'docker_daemon' do
init_config node['datadog']['docker_daemon']['init_config']
instances node['datadog']['docker_daemon']['instances']
logs node['datadog']['docker_daemon']['logs']
end
1 change: 1 addition & 0 deletions recipes/elasticsearch.rb
Expand Up @@ -57,4 +57,5 @@

datadog_monitor 'elastic' do
instances node['datadog']['elasticsearch']['instances']
logs node['datadog']['elasticsearch']['logs']
end
1 change: 1 addition & 0 deletions recipes/etcd.rb
Expand Up @@ -21,4 +21,5 @@

datadog_monitor 'etcd' do
instances node['datadog']['etcd']['instances']
logs node['datadog']['etcd']['logs']
end
1 change: 1 addition & 0 deletions recipes/fluentd.rb
Expand Up @@ -12,4 +12,5 @@

datadog_monitor 'fluentd' do
instances node['datadog']['fluentd']['instances']
logs node['datadog']['fluentd']['logs']
end
1 change: 1 addition & 0 deletions recipes/go-metro.rb
Expand Up @@ -78,4 +78,5 @@
datadog_monitor 'go-metro' do
init_config node['datadog']['go-metro']['init_config']
instances node['datadog']['go-metro']['instances']
logs node['datadog']['go-metro']['logs']
end
1 change: 1 addition & 0 deletions recipes/go_expvar.rb
Expand Up @@ -21,4 +21,5 @@
datadog_monitor 'go_expvar' do
init_config node['datadog']['go_expvar']['init_config']
instances node['datadog']['go_expvar']['instances']
logs node['datadog']['go_expvar']['logs']
end
1 change: 1 addition & 0 deletions recipes/gunicorn.rb
Expand Up @@ -27,4 +27,5 @@

datadog_monitor 'gunicorn' do
instances node['datadog']['gunicorn']['instances']
logs node['datadog']['gunicorn']['logs']
end
1 change: 1 addition & 0 deletions recipes/haproxy.rb
Expand Up @@ -16,4 +16,5 @@

datadog_monitor 'haproxy' do
instances node['datadog']['haproxy']['instances']
logs node['datadog']['haproxy']['logs']
end
1 change: 1 addition & 0 deletions recipes/hdfs.rb
Expand Up @@ -26,4 +26,5 @@

datadog_monitor 'hdfs' do
instances node['datadog']['hdfs']['instances']
logs node['datadog']['hdfs']['logs']
end
1 change: 1 addition & 0 deletions recipes/http_check.rb
Expand Up @@ -21,4 +21,5 @@

datadog_monitor 'http_check' do
instances node['datadog']['http_check']['instances']
logs node['datadog']['http_check']['logs']
end
1 change: 1 addition & 0 deletions recipes/iis.rb
Expand Up @@ -21,4 +21,5 @@

datadog_monitor 'iis' do
instances node['datadog']['iis']['instances']
logs node['datadog']['iis']['logs']
end
1 change: 1 addition & 0 deletions recipes/integrations.rb
Expand Up @@ -38,6 +38,7 @@
datadog_monitor name do
init_config node['datadog'][name]['init_config']
instances node['datadog'][name]['instances']
logs node['datadog'][name]['logs']
use_integration_template true
end
end
1 change: 1 addition & 0 deletions recipes/jenkins.rb
Expand Up @@ -20,4 +20,5 @@

datadog_monitor 'jenkins' do
instances node['datadog']['jenkins']['instances']
logs node['datadog']['jenkins']['logs']
end
1 change: 1 addition & 0 deletions recipes/jmx.rb
Expand Up @@ -19,4 +19,5 @@
# ]
datadog_monitor 'jmx' do
instances node['datadog']['jmx']['instances']
logs node['datadog']['jmx']['logs']
end
1 change: 1 addition & 0 deletions recipes/kafka.rb
Expand Up @@ -38,4 +38,5 @@
datadog_monitor 'kafka' do
instances node['datadog']['kafka']['instances']
version node['datadog']['kafka']['version']
logs node['datadog']['kafka']['logs']
end
1 change: 1 addition & 0 deletions recipes/kafka_consumer.rb
Expand Up @@ -13,4 +13,5 @@

datadog_monitor 'kafka_consumer' do
instances node['datadog']['kafka_consumer']['instances']
logs node['datadog']['kafka_consumer']['logs']
end
1 change: 1 addition & 0 deletions recipes/kubernetes.rb
Expand Up @@ -27,4 +27,5 @@

datadog_monitor 'kubernetes' do
instances node['datadog']['kubernetes']['instances']
logs node['datadog']['kubernetes']['logs']
end
1 change: 1 addition & 0 deletions recipes/kyototycoon.rb
Expand Up @@ -19,4 +19,5 @@

datadog_monitor 'kyototycoon' do
instances node['datadog']['kyototycoon']['instances']
logs node['datadog']['kyototycoon']['logs']
end
1 change: 1 addition & 0 deletions recipes/lighttpd.rb
Expand Up @@ -2,4 +2,5 @@

datadog_monitor 'lighttpd' do
instances node['datadog']['lighttpd']['instances']
logs node['datadog']['lighttpd']['logs']
end
1 change: 1 addition & 0 deletions recipes/memcache.rb
Expand Up @@ -16,4 +16,5 @@

datadog_monitor 'mcache' do
instances node['datadog']['memcache']['instances']
logs node['datadog']['memcache']['logs']
end
1 change: 1 addition & 0 deletions recipes/mesos.rb
Expand Up @@ -36,4 +36,5 @@
datadog_monitor 'mesos' do
init_config node['datadog']['mesos']['init_config']
instances node['datadog']['mesos']['instances']
logs node['datadog']['mesos']['logs']
end
1 change: 1 addition & 0 deletions recipes/mongo.rb
Expand Up @@ -11,4 +11,5 @@

datadog_monitor 'mongo' do
instances node['datadog']['mongo']['instances']
logs node['datadog']['mongo']['logs']
end
1 change: 1 addition & 0 deletions recipes/mysql.rb
Expand Up @@ -31,4 +31,5 @@

datadog_monitor 'mysql' do
instances node['datadog']['mysql']['instances']
logs node['datadog']['mysql']['logs']
end
1 change: 1 addition & 0 deletions recipes/network.rb
Expand Up @@ -13,4 +13,5 @@

datadog_monitor 'network' do
instances node['datadog']['network']['instances']
logs node['datadog']['network']['logs']
end
1 change: 1 addition & 0 deletions recipes/nginx.rb
Expand Up @@ -22,4 +22,5 @@

datadog_monitor 'nginx' do
instances node['datadog']['nginx']['instances']
logs node['datadog']['nginx']['logs']
end
1 change: 1 addition & 0 deletions recipes/ntp.rb
Expand Up @@ -15,4 +15,5 @@
# ]
datadog_monitor 'ntp' do
instances node['datadog']['ntp']['instances']
logs node['datadog']['ntp']['logs']
end
1 change: 1 addition & 0 deletions recipes/pgbouncer.rb
Expand Up @@ -36,4 +36,5 @@

datadog_monitor 'pgbouncer' do
instances node['datadog']['pgbouncer']['instances']
logs node['datadog']['pgbouncer']['logs']
end
1 change: 1 addition & 0 deletions recipes/php_fpm.rb
Expand Up @@ -15,4 +15,5 @@
# ]
datadog_monitor 'php_fpm' do
instances node['datadog']['php_fpm']['instances']
logs node['datadog']['php_fpm']['logs']
end
1 change: 1 addition & 0 deletions recipes/postfix.rb
Expand Up @@ -42,4 +42,5 @@

datadog_monitor 'postfix' do
instances postfix_instances
logs node['datadog']['postfix']['logs']
end
1 change: 1 addition & 0 deletions recipes/postgres.rb
Expand Up @@ -25,4 +25,5 @@

datadog_monitor 'postgres' do
instances node['datadog']['postgres']['instances']
logs node['datadog']['postgres']['logs']
end
1 change: 1 addition & 0 deletions recipes/process.rb
Expand Up @@ -26,4 +26,5 @@

datadog_monitor 'process' do
instances node['datadog']['process']['instances']
logs node['datadog']['process']['logs']
end
1 change: 1 addition & 0 deletions recipes/rabbitmq.rb
Expand Up @@ -19,4 +19,5 @@

datadog_monitor 'rabbitmq' do
instances node['datadog']['rabbitmq']['instances']
logs node['datadog']['rabbitmq']['logs']
end
1 change: 1 addition & 0 deletions recipes/redisdb.rb
Expand Up @@ -13,4 +13,5 @@
# ]
datadog_monitor 'redisdb' do
instances node['datadog']['redisdb']['instances']
logs node['datadog']['redisdb']['logs']
end
1 change: 1 addition & 0 deletions recipes/riak.rb
Expand Up @@ -10,4 +10,5 @@

datadog_monitor 'riak' do
instances node['datadog']['riak']['instances']
logs node['datadog']['riak']['logs']
end
1 change: 1 addition & 0 deletions recipes/snmp.rb
Expand Up @@ -112,4 +112,5 @@
datadog_monitor 'snmp' do
init_config node['datadog']['snmp']['init_config']
instances node['datadog']['snmp']['instances']
logs node['datadog']['snmp']['logs']
end
1 change: 1 addition & 0 deletions recipes/solr.rb
Expand Up @@ -7,4 +7,5 @@

datadog_monitor 'solr' do
instances node['datadog']['solr']['instances']
logs node['datadog']['solr']['logs']
end
1 change: 1 addition & 0 deletions recipes/sqlserver.rb
Expand Up @@ -63,4 +63,5 @@
datadog_monitor 'sqlserver' do
init_config node['datadog']['sqlserver']['init_config']
instances node['datadog']['sqlserver']['instances']
logs node['datadog']['sqlserver']['logs']
end
1 change: 1 addition & 0 deletions recipes/ssh_check.rb
Expand Up @@ -21,4 +21,5 @@

datadog_monitor 'ssh_check' do
instances node['datadog']['ssh_check']['instances']
logs node['datadog']['ssh_check']['logs']
end
1 change: 1 addition & 0 deletions recipes/supervisord.rb
Expand Up @@ -41,4 +41,5 @@

datadog_monitor 'supervisord' do
instances node['datadog']['supervisord']['instances']
logs node['datadog']['supervisord']['logs']
end
1 change: 1 addition & 0 deletions recipes/tcp_check.rb
Expand Up @@ -15,4 +15,5 @@

datadog_monitor 'tcp_check' do
instances node['datadog']['tcp_check']['instances']
logs node['datadog']['tcp_check']['logs']
end
1 change: 1 addition & 0 deletions recipes/tokumx.rb
Expand Up @@ -11,4 +11,5 @@

datadog_monitor 'tokumx' do
instances node['datadog']['tokumx']['instances']
logs node['datadog']['tokumx']['logs']
end
1 change: 1 addition & 0 deletions recipes/tomcat.rb
Expand Up @@ -22,4 +22,5 @@

datadog_monitor 'tomcat' do
instances node['datadog']['tomcat']['instances']
logs node['datadog']['tomcat']['logs']
end
1 change: 1 addition & 0 deletions recipes/varnish.rb
Expand Up @@ -23,4 +23,5 @@

datadog_monitor 'varnish' do
instances node['datadog']['varnish']['instances']
logs node['datadog']['varnish']['logs']
end
1 change: 1 addition & 0 deletions recipes/win32_event_log.rb
Expand Up @@ -20,4 +20,5 @@
datadog_monitor 'win32_event_log' do
init_config node['datadog']['win32_event_log']['init_config']
instances node['datadog']['win32_event_log']['instances']
logs node['datadog']['win32_event_log']['logs']
end
1 change: 1 addition & 0 deletions recipes/windows_service.rb
Expand Up @@ -57,4 +57,5 @@

datadog_monitor 'windows_service' do
instances node['datadog']['windows_service']['instances']
logs node['datadog']['windows_service']['logs']
end
1 change: 1 addition & 0 deletions recipes/zookeeper.rb
Expand Up @@ -7,4 +7,5 @@

datadog_monitor 'zk' do
instances node['datadog']['zookeeper']['instances']
logs node['datadog']['zookeeper']['logs']
end
3 changes: 2 additions & 1 deletion resources/monitor.rb
Expand Up @@ -6,10 +6,11 @@
attribute :name, :kind_of => String, :name_attribute => true
attribute :cookbook, :kind_of => String, :default => 'datadog'

# checks have 2 sections: init_config and instances
# checks have 3 sections: init_config, instances, logs
# we mimic these here, no validation is performed until the template
# is evaluated.
attribute :init_config, :kind_of => Hash, :required => false, :default => {}
attribute :instances, :kind_of => Array, :required => false, :default => []
attribute :logs, :kind_of => Array, :required => false, :default => []
attribute :version, :kind_of => Integer, :required => false, :default => nil
attribute :use_integration_template, :kind_of => [TrueClass, FalseClass], :required => false, :default => false
1 change: 1 addition & 0 deletions spec/integrations/activemq_spec.rb
@@ -1,5 +1,6 @@
describe 'datadog::activemq' do
expected_yaml = <<-EOF
logs: ~
instances:
- host: localhost
port: 1099
Expand Down

0 comments on commit 168fb33

Please sign in to comment.