├── .circleci └── config.yml ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE │ ├── bug-report.md │ └── feature-request.md ├── pull_request_template.md └── workflows │ └── codeql-analysis.yml ├── .gitignore ├── .rspec ├── .rubocop.yml ├── Berksfile ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Gemfile ├── Gemfile.lock ├── LICENSE ├── NOTICE ├── README.md ├── Rakefile ├── attributes ├── cassandra.rb ├── default.rb ├── go-metro.rb ├── kafka.rb └── network.rb ├── chefignore ├── docker_test_env ├── Dockerfile ├── docker.rb.patch └── entrypoint.sh ├── kitchen.docker.yml ├── kitchen.yml ├── libraries ├── recipe_helpers.rb └── test_helpers.rb ├── metadata.rb ├── recipes ├── _agent6_config.rb ├── _install-fips-proxy-linux.rb ├── _install-linux.rb ├── _install-windows.rb ├── active_directory.rb ├── activemq.rb ├── activemq_xml.rb ├── aerospike.rb ├── airflow.rb ├── amazon_msk.rb ├── ambari.rb ├── apache.rb ├── aspdotnet.rb ├── btrfs.rb ├── cacti.rb ├── cassandra.rb ├── cassandra_nodetool.rb ├── ceph.rb ├── cilium.rb ├── cisco_aci.rb ├── clickhouse.rb ├── cloud_foundry_api.rb ├── cockroachdb.rb ├── confluent_platform.rb ├── consul.rb ├── couchbase.rb ├── couchdb.rb ├── custom_log_collection.rb ├── dd-agent.rb ├── dd-fips-proxy.rb ├── dd-handler.rb ├── ddtrace-ruby.rb ├── default.rb ├── directory.rb ├── disk.rb ├── dns_check.rb ├── docker.rb ├── docker_daemon.rb ├── dogstatsd-ruby.rb ├── dotnetclr.rb ├── druid.rb ├── elasticsearch.rb ├── envoy.rb ├── etcd.rb ├── flink.rb ├── fluentd.rb ├── gearmand.rb ├── gitlab.rb ├── gitlab_runner.rb ├── go-metro.rb ├── go_expvar.rb ├── gunicorn.rb ├── haproxy.rb ├── hazelcast.rb ├── hdfs.rb ├── hdfs_datanode.rb ├── hdfs_namenode.rb ├── hive.rb ├── hivemq.rb ├── http_check.rb ├── hyperv.rb ├── ibm_mq.rb ├── ignite.rb ├── iis.rb ├── install_info.rb ├── integrations.rb ├── istio.rb ├── jboss_wildfly.rb ├── jenkins.rb ├── jmx.rb ├── kafka.rb ├── kafka_consumer.rb ├── kong.rb ├── kube_apiserver_metrics.rb ├── kubernetes.rb ├── kyototycoon.rb ├── lighttpd.rb ├── mapreduce.rb ├── marathon.rb ├── marklogic.rb ├── memcache.rb ├── mesos_master.rb ├── mesos_slave.rb ├── mongo.rb ├── mysql.rb ├── network.rb ├── nfsstat.rb ├── nginx.rb ├── nginx_ingress_controller.rb ├── ntp.rb ├── openmetrics.rb ├── pdh_check.rb ├── pgbouncer.rb ├── php_fpm.rb ├── postfix.rb ├── postgres.rb ├── process.rb ├── proxysql.rb ├── rabbitmq.rb ├── redisdb.rb ├── remove-dd-agent.rb ├── repository.rb ├── rethinkdb.rb ├── riak.rb ├── security-agent.rb ├── sidekiq.rb ├── snmp.rb ├── solr.rb ├── spark.rb ├── sqlserver.rb ├── squid.rb ├── ssh_check.rb ├── statsd.rb ├── supervisord.rb ├── system-probe.rb ├── system_core.rb ├── system_swap.rb ├── systemd.rb ├── tcp_check.rb ├── teamcity.rb ├── tenable.rb ├── tls.rb ├── tokumx.rb ├── tomcat.rb ├── twistlock.rb ├── varnish.rb ├── vault.rb ├── vertica.rb ├── vsphere.rb ├── weblogic.rb ├── win32_event_log.rb ├── windows_service.rb ├── wmi_check.rb ├── yarn.rb └── zookeeper.rb ├── resources ├── integration.rb └── monitor.rb ├── spec ├── dd-agent_spec.rb ├── dd-handler_spec.rb ├── default_spec.rb ├── integrations │ ├── activemq_spec.rb │ ├── cassandra_spec.rb │ ├── couchbase_spec.rb │ ├── directory_spec.rb │ ├── disk_spec.rb │ ├── dns_check_spec.rb │ ├── docker_daemon_spec.rb │ ├── elasticsearch_spec.rb │ ├── etcd_spec.rb │ ├── gearmand_spec.rb │ ├── go-metro_spec.rb │ ├── go_expvar_spec.rb │ ├── gunicorn_spec.rb │ ├── hive_spec.rb │ ├── iis_spec.rb │ ├── integration_spec.rb │ ├── integrations_spec.rb │ ├── jmx_spec.rb │ ├── kafka_consumer_spec.rb │ ├── kafka_spec.rb │ ├── kubernetes_spec.rb │ ├── mesos_master_spec.rb │ ├── mesos_slave_spec.rb │ ├── mongo_spec.rb │ ├── nginx_spec.rb │ ├── php_fpm_spec.rb │ ├── postfix_spec.rb │ ├── postgres_spec.rb │ ├── rabbitmq_spec.rb │ ├── redis_spec.rb │ ├── snmp_spec.rb │ ├── solr_spec.rb │ ├── sqlserver_spec.rb │ ├── system_core_spec.rb │ ├── system_swap_spec.rb │ ├── systemd_spec.rb │ ├── tokumx_spec.rb │ ├── win32_event_log_spec.rb │ ├── windows_service_spec.rb │ └── wmi_check_spec.rb ├── recipe_helpers_spec.rb ├── remove-dd-agent_spec.rb ├── repository_spec.rb ├── security-agent_spec.rb ├── shared_examples.rb ├── spec_helper.rb └── system-probe_spec.rb ├── tasks ├── config_specification.rb ├── config_specification │ ├── models.rb │ ├── monitor_serializer.rb │ ├── overrider.rb │ ├── parameters_serializer.rb │ ├── template_cache.rb │ └── yaml_expander.rb ├── create_integration_monitor.rake └── release.rake ├── templates └── default │ ├── activemq.yaml.erb │ ├── apache.yaml.erb │ ├── cacti.yaml.erb │ ├── cassandra.yaml.erb │ ├── consul.yaml.erb │ ├── couch.yaml.erb │ ├── couchbase.yaml.erb │ ├── custom_log_collection.yaml.erb │ ├── datadog.conf.erb │ ├── datadog.yaml.erb │ ├── directory.yaml.erb │ ├── disk.yaml.erb │ ├── dns_check.yaml.erb │ ├── docker.yaml.erb │ ├── docker_daemon.yaml.erb │ ├── elastic.yaml.erb │ ├── etcd.yaml.erb │ ├── fluentd.yaml.erb │ ├── gearmand.yaml.erb │ ├── go-metro.yaml.erb │ ├── go_expvar.yaml.erb │ ├── gunicorn.yaml.erb │ ├── haproxy.yaml.erb │ ├── hdfs.yaml.erb │ ├── http_check.yaml.erb │ ├── iis.yaml.erb │ ├── install_info.yaml.erb │ ├── integration.yaml.erb │ ├── jenkins.yaml.erb │ ├── jmx.yaml.erb │ ├── kafka.yaml.erb │ ├── kafka_consumer.yaml.erb │ ├── kubernetes.yaml.erb │ ├── kyototycoon.yaml.erb │ ├── lighttpd.yaml.erb │ ├── mcache.yaml.erb │ ├── mesos_master.yaml.erb │ ├── mesos_slave.yaml.erb │ ├── mongo.yaml.erb │ ├── mysql.yaml.erb │ ├── network.yaml.erb │ ├── nginx.yaml.erb │ ├── ntp.yaml.erb │ ├── pgbouncer.yaml.erb │ ├── php_fpm.yaml.erb │ ├── postfix.yaml.erb │ ├── postgres.yaml.erb │ ├── process.yaml.erb │ ├── rabbitmq.yaml.erb │ ├── redisdb.yaml.erb │ ├── security-agent.yaml.erb │ ├── snmp.yaml.erb │ ├── solr.yaml.erb │ ├── sqlserver.yaml.erb │ ├── ssh_check.yaml.erb │ ├── supervisord.yaml.erb │ ├── system_core.yaml.erb │ ├── system_probe.yaml.erb │ ├── system_swap.yaml.erb │ ├── systemd.yaml.erb │ ├── tcp_check.yaml.erb │ ├── tokumx.yaml.erb │ ├── tomcat.yaml.erb │ ├── varnish.yaml.erb │ ├── vault.yaml.erb │ ├── win32_event_log.yaml.erb │ ├── windows_service.yaml.erb │ ├── wmi_check.yaml.erb │ └── zk.yaml.erb └── test ├── cookbooks └── test │ ├── metadata.rb │ └── recipes │ ├── dd_integration_resource.rb │ ├── monitor_add.rb │ └── monitor_remove.rb └── integration ├── datadog_apache └── serverspec_datadog │ ├── Gemfile │ └── apache_spec.rb ├── datadog_cacti └── serverspec_datadog │ ├── Gemfile │ └── cacti_spec.rb ├── datadog_cassandra └── serverspec_datadog │ ├── Gemfile │ └── cassandra_spec.rb ├── datadog_cassandra_greater_22 └── serverspec_datadog │ ├── Gemfile │ └── cassandra_spec.rb ├── datadog_consul └── serverspec_datadog │ ├── Gemfile │ └── consul_spec.rb ├── datadog_couchdb └── serverspec_datadog │ ├── Gemfile │ └── couchdb_spec.rb ├── datadog_docker └── serverspec_datadog │ ├── Gemfile │ └── docker_spec.rb ├── datadog_elasticsearch └── serverspec_datadog │ ├── Gemfile │ └── elasticsearch_spec.rb ├── datadog_etcd └── serverspec_datadog │ ├── Gemfile │ └── etcd_spec.rb ├── datadog_fluentd └── serverspec_datadog │ ├── Gemfile │ └── fluentd_spec.rb ├── datadog_gearmand └── serverspec_datadog │ └── gearmand_spec.rb ├── datadog_haproxy └── serverspec_datadog │ ├── Gemfile │ └── haproxy_spec.rb ├── datadog_http_check └── serverspec_datadog │ ├── Gemfile │ └── http_check_spec.rb ├── datadog_integrations └── serverspec_datadog │ ├── Gemfile │ └── integrations_spec.rb ├── datadog_jmx └── serverspec_datadog │ ├── Gemfile │ └── dd-agent-jmx_spec.rb ├── datadog_kafka └── serverspec_datadog │ ├── Gemfile │ └── kafka_spec.rb ├── datadog_kafka_consumer └── serverspec_datadog │ └── kafka_consumer_spec.rb ├── datadog_mesos_master └── serverspec_datadog │ ├── Gemfile │ └── mesos_spec.rb ├── datadog_mesos_slave └── serverspec_datadog │ ├── Gemfile │ └── mesos_spec.rb ├── datadog_mongo └── serverspec_datadog │ └── mongo_spec.rb ├── datadog_mysql └── serverspec_datadog │ ├── Gemfile │ └── mysql_spec.rb ├── datadog_ntp └── serverspec_datadog │ ├── Gemfile │ └── ntp_spec.rb ├── datadog_pgbouncer └── serverspec_datadog │ ├── Gemfile │ └── pgbouncer_spec.rb ├── datadog_postfix └── serverspec_datadog │ ├── Gemfile │ └── postfix_spec.rb ├── datadog_process └── serverspec_datadog │ ├── Gemfile │ └── dd-agent-process_spec.rb ├── datadog_rabbitmq └── serverspec_datadog │ └── rabbitmq_spec.rb ├── datadog_ssh_check └── serverspec_datadog │ ├── Gemfile │ └── ssh_check_spec.rb ├── datadog_supervisord └── serverspec_datadog │ ├── Gemfile │ └── supervisord_spec.rb ├── datadog_systemd └── serverspec_datadog │ └── systemd_spec.rb ├── datadog_tcp_check └── serverspec_datadog │ ├── Gemfile │ └── tcp_check_spec.rb ├── datadog_vault └── serverspec_datadog │ ├── Gemfile │ └── vault_spec.rb ├── dd-agent-gpgcheck-older └── serverspec_datadog │ ├── Gemfile │ ├── dd-agent_spec.rb │ └── dd-handler_spec.rb ├── dd-agent-gpgcheck-recent └── serverspec_datadog │ ├── Gemfile │ ├── dd-agent_spec.rb │ └── dd-handler_spec.rb ├── dd-agent-handler └── serverspec_datadog │ ├── dd-agent_spec.rb │ └── dd-handler_spec.rb ├── dd-agent-handler5 └── serverspec_datadog │ ├── Gemfile │ ├── dd-agent_spec.rb │ └── dd-handler_spec.rb ├── dd-agent-handler6 └── serverspec_datadog │ ├── Gemfile │ ├── dd-agent_spec.rb │ └── dd-handler_spec.rb ├── dd-agent-handler7 └── serverspec_datadog │ ├── Gemfile │ ├── dd-agent_spec.rb │ └── dd-handler_spec.rb ├── dd-agent-iot └── serverspec_datadog │ ├── dd-agent_spec.rb │ └── install_info_spec.rb ├── dd-agent └── serverspec_datadog │ ├── dd-agent_spec.rb │ └── install_info_spec.rb ├── dd-handler └── serverspec_datadog │ └── dd-handler_spec.rb ├── dd_integration_resource └── serverspec_datadog │ ├── Gemfile │ └── resource_integration_spec.rb ├── default └── bats │ └── sanity.bats └── helpers └── serverspec_datadog ├── Gemfile ├── spec_helper.rb └── spec_template.rb /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | * @DataDog/container-ecosystems 2 | 3 | # Docs 4 | *README.md @DataDog/container-ecosystems @DataDog/documentation 5 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/bug-report.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Bug Report 3 | about: Identify a bug in the scripts 4 | title: "[BUG] " 5 | labels: triage 6 | assignees: '' 7 | 8 | --- 9 | 10 | 14 | 15 | 16 | **Environment details (Operating System, Cloud provider, etc):** 17 | 18 | 19 | **Describe what happened:** 20 | 21 | 22 | **Describe what you expected:** 23 | 24 | 25 | **Steps to reproduce the issue:** 26 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE/feature-request.md: -------------------------------------------------------------------------------- 1 | --- 2 | name: Feature Request 3 | about: Suggest a new feature 4 | title: '' 5 | labels: '' 6 | assignees: '' 7 | 8 | --- 9 | 10 | This issue tracker is primarily used to track bugs in the scripts. For feature requests, please contact [Datadog support](http://docs.datadoghq.com/help/) and share your ideas with them. 11 | 12 | Thanks! 13 | -------------------------------------------------------------------------------- /.github/pull_request_template.md: -------------------------------------------------------------------------------- 1 | 11 | ### What does this PR do? 12 | 13 | 18 | 19 | ### Motivation 20 | 21 | 25 | 26 | ### Additional Notes 27 | 28 | 34 | 35 | ### Possible Drawbacks / Trade-offs 36 | 37 | 40 | 41 | ### Describe how to test/QA your changes 42 | 43 | 47 | 48 | ### Reviewer's Checklist 49 | 54 | -------------------------------------------------------------------------------- /.github/workflows/codeql-analysis.yml: -------------------------------------------------------------------------------- 1 | name: "CodeQL" 2 | 3 | on: 4 | push: 5 | branches: [ main ] 6 | pull_request: 7 | # The branches below must be a subset of the branches above 8 | branches: [ main ] 9 | 10 | permissions: {} 11 | 12 | jobs: 13 | analyze: 14 | name: Analyze 15 | runs-on: ubuntu-latest 16 | permissions: 17 | actions: read 18 | contents: read 19 | security-events: write 20 | 21 | strategy: 22 | fail-fast: false 23 | matrix: 24 | language: [ 'ruby' ] 25 | # CodeQL supports [ 'cpp', 'csharp', 'go', 'java', 'javascript', 'python', 'ruby' ] 26 | # Learn more about CodeQL language support at https://git.io/codeql-language-support 27 | 28 | steps: 29 | - name: Checkout repository 30 | uses: actions/checkout@v3 31 | 32 | # Initializes the CodeQL tools for scanning. 33 | - name: Initialize CodeQL 34 | uses: github/codeql-action/init@v2 35 | with: 36 | languages: ${{ matrix.language }} 37 | # If you wish to specify custom queries, you can do so here or in a config file. 38 | # By default, queries listed here will override any specified in a config file. 39 | # Prefix the list here with "+" to use these queries and those in the config file. 40 | # queries: ./path/to/local/query, your-org/your-repo/queries@main 41 | 42 | # Autobuild attempts to build any compiled languages (C/C++, C#, or Java). 43 | # If this step fails, then you should remove it and run the build manually 44 | - name: Autobuild 45 | uses: github/codeql-action/autobuild@v2 46 | 47 | - name: Perform CodeQL Analysis 48 | uses: github/codeql-action/analyze@v2 49 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | # bundler 2 | .bundle 3 | Gemfile*.lock 4 | 5 | # For MacOS: 6 | .DS_Store 7 | 8 | # For Ruby Managers 9 | .rbenv-version 10 | .ruby-version 11 | .ruby-gemset 12 | .rvmrc 13 | 14 | # For TextMate 15 | *.tmproj 16 | 17 | # For emacs: 18 | *~ 19 | *# 20 | .#* 21 | \#*# 22 | 23 | # For vim: 24 | .*.sw[a-z] 25 | 26 | # For Vagrant 27 | .vagrant 28 | 29 | # Berkshelf 30 | Berksfile.lock 31 | /.ruby-version 32 | 33 | # Test-Kitchen 34 | .kitchen/ 35 | .kitchen.local.yml 36 | 37 | # Coverage 38 | coverage/ 39 | 40 | # Local environment managaers 41 | .env 42 | .envrc 43 | -------------------------------------------------------------------------------- /.rspec: -------------------------------------------------------------------------------- 1 | --color 2 | --format progress 3 | --order rand 4 | --require spec_helper 5 | --tag focus 6 | --tag ~wip 7 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | # inherit_from: .rubocop_todo.yml 2 | # Stylistic choices of this cookbook. 3 | 4 | # We still have HashRockets in a lot of places, ignore them. 5 | Style/HashSyntax: 6 | Enabled: false 7 | 8 | # We're fine with multi-line blocks defined with `{...}` instead of `do...end` 9 | Style/BlockDelimiters: 10 | Enabled: false 11 | 12 | Style/PercentLiteralDelimiters: 13 | PreferredDelimiters: 14 | default: '[]' 15 | '%i': '[]' 16 | '%w': '[]' 17 | 18 | Style/TrailingCommaInArrayLiteral: 19 | # TODO: Uncoment this and open a massive PR which adds all the trailing commas 20 | #EnforcedStyleForMultiline: comma 21 | Enabled: false 22 | 23 | Style/TrailingCommaInHashLiteral: 24 | # TODO: Uncoment this and open a massive PR which adds all the trailing commas 25 | #EnforcedStyleForMultiline: comma 26 | Enabled: false 27 | 28 | # Only enforce a wordlist for 5 or longer lists. 29 | Style/WordArray: 30 | MinSize: 5 31 | 32 | ChefDeprecations/DeprecatedChefSpecPlatform: 33 | # We want to keep compatiblity with old distros/platforms 34 | Enabled: false 35 | 36 | ChefModernize/UnnecessaryDependsChef14: 37 | # We want to keep compatiblity with Chef < 14 38 | Enabled: false 39 | 40 | ChefDeprecations/ChefHandlerUsesSupports: 41 | # We want to keep compatiblity with Chef < 14 42 | Enabled: false 43 | 44 | ChefStyle/TrueClassFalseClassResourceProperties: 45 | Enabled: false 46 | -------------------------------------------------------------------------------- /Berksfile: -------------------------------------------------------------------------------- 1 | source 'https://supermarket.chef.io' 2 | 3 | metadata 4 | 5 | group :integration do 6 | cookbook 'sudo' # Use '< 5.0.0' with Chef < 13 7 | cookbook 'test', path: './test/cookbooks/test' # Used to test custom resources (datadog_monitor, integration) 8 | end 9 | 10 | cookbook 'yum', '< 7.0.0' 11 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') 4 | 5 | gem 'rake' 6 | gem 'rspec-expectations', '< 3.12.4' 7 | gem 'chef', "= #{chef_version}" 8 | gem 'cucumber-core', '~> 3.2.1' 9 | gem 'yaml' 10 | gem 'chefspec' 11 | gem 'berkshelf' 12 | gem 'fauxhai-ng', '~> 8.3.1' 13 | gem 'cookstyle' 14 | gem 'test-kitchen' 15 | gem 'json_spec', '~> 1.1.4' 16 | gem 'kitchen-vagrant' 17 | gem 'kitchen-docker', '~> 2.3.0' 18 | gem 'rbnacl', '~> 4.0.2' 19 | gem 'rbnacl-libsodium', '~> 1.0.16' 20 | gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0' 21 | gem 'jaro_winkler', '~> 1.5.6' 22 | gem 'dry-inflector', '~> 0.2.0' 23 | 24 | if RUBY_VERSION < '2.6.4' 25 | gem 'term-ansicolor', '~> 1.8.0' 26 | end 27 | gem 'coveralls', '~> 0.8.19' 28 | 29 | if RUBY_VERSION >= '3.0.0' && RUBY_VERSION < '3.1.0' 30 | gem 'uri', '= 0.10.1' 31 | end 32 | 33 | if RUBY_VERSION < '2.4' 34 | gem 'json', '~> 2.4.1' 35 | end 36 | 37 | gem 'foodcritic', (RUBY_VERSION >= '2.4' ? '~> 16.3.0' : '~> 11.4.0') 38 | gem 'rubocop', (RUBY_VERSION >= '2.4' ? '~> 0.80.1' : '~> 0.49.1') 39 | 40 | if Gem::Version.new(chef_version) >= Gem::Version.new('14.10.9') 41 | group :development do 42 | gem 'virtus' 43 | gem 'inflecto' 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /NOTICE: -------------------------------------------------------------------------------- 1 | Datadog chef-datadog 2 | Copyright [2011-Present] Datadog, Inc. 3 | 4 | This product includes software developed at Datadog (https://www.datadoghq.com/). -------------------------------------------------------------------------------- /attributes/cassandra.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | default['datadog']['cassandra']['version'] = 1 16 | -------------------------------------------------------------------------------- /attributes/go-metro.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # The implementation for the go-metro recipe allows any package resource 16 | # property to be defined as an attribute underneath the 17 | # node['datadog']['go-metro']['libcap_package'] namespace 18 | # 19 | # For example, if you want to set the package version, you can do something 20 | # like: 21 | # default['datadog']['go-metro']['libcap_package']['version'] = 'foo' 22 | 23 | # The only required option is package_name: 24 | # valid values for RHEL-based system are: libcap, compat-libcap1 25 | # valid values for Debian-based systems are: libcap, libcap2-bin 26 | default['datadog']['go-metro']['libcap_package']['package_name'] = 'libcap' 27 | 28 | # init config 29 | default['datadog']['go-metro']['init_config'] = { 30 | 'snaplen' => 512, 31 | 'idle_ttl' => 300, 32 | 'exp_ttl' => 60, 33 | 'statsd_ip' => '127.0.0.1', 34 | 'statsd_port' => 8125, 35 | 'log_to_file' => true, 36 | 'log_level' => 'info' 37 | } 38 | -------------------------------------------------------------------------------- /attributes/kafka.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | default['datadog']['kafka']['version'] = 1 16 | -------------------------------------------------------------------------------- /attributes/network.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | default['datadog']['network']['instances'] = [ 16 | { 17 | 'collect_connection_state' => 'false', 18 | 'collect_count_metrics' => 'false', 19 | 'combine_connection_states' => 'true', 20 | 'excluded_interfaces' => ['lo', 'lo0'] 21 | } 22 | ] 23 | -------------------------------------------------------------------------------- /chefignore: -------------------------------------------------------------------------------- 1 | # Put files/directories that should be ignored in this file. 2 | # Lines that start with '# ' are comments. 3 | 4 | ## OS 5 | .DS_Store 6 | Icon? 7 | nohup.out 8 | 9 | ## EDITORS 10 | \#* 11 | .#* 12 | *~ 13 | *.sw[a-z] 14 | *.bak 15 | REVISION 16 | TAGS* 17 | tmtags 18 | *_flymake.* 19 | *_flymake 20 | *.tmproj 21 | .project 22 | .settings 23 | mkmf.log 24 | 25 | ## COMPILED 26 | a.out 27 | *.o 28 | *.pyc 29 | *.so 30 | 31 | ## OTHER SCM 32 | */.bzr/* 33 | */.hg/* 34 | */.svn/* 35 | 36 | ## Testing 37 | .chef/ 38 | .kitchen/ 39 | .rspec 40 | .travis.yml 41 | .watchr 42 | features/* 43 | gemfiles/* 44 | spec/* 45 | spec/fixtures/* 46 | test/* 47 | kitchen.yml 48 | kitchen.docker.yml 49 | 50 | ## SCM 51 | .gitignore 52 | 53 | # Berkshelf 54 | Berksfile 55 | Berksfile.lock 56 | cookbooks/* 57 | 58 | Guardfile 59 | Rakefile 60 | 61 | # Vagrant 62 | .vagrant 63 | 64 | # Ruby managers 65 | .rbenv 66 | .ruby-gemset 67 | .ruby-version 68 | .rvmrc 69 | -------------------------------------------------------------------------------- /docker_test_env/docker.rb.patch: -------------------------------------------------------------------------------- 1 | --- /usr/local/rvm/gems/ruby-2.6.3/gems/kitchen-docker-2.3.0/lib/kitchen/driver/docker.rb 2024-04-09 10:54:16.032712772 -0400 2 | +++ /docker.rb 2024-04-09 10:53:25.988909160 -0400 3 | @@ -103,6 +103,6 @@ 4 | state[:ssh_key] = config[:private_key] 5 | state[:image_id] = build_image(state) unless state[:image_id] 6 | state[:container_id] = run_container(state) unless state[:container_id] 7 | - state[:hostname] = remote_socket? ? socket_uri.host : 'localhost' 8 | + state[:hostname] = ENV['KITCHEN_DOCKER_HOSTNAME'] || (remote_socket? ? socket_uri.host : 'localhost') 9 | state[:port] = container_ssh_port(state) 10 | wait_for_sshd(state[:hostname], nil, :port => state[:port]) if config[:wait_for_sshd] 11 | end -------------------------------------------------------------------------------- /docker_test_env/entrypoint.sh: -------------------------------------------------------------------------------- 1 | #!/bin/bash 2 | set -e 3 | 4 | git clone https://github.com/DataDog/chef-datadog.git 5 | cd chef-datadog 6 | bundle update --bundler 7 | if [ -t 0 ] ; then 8 | echo "(starting interactive shell)" 9 | else 10 | echo "(starting non interactive shell)" 11 | tail -f /dev/null 12 | fi 13 | -------------------------------------------------------------------------------- /libraries/test_helpers.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | class Mock 16 | class ShellCommandResult 17 | @stdout = '' 18 | def initialize(stdout) 19 | @stdout = stdout 20 | end 21 | 22 | attr_reader :stdout 23 | end 24 | end 25 | -------------------------------------------------------------------------------- /metadata.rb: -------------------------------------------------------------------------------- 1 | name 'datadog' 2 | maintainer 'Datadog' 3 | maintainer_email 'package@datadoghq.com' 4 | license 'Apache-2.0' 5 | description 'Installs/Configures datadog components' 6 | version '4.22.2' 7 | chef_version '>= 12.7' 8 | source_url 'https://github.com/DataDog/chef-datadog' 9 | issues_url 'https://github.com/DataDog/chef-datadog/issues' 10 | 11 | %w[ 12 | amazon 13 | centos 14 | debian 15 | fedora 16 | redhat 17 | scientific 18 | ubuntu 19 | windows 20 | suse 21 | ].each do |os| 22 | supports os 23 | end 24 | 25 | current_chef_version = if Chef::VERSION.instance_of? String 26 | # For Chef < 13.1.33 Chef::VERSION was a String 27 | Gem::Version.new(Chef::VERSION.to_f) 28 | else 29 | # Else Chef::VERSION is already a VersionString 30 | Chef::VERSION 31 | end 32 | 33 | if current_chef_version < Gem::Version.new(14) 34 | # The chef_handler cookbook is shipped as part of Chef >= 14, 35 | # so from Chef >= 14 chef_handler cookbook is deprecated. 36 | depends 'chef_handler', '>= 1.2' 37 | end 38 | 39 | # Use '< 6.0.0' with Chef < 12.9 40 | if current_chef_version < Gem::Version.new(12.9) 41 | depends 'apt', '< 6.0' 42 | else 43 | depends 'apt' 44 | end 45 | 46 | # Must be '>= 3.0' and '< 5.0' with Chef < 12.14 47 | # Chef allows only one constraint and '~> 3.0' means '>= 3.0' and '< 4.0' 48 | if current_chef_version < Gem::Version.new(12.14) 49 | depends 'yum', '~> 3.0' 50 | else 51 | depends 'yum', '>= 3.0' 52 | end 53 | -------------------------------------------------------------------------------- /recipes/activemq.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor activemq 18 | # 19 | # Assuming you have 2 clusters "test" and "prod", 20 | # one with and one without authentication 21 | # you need to set up the following attributes 22 | # node['datadog']['activemq']['instances'] = [ 23 | # { 24 | # :host => "localhost", 25 | # :port => "1234", 26 | # :name => "prod", 27 | # :user => "username", 28 | # :password => "secret" 29 | # }, 30 | # { 31 | # :host => "localhost", 32 | # :port => "3456", 33 | # :name => "test" 34 | # } 35 | # ] 36 | 37 | datadog_monitor 'activemq' do 38 | instances node['datadog']['activemq']['instances'] 39 | logs node['datadog']['activemq']['logs'] 40 | action :add 41 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 42 | end 43 | -------------------------------------------------------------------------------- /recipes/apache.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor apache 18 | # 19 | # Assuming you have 2 instances "prod" and "test", you will need to set 20 | # up the following attributes at some point in your Chef run, in either 21 | # a role or another cookbook. 22 | # 23 | # node['datadog']['apache']['instances'] = [ 24 | # { 25 | # 'status_url' => "http://localhost:81/status/", 26 | # 'tags' => ["prod"] 27 | # }, 28 | # { 29 | # 'status_url' => "http://localhost:82/status/", 30 | # 'name' => ["test"] 31 | # } 32 | # ] 33 | 34 | datadog_monitor 'apache' do 35 | instances node['datadog']['apache']['instances'] 36 | logs node['datadog']['apache']['logs'] 37 | action :add 38 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 39 | end 40 | -------------------------------------------------------------------------------- /recipes/couchbase.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor couchbase 18 | # 19 | # Assuming you have 2 instances on the same host 20 | # you need to set up the following attributes. 21 | # Each instance's metric will be tagged with "instance:server_url". 22 | # to help you differentiate between instances. 23 | # 24 | # node['datadog']['couchbase']['instances'] = [ 25 | # { 26 | # server: 'http://localhost:1234' 27 | # }, 28 | # { 29 | # server: 'http://localhost:4567' 30 | # } 31 | # ] 32 | 33 | datadog_monitor 'couchbase' do 34 | instances node['datadog']['couchbase']['instances'] 35 | logs node['datadog']['couchbase']['logs'] 36 | action :add 37 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 38 | end 39 | -------------------------------------------------------------------------------- /recipes/couchdb.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor couchDB 18 | # 19 | # Assuming you have 2 instances on the same host 20 | # you need to set up the following attributes. 21 | # Each instance's metric will be tagged with "instance:server_url". 22 | # to help you differentiate between instances. 23 | # NOTE the "couch" instead of "couchdb" attribute. 24 | # 25 | # node['datadog']['couch']['instances'] = [ 26 | # { 27 | # server: 'http://localhost:1234' 28 | # }, 29 | # { 30 | # server: 'http://localhost:4567' 31 | # } 32 | # ] 33 | 34 | datadog_monitor 'couch' do 35 | init_config nil 36 | instances node['datadog']['couch']['instances'] 37 | logs node['datadog']['couch']['logs'] 38 | action :add 39 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 40 | end 41 | -------------------------------------------------------------------------------- /recipes/custom_log_collection.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # node.default['datadog']['custom_log_collection']['logs'] = [ 18 | # { 19 | # 'type' => 'file', 20 | # 'path' => '', 21 | # 'source' => '', 22 | # 'tags' => [ 23 | # 'tag1:value1', 24 | # 'tag2:value2' 25 | # ] 26 | # } 27 | # ] 28 | 29 | datadog_monitor 'custom_log_collection' do 30 | logs node['datadog']['custom_log_collection']['logs'] 31 | action :add 32 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 33 | end 34 | -------------------------------------------------------------------------------- /recipes/ddtrace-ruby.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: ddtrace-ruby.rb 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | gem_package 'ddtrace' do 20 | version node['datadog']['ddtrace_gem_version'] 21 | end 22 | -------------------------------------------------------------------------------- /recipes/default.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: default 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | -------------------------------------------------------------------------------- /recipes/directory.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor files in a directory 18 | # 19 | # node['datadog']['directory']['instances'] = [ 20 | # { 21 | # 'directory' => "/path/to/directory", 22 | # 'name' => 'tag_name', 23 | # 'pattern' => '*.log", 24 | # 'recursive' => true 25 | # } 26 | # ] 27 | 28 | datadog_monitor 'directory' do 29 | instances node['datadog']['directory']['instances'] 30 | logs node['datadog']['directory']['logs'] 31 | action :add 32 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 33 | end 34 | -------------------------------------------------------------------------------- /recipes/disk.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: disk 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | # This recipe exists to apply (optional) configuration to the disk integration 20 | # This recipe does not need to be included to use the disk integration, 21 | # but it allows you to override some defaults that the disk integration 22 | # provides. 23 | # For more information on the integration itself, see: 24 | # https://docs.datadoghq.com/integrations/disk/ 25 | 26 | include_recipe '::dd-agent' 27 | 28 | # example configuration: 29 | # node['datadog']['disk']['instances'] = [ 30 | # { 31 | # 'use_mount' => true, 32 | # 'excluded_filesystems' => [ 33 | # 'tmpfs' 34 | # ], 35 | # 'excluded_disks' => [ 36 | # '/dev/sda1', 37 | # '/dev/sda2' 38 | # ], 39 | # 'excluded_disk_re' => '/dev/sde.*', 40 | # 'tag_by_filesystem' => false, 41 | # 'excluded_mountpoint_re' => '/mnt/somebody-elses-problem.*', 42 | # 'all_partitions' => false 43 | # } 44 | # ] 45 | 46 | datadog_monitor 'disk' do 47 | instances node['datadog']['disk']['instances'] 48 | init_config nil 49 | logs node['datadog']['disk']['logs'] 50 | action :add 51 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 52 | end 53 | -------------------------------------------------------------------------------- /recipes/dns_check.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor dns 18 | # 19 | # Create one attribute entry for each combination of hostname that 20 | # you want to monitor + DNS server that you want to monitor it on. 21 | # 22 | # node['datadog']['dns_check']['instances'] = [ 23 | # { 24 | # 'hostname' => 'foo.example.com', 25 | # 'nameserver' => 'prod-ns.example.com', 26 | # 'timeout' => 1 27 | # }, 28 | # { 29 | # 'hostname' => 'baz.example.com', 30 | # 'nameserver' => 'prod-ns.example.com', 31 | # 'timeout' => 1 32 | # }, 33 | # { 34 | # 'hostname' => 'foo.example.com', 35 | # 'nameserver' => 'test-ns.example.com', 36 | # 'timeout' => 3 37 | # }, 38 | # { 39 | # 'hostname' => 'quux.example.com', 40 | # 'nameserver' => 'test-ns.example.com', 41 | # 'timeout' => 3 42 | # }, 43 | # ] 44 | 45 | datadog_monitor 'dns_check' do 46 | instances node['datadog']['dns_check']['instances'] 47 | logs node['datadog']['dns_check']['logs'] 48 | action :add 49 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 50 | end 51 | -------------------------------------------------------------------------------- /recipes/docker.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: docker 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | include_recipe '::dd-agent' 20 | 21 | # The docker check is deprecated in agent version 5.x. 22 | # Please use the docker_daemon check instead. 23 | # Build a data structure with configuration. 24 | # @see http://docs.datadoghq.com/integrations/docker/ 25 | # @example 26 | # node.override['datadog']['docker']['instances'] = [ 27 | # { 28 | # url: 'unix://var/run/docker.sock', 29 | # new_tag_names: 'false', 30 | # tag_by_command: 'false', 31 | # tags: ['toto', 'tata'], 32 | # include: ['docker_image:ubuntu', 'docker_image:debian'], 33 | # exclude: ['.*'], 34 | # collect_events: 'true', 35 | # collect_container_size: 'false', 36 | # collect_all_metrics: 'false', 37 | # collect_images_stats: 'false' 38 | # } 39 | # ] 40 | 41 | group 'docker' do 42 | action :manage 43 | append true 44 | members 'dd-agent' 45 | end 46 | 47 | datadog_monitor 'docker' do 48 | init_config node['datadog']['docker']['init_config'] 49 | instances node['datadog']['docker']['instances'] 50 | logs node['datadog']['docker']['logs'] 51 | action :add 52 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 53 | end 54 | -------------------------------------------------------------------------------- /recipes/dogstatsd-ruby.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: dogstatsd-ruby 4 | # 5 | # Copyright:: 2013-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | gem_package 'dogstatsd-ruby' 21 | -------------------------------------------------------------------------------- /recipes/etcd.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor etcd 18 | # 19 | # API endpoint of your etcd instance 20 | # - url: "https://server:port" 21 | # Change the time to wait on an etcd API request 22 | # timeout: 5 23 | # 24 | # If certificate-based authentication of clients is enabled on your etcd server, 25 | # specify the key file and the certificate file that the check should use. 26 | # ssl_keyfile: /path/to/key/file 27 | # ssl_certfile: /path/to/certificate/file 28 | # 29 | # Set to `false` to disable the validation of the server's SSL certificates (default: true). 30 | # ssl_cert_validation: true 31 | # 32 | # If ssl_cert_validation is enabled, you can provide a custom file 33 | # that lists trusted CA certificates (optional). 34 | # ssl_ca_certs: /path/to/CA/certificate/file 35 | 36 | datadog_monitor 'etcd' do 37 | instances node['datadog']['etcd']['instances'] 38 | logs node['datadog']['etcd']['logs'] 39 | action :add 40 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 41 | end 42 | -------------------------------------------------------------------------------- /recipes/flink.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor flink 18 | # 19 | # Here is the description of acceptable attributes: 20 | # node.datadog.flink = { 21 | # # logs - required: false 22 | # "logs" => nil, 23 | # } 24 | 25 | datadog_monitor 'flink' do 26 | init_config node['datadog']['flink']['init_config'] 27 | instances node['datadog']['flink']['instances'] 28 | logs node['datadog']['flink']['logs'] 29 | use_integration_template true 30 | action :add 31 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 32 | end 33 | -------------------------------------------------------------------------------- /recipes/fluentd.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor fluentd 18 | # 19 | # node.override['datadog']['fluentd']['instances'] = [ 20 | # { 21 | # 'monitor_agent_url' => "http://example.com:24220/api/plugins.json", 22 | # 'plugin_ids' => ["plg1", "plg2"], 23 | # 'tags' => ["tag1", "tag2"] 24 | # } 25 | # ] 26 | 27 | datadog_monitor 'fluentd' do 28 | instances node['datadog']['fluentd']['instances'] 29 | logs node['datadog']['fluentd']['logs'] 30 | action :add 31 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 32 | end 33 | -------------------------------------------------------------------------------- /recipes/gearmand.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # All attributes are optional. 18 | # node.default['datadog']['gearmand']['instances'] = [ 19 | # { 20 | # # Defaults to 127.0.0.1 if not set 21 | # 'server' => '127.0.0.1', 22 | # # Defaults to 4730 if not set 23 | # 'port' => '4730', 24 | # 'tasks' => [ 25 | # 'TASK_1', 26 | # 'TASK_2', 27 | # ], 28 | # 'tags' => [ 29 | # ':', 30 | # ':' 31 | # ], 32 | # 'service' => '', 33 | # # Defaults to 15 if not set 34 | # 'min_collection_interval' => 60, 35 | # # Defaults to false if not set 36 | # 'empty_default_hostname' => true, 37 | # 'metric_patterns' => { 38 | # 'include' => [ 39 | # '' 40 | # ], 41 | # 'exclude' => [ 42 | # '' 43 | # ] 44 | # } 45 | # } 46 | # ] 47 | 48 | datadog_monitor 'gearmand' do 49 | instances node['datadog']['gearmand']['instances'] 50 | logs node['datadog']['gearmand']['logs'] 51 | action :add 52 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 53 | end 54 | -------------------------------------------------------------------------------- /recipes/go_expvar.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor Go metrics exported via expvar 18 | # node['datadog']['go_expvar']['instances'] = [ 19 | # { 20 | # 'expvar_url' => 'http://localhost:8080/debug/vars', 21 | # 'tags' => [ 22 | # 'application:my_go_app' 23 | # ], 24 | # 'metrics' => [ 25 | # { 26 | # 'path' => 'test_metrics_name_1', 'alias' => 'go_expvar.test_metrics_name_1', 'type' => 'gauge' 27 | # }, 28 | # { 29 | # 'path' => 'test_metrics_name_2', 'alias' => 'go_expvar.test_metrics_name_2', 'type' => 'gauge', 'tags' => ['tag1', 'tag2'] 30 | # } 31 | # ] 32 | # } 33 | # ] 34 | 35 | datadog_monitor 'go_expvar' do 36 | init_config node['datadog']['go_expvar']['init_config'] 37 | instances node['datadog']['go_expvar']['instances'] 38 | logs node['datadog']['go_expvar']['logs'] 39 | action :add 40 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 41 | end 42 | -------------------------------------------------------------------------------- /recipes/gunicorn.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: gunicorn 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # Monitor gunicorn 20 | # 21 | # NB: This check requires the python environment on which gunicorn runs to 22 | # have the `setproctitle` module installed: 23 | # (https://pypi.python.org/pypi/setproctitle/) 24 | # 25 | # Example gunicorn.yaml file: 26 | # 27 | # init_config: 28 | # 29 | # 30 | # instances: 31 | # The name of the gunicorn process. For the following gunicorn server ... 32 | # 33 | # gunicorn --name my_web_app my_web_app_config.ini 34 | # 35 | # ... we'd use the name `my_web_app`. 36 | # 37 | # - proc_name: my_web_app 38 | 39 | include_recipe '::dd-agent' 40 | 41 | datadog_monitor 'gunicorn' do 42 | instances node['datadog']['gunicorn']['instances'] 43 | logs node['datadog']['gunicorn']['logs'] 44 | action :add 45 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 46 | end 47 | -------------------------------------------------------------------------------- /recipes/haproxy.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor haproxy 18 | 19 | # You need to set up the following attributes 20 | # node.datadog.haproxy.instances = [ 21 | # { 22 | # :url => "http://localhost/stats_url", 23 | # :username => "username", 24 | # :password => "secret", 25 | # :status_check => false, 26 | # :collect_aggregates_only => true, 27 | # :collect_status_metrics => true 28 | # } 29 | # ] 30 | 31 | datadog_monitor 'haproxy' do 32 | instances node['datadog']['haproxy']['instances'] 33 | logs node['datadog']['haproxy']['logs'] 34 | action :add 35 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 36 | end 37 | -------------------------------------------------------------------------------- /recipes/hdfs.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: hdfs 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | # Monitor hdfs 20 | # 21 | # Assuming you have 2 instances "prod" and "test", you will need to set 22 | # up the following attributes at some point in your Chef run, in either 23 | # a role or another cookbook. 24 | # 25 | # node["datadog"]["hdfs"]["instances"] = [ 26 | # { 27 | # "fqdn" => "hdfs.prod.tld", 28 | # "port" => "8020", 29 | # "tags" => ["prod", "hdfs_core"] 30 | # }, 31 | # { 32 | # "fqdn" => "hdfs.test.tld", 33 | # "port" => "8020", 34 | # "tags" => ["test"] 35 | # } 36 | # ] 37 | 38 | include_recipe '::dd-agent' 39 | 40 | datadog_monitor 'hdfs' do 41 | instances node['datadog']['hdfs']['instances'] 42 | logs node['datadog']['hdfs']['logs'] 43 | action :add 44 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 45 | end 46 | -------------------------------------------------------------------------------- /recipes/http_check.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Build a data structure with configuration. 18 | # @see https://docs.datadoghq.com/integrations/http_check/ 19 | # @example 20 | # node.override['datadog']['http_check']['instances'] = [ 21 | # { 22 | # 'name' => 'MyHTTPcheck', 23 | # 'url' => 'http://my.server/some/service', 24 | # 'timeout' => '15', 25 | # 'content_match' => 'string to match', 26 | # 'include_content' => true, 27 | # 'collect_response_time' => true, 28 | # 'tags' => [ 29 | # 'myApp', 30 | # 'serviceName' 31 | # ] 32 | # } 33 | # ] 34 | 35 | datadog_monitor 'http_check' do 36 | instances node['datadog']['http_check']['instances'] 37 | logs node['datadog']['http_check']['logs'] 38 | action :add 39 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 40 | end 41 | -------------------------------------------------------------------------------- /recipes/iis.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Integrate IIS metrics 18 | # 19 | # Simply declare the following attributes 20 | # One instance per server. 21 | # 22 | # node.datadog.iis.instances = [ 23 | # { 24 | # "host" => "localhost", 25 | # "tags" => ["prod", "other_tag"], 26 | # "sites" => ["Default Web Site"] 27 | # }, 28 | # { 29 | # "host" => "other.server.com", 30 | # "username" => "myuser", 31 | # "password" => "password", 32 | # "tags" => ["prod", "other_tag"] 33 | # } 34 | # ] 35 | 36 | datadog_monitor 'iis' do 37 | instances node['datadog']['iis']['instances'] 38 | logs node['datadog']['iis']['logs'] 39 | action :add 40 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 41 | end 42 | -------------------------------------------------------------------------------- /recipes/install_info.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: install_info 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | # Create install info metadata to send installation metadata to Datadog 21 | # example: 22 | # default['datadog']['install_info_enabled'] = true 23 | 24 | return if Chef::Datadog.agent_major_version(node) == 5 25 | 26 | def flare_path 27 | if platform_family?('windows') 28 | "#{ENV['ProgramData']}/Datadog/install_info" 29 | else 30 | '/etc/datadog-agent/install_info' 31 | end 32 | end 33 | 34 | template flare_path do 35 | if node['datadog']['install_info_enabled'] 36 | action :create 37 | else 38 | action :delete 39 | end 40 | 41 | if platform_family?('windows') 42 | inherits true # Agent 6/7 rely on inheritance being enabled. Reset it in case it was disabled when installing Agent 5. 43 | else 44 | owner 'dd-agent' 45 | mode '600' 46 | end 47 | 48 | source 'install_info.yaml.erb' 49 | 50 | variables( 51 | chef_version: Chef::VERSION, 52 | cookbook_version: Chef::Datadog.cookbook_version(run_context) 53 | ) 54 | sensitive true 55 | end 56 | -------------------------------------------------------------------------------- /recipes/integrations.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: integrations 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | 20 | include_recipe '::dd-agent' 21 | 22 | # Install all specified integrations 23 | # example: 24 | # default['datadog']['extra_packages']['twemproxy'] = { 25 | # 'name' => 'dd-check-twemproxy', 26 | # 'version' => '1.0.0-1' 27 | # } 28 | # default['datadog']['twemproxy']['instances'] = [ 29 | # { 30 | # 'url' => 'http://localhost:22222' 31 | # } 32 | node['datadog']['extra_packages'].each do |name, options| 33 | package options['name'] do 34 | version options['version'] 35 | action :install 36 | end 37 | 38 | datadog_monitor name do 39 | init_config node['datadog'][name]['init_config'] 40 | instances node['datadog'][name]['instances'] 41 | logs node['datadog'][name]['logs'] 42 | use_integration_template true 43 | action :add 44 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /recipes/jenkins.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Integrate jenkins builds 18 | # 19 | # To configure the integration of one or more jenkins servers into Datadog 20 | # simply set up attributes for the jenkins nodes or roles like so: 21 | # 22 | # node.datadog.jenkins.instances = [ 23 | # { 24 | # "name" => "dev-jenkins", 25 | # "home" => "/var/lib/jenkins/dev" 26 | # }, 27 | # { 28 | # "name" => "prod-jenkins", 29 | # "home" => "/var/lib/jenkins/prod" 30 | # } 31 | # ] 32 | # 33 | # Note that this check can only monitor local jenkins instances 34 | 35 | datadog_monitor 'jenkins' do 36 | instances node['datadog']['jenkins']['instances'] 37 | logs node['datadog']['jenkins']['logs'] 38 | action :add 39 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 40 | end 41 | -------------------------------------------------------------------------------- /recipes/jmx.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Build a data structure with configuration. 18 | # @see https://github.com/DataDog/dd-agent/blob/master/conf.d/jmx.yaml.example JMX Example 19 | # @example 20 | # node.override['datadog']['jmx']['instances'] = [ 21 | # { 22 | # 'host' => 'localhost', 23 | # 'port' => 7199, 24 | # 'name' 'prod_jmx_app', 25 | # 'conf' => [ 26 | # 'include' => { 27 | # 'attribute' => ['Capacity', 'Used'], 28 | # 'bean_name' => 'com.datadoghq.test:type=BeanType,tag1=my_bean_name', 29 | # 'domain' => 'com.datadoghq.test' 30 | # } 31 | # ] 32 | # } 33 | # ] 34 | datadog_monitor 'jmx' do 35 | instances node['datadog']['jmx']['instances'] 36 | logs node['datadog']['jmx']['logs'] 37 | action :add 38 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 39 | end 40 | -------------------------------------------------------------------------------- /recipes/kafka_consumer.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor Kafka 18 | # 19 | # You need to set up the following attributes 20 | # node.datadog.kafka_consumer.instances = [ 21 | # { 22 | # :kafka_connect_str => "localhost:19092", 23 | # :consumer_groups => { 24 | # :my_consumer => { 25 | # :my_topic => [, , , ] 26 | # } , 27 | # # optional -if consumer_groups is set do false no matter of it's set to true or not. 28 | # # false is the default configuration, but since there is a dependency on consumer_groups 29 | # # it will be added to conf.yaml as false. 30 | # :monitor_unlisted_consumer_groups >> true, 31 | # :zk_connect_str => "localhost:2181", 32 | # :zk_prefix => "/0.8", 33 | # # optional -if it's set to false it will no added to conf.yaml because false is default. 34 | # :kafka_consumer_offsets => true 35 | # } 36 | # ] 37 | 38 | datadog_monitor 'kafka_consumer' do 39 | instances node['datadog']['kafka_consumer']['instances'] 40 | logs node['datadog']['kafka_consumer']['logs'] 41 | action :add 42 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 43 | end 44 | -------------------------------------------------------------------------------- /recipes/kubernetes.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor kubernetes 18 | # 19 | # Assuming you have a kubernetes instance on a given server, you will need to set 20 | # up the following attributes at some point in your Chef run, in either 21 | # a role or another cookbook. 22 | # 23 | # node['datadog']['kubernetes']['instances'] = [ 24 | # { 25 | # 'host' => 'localhost', 26 | # 'port' => 4194, 27 | # 'method' => 'http', 28 | # 'kubelet_port' => 10255, 29 | # 'namespace' => 'default' 30 | # 'collect_events' => false, 31 | # 'use_histogram' => false, 32 | # 'enabled_rates' => [ 33 | # 'cpu.*', 34 | # 'network.*' 35 | # ], 36 | # 'enabled_gauges' => [ 37 | # 'filesystem.*' 38 | # ] 39 | # } 40 | # ] 41 | 42 | datadog_monitor 'kubernetes' do 43 | instances node['datadog']['kubernetes']['instances'] 44 | logs node['datadog']['kubernetes']['logs'] 45 | action :add 46 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 47 | end 48 | -------------------------------------------------------------------------------- /recipes/kyototycoon.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Integrate Kyoto Tycoon metrics into Datadog 18 | # 19 | # To configure, simply set atributes according to the following example 20 | # 21 | # node.datadog.kyototycoon.instances = [ 22 | # { 23 | # "name" => "dev", 24 | # "report_url" => "http://localhost:1978/rpc/report", 25 | # "tags" => { "key1" => "value1", "key2" => "value2" } 26 | # }, 27 | # { 28 | # "name" => "prod", 29 | # "report_url" => "http://localhost:2978/rpc/report", 30 | # "tags" => { "key3" => "value3", "key4" => "value4" } 31 | # } 32 | # ] 33 | 34 | datadog_monitor 'kyototycoon' do 35 | instances node['datadog']['kyototycoon']['instances'] 36 | logs node['datadog']['kyototycoon']['logs'] 37 | action :add 38 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 39 | end 40 | -------------------------------------------------------------------------------- /recipes/lighttpd.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | datadog_monitor 'lighttpd' do 18 | instances node['datadog']['lighttpd']['instances'] 19 | logs node['datadog']['lighttpd']['logs'] 20 | action :add 21 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 22 | end 23 | -------------------------------------------------------------------------------- /recipes/memcache.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Integrate memcache metrics into Datadog 18 | # 19 | # Simply set up attributes following this example. 20 | # If you are running multiple memcache instances on the same machine 21 | # list them all as hashes. 22 | # 23 | # node.datadog.memcache.instances = [ 24 | # { 25 | # "url" => "localhost", 26 | # "port" => "11211", 27 | # "tags" => ["prod", "aws"], 28 | # "options" => [ 29 | # "items: false", 30 | # "slabs: false" 31 | # ] 32 | # } 33 | # ] 34 | 35 | datadog_monitor 'mcache' do 36 | instances node['datadog']['memcache']['instances'] 37 | logs node['datadog']['memcache']['logs'] 38 | action :add 39 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 40 | end 41 | -------------------------------------------------------------------------------- /recipes/mesos_master.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: mesos 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | include_recipe '::dd-agent' 20 | 21 | # Build a data structure with configuration. 22 | # @example 23 | # node.override['datadog']['mesos'] = 24 | # instances: [{ 25 | # url: 'https://server:port', 26 | # timeout: 8, 27 | # tags: [ 28 | # 'optional_tag1', 29 | # 'optional_tag2' 30 | # ] 31 | # }], 32 | # init_config: { 33 | # default_timeout: 10 34 | # } 35 | 36 | datadog_monitor 'mesos_master' do 37 | init_config node['datadog']['mesos_master']['init_config'] 38 | instances node['datadog']['mesos_master']['instances'] 39 | logs node['datadog']['mesos_master']['logs'] 40 | action :add 41 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 42 | end 43 | -------------------------------------------------------------------------------- /recipes/mesos_slave.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: mesos_slave 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | include_recipe '::dd-agent' 20 | 21 | # Build a data structure with configuration. 22 | # @example 23 | # node.override['datadog']['mesos'] = 24 | # instances: [{ 25 | # url: 'https://server:port', 26 | # timeout: 8, 27 | # tags: [ 28 | # 'optional_tag1', 29 | # 'optional_tag2' 30 | # ] 31 | # }], 32 | # init_config: { 33 | # default_timeout: 10 34 | # } 35 | 36 | datadog_monitor 'mesos_slave' do 37 | init_config node['datadog']['mesos_slave']['init_config'] 38 | instances node['datadog']['mesos_slave']['instances'] 39 | logs node['datadog']['mesos_slave']['logs'] 40 | action :add 41 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 42 | end 43 | -------------------------------------------------------------------------------- /recipes/mongo.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor mongo 18 | # 19 | # node.set['datadog']['mongo']['instances'] = [ 20 | # { 21 | # 'host' => 'localhost', 22 | # 'port' => '27017', 23 | # 'username' => 'someuser', 24 | # 'password' => 'somepassword' 25 | # } 26 | # ] 27 | 28 | datadog_monitor 'mongo' do 29 | instances node['datadog']['mongo']['instances'] 30 | logs node['datadog']['mongo']['logs'] 31 | action :add 32 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 33 | end 34 | -------------------------------------------------------------------------------- /recipes/mysql.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor mysql 18 | # 19 | # Assuming you have 1 mysql instance "prod" on a given server, you will need to set 20 | # up the following attributes at some point in your Chef run, in either 21 | # a role or another cookbook. 22 | # 23 | # node['datadog']['mysql']['instances'] = [ 24 | # { 25 | # 'server' => "localhost", 26 | # 'port' => 3306, 27 | # 'user' => "my_username", 28 | # 'pass' => "my_password", 29 | # 'sock' => "/path/to/mysql.sock", 30 | # 'tags' => ["prod"], 31 | # 'options' => [ 32 | # "replication: 0", 33 | # "galera_cluster: 1" 34 | # ], 35 | # 'queries' => [ 36 | # { 37 | # 'type' => 'gauge', 38 | # 'field' => 'users_count' 39 | # 'metric' => 'my_app.my_users.count', 40 | # 'query' => 'SELECT COUNT(1) AS users_count FROM users' 41 | # }, 42 | # ] 43 | # }, 44 | # ] 45 | 46 | datadog_monitor 'mysql' do 47 | instances node['datadog']['mysql']['instances'] 48 | logs node['datadog']['mysql']['logs'] 49 | action :add 50 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 51 | end 52 | -------------------------------------------------------------------------------- /recipes/network.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor network 18 | # 19 | # node.override['datadog']['network']['instances'] = [ 20 | # { 21 | # :collect_connection_state => "false", 22 | # :collect_count_metrics => "false", 23 | # :combine_connection_states => "true", 24 | # :excluded_interfaces => ["lo","lo0"] 25 | # }, 26 | # ] 27 | 28 | Chef::Log.warn 'Datadog network check only supports one `instance`, please check attribute assignments' if node['datadog']['network']['instances'].count > 1 29 | 30 | datadog_monitor 'network' do 31 | instances node['datadog']['network']['instances'] 32 | logs node['datadog']['network']['logs'] 33 | action :add 34 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 35 | end 36 | -------------------------------------------------------------------------------- /recipes/nginx.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor nginx 18 | # 19 | # Assuming you have 2 instances "prod" and "test", you will need to set 20 | # up the following attributes at some point in your Chef run, in either 21 | # a role or another cookbook. 22 | # 23 | # node['datadog']['nginx']['instances'] = [ 24 | # { 25 | # 'nginx_status_url' => "http://localhost:81/nginx_status/", 26 | # 'tags' => ["prod"], 27 | # 'user' => "my_username", 28 | # 'password' => "my_password" 29 | # }, 30 | # { 31 | # 'nginx_status_url' => "https://localhost:82/nginx_status/", 32 | # 'name' => ['test'], 33 | # 'ssl_validation' => false, 34 | # 'skip_proxy' => false, 35 | # 'use_plus_api' => false, 36 | # 'plus_api_version' => 2, 37 | # 'use_vts' => false 38 | # } 39 | # ] 40 | 41 | datadog_monitor 'nginx' do 42 | instances node['datadog']['nginx']['instances'] 43 | logs node['datadog']['nginx']['logs'] 44 | action :add 45 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 46 | end 47 | -------------------------------------------------------------------------------- /recipes/ntp.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Build a data structure with configuration. 18 | # @note NTP check is enabled by default since datadog-agent 5.3.0. 19 | # @see https://github.com/DataDog/integrations-core/blob/master/ntp/conf.yaml.default 20 | # @example 21 | # node.override['datadog']['ntp']['instances'] = [ 22 | # { 23 | # 'offset_threshold' => '60', 24 | # 'host' => 'pool.ntp.org', 25 | # 'port' => 'ntp', 26 | # 'version' => '3', 27 | # 'timeout' => '5' 28 | # } 29 | # ] 30 | datadog_monitor 'ntp' do 31 | instances node['datadog']['ntp']['instances'] 32 | logs node['datadog']['ntp']['logs'] 33 | action :add 34 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 35 | end 36 | -------------------------------------------------------------------------------- /recipes/pgbouncer.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: pgbouncer 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | include_recipe '::dd-agent' 20 | 21 | # Build a data structure with configuration. 22 | # @see https://github.com/DataDog/integrations-core/blob/master/pgbouncer/conf.yaml.example Pgbouncer Example 23 | # @example 24 | # node.override['datadog']['pgbouncer']['instances'] = [ 25 | # { 26 | # host: 'localhost', 27 | # port: '15432', 28 | # username: 'john', 29 | # password: 'doe', 30 | # tags: [ 31 | # 'optional_tag1', 32 | # 'optional_tag2' 33 | # ] 34 | # } 35 | # ] 36 | 37 | datadog_monitor 'pgbouncer' do 38 | instances node['datadog']['pgbouncer']['instances'] 39 | logs node['datadog']['pgbouncer']['logs'] 40 | action :add 41 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 42 | end 43 | -------------------------------------------------------------------------------- /recipes/php_fpm.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Build a data structure with configuration. 18 | # @see https://github.com/DataDog/integrations-core/blob/master/php_fpm/conf.yaml.example PHP-FPM Example 19 | # @example 20 | # node.override['datadog']['php_fpm']['instances'] = [ 21 | # { 22 | # 'status_url' => 'http://localhost/status', 23 | # 'ping_url' => 'http://localhost/ping', 24 | # 'ping_reply' => 'pong', 25 | # 'user' => 'bits', 26 | # 'password' => 'D4T4D0G', 27 | # 'tags' => ['prod'] 28 | # } 29 | # ] 30 | datadog_monitor 'php_fpm' do 31 | instances node['datadog']['php_fpm']['instances'] 32 | logs node['datadog']['php_fpm']['logs'] 33 | action :add 34 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 35 | end 36 | -------------------------------------------------------------------------------- /recipes/process.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor processes 18 | # 19 | # name: (mandatory) STRING Is the display name of the check 20 | # search_string: (mandatory) LIST OF STRINGS The strings to search for in process names. If 21 | # one of these matches a process's name, that process will be 22 | # included in the stats. 23 | # exact_match: (optional) True/False, defaults to True, if you want to look for a partial 24 | # match, use exact_match: "False", otherwise use the exact base 25 | # name of the process. 26 | # 27 | # Example: 28 | # 29 | # node.datadog.process.instances = [ 30 | # { 31 | # :name => "ssh", 32 | # :search_string => ["ssh","sshd"], 33 | # :exact_match => "False", 34 | # }, 35 | # { 36 | # :name => "postgres", 37 | # :search_string => ["postgres"], 38 | # }, 39 | # ] 40 | 41 | datadog_monitor 'process' do 42 | instances node['datadog']['process']['instances'] 43 | logs node['datadog']['process']['logs'] 44 | action :add 45 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 46 | end 47 | -------------------------------------------------------------------------------- /recipes/rabbitmq.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Integrate rabbitmq metrics into Datadog 18 | # 19 | # Set up attributes following this example. 20 | # If you are running multiple rabbitmq instances on the same machine 21 | # list them all as hashes. 22 | # 23 | # node.datadog.rabbitmq.instances = 24 | # [ 25 | # { 26 | # "api_url" => "http://localhost:15672/api/", 27 | # "user" => "guest", 28 | # "pass" => "guest", 29 | # "ssl_verify" => "true", 30 | # "tag_families" => "false" 31 | # } 32 | # ] 33 | 34 | datadog_monitor 'rabbitmq' do 35 | instances node['datadog']['rabbitmq']['instances'] 36 | logs node['datadog']['rabbitmq']['logs'] 37 | action :add 38 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 39 | end 40 | -------------------------------------------------------------------------------- /recipes/redisdb.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Build a data structure with configuration. 18 | # @see https://github.com/DataDog/integrations-core/blob/master/redisdb/conf.yaml.example RedisDB Example 19 | # @example 20 | # node.override['datadog']['redisdb']['instances'] = [ 21 | # { 22 | # 'server' => 'localhost', 23 | # 'port' => '6379', 24 | # 'password' => 'somesecret', 25 | # 'tags' => ['prod'] 26 | # } 27 | # ] 28 | datadog_monitor 'redisdb' do 29 | instances node['datadog']['redisdb']['instances'] 30 | logs node['datadog']['redisdb']['logs'] 31 | action :add 32 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 33 | end 34 | -------------------------------------------------------------------------------- /recipes/sidekiq.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor Sidekiq 18 | # 19 | # Here is the description of acceptable attributes: 20 | # node.datadog.sidekiq = { 21 | # # logs - required: false 22 | # "logs" => nil, 23 | # } 24 | 25 | datadog_monitor 'sidekiq' do 26 | init_config node['datadog']['sidekiq']['init_config'] 27 | instances node['datadog']['sidekiq']['instances'] 28 | logs node['datadog']['sidekiq']['logs'] 29 | use_integration_template true 30 | action :add 31 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 32 | end 33 | -------------------------------------------------------------------------------- /recipes/solr.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor solr 18 | # @see https://github.com/DataDog/integrations-core/blob/master/solr/datadog_checks/solr/data/conf.yaml.example Solr Example 19 | # @example 20 | # 21 | 22 | datadog_monitor 'solr' do 23 | instances node['datadog']['solr']['instances'] 24 | logs node['datadog']['solr']['logs'] 25 | action :add 26 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 27 | end 28 | -------------------------------------------------------------------------------- /recipes/supervisord.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: supervisord 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | include_recipe '::dd-agent' 20 | 21 | # Build a data structure with configuration. 22 | # @see https://github.com/DataDog/integrations-core/blob/master/supervisord/conf.yaml.example Supervisord Example 23 | # @example 24 | # node.override['datadog']['supervisord']['instances'] = [ 25 | # { 26 | # name: 'server0', 27 | # socket: 'unix:///var/run/default-supervisor.sock' 28 | # }, 29 | # { 30 | # name: 'server1', 31 | # host: 'localhost', 32 | # port: '9001', 33 | # user: 'user', 34 | # pass: 'pass', 35 | # proc_names: [ 36 | # 'apache2', 37 | # 'webapp' 38 | # ] 39 | # } 40 | # ] 41 | 42 | datadog_monitor 'supervisord' do 43 | instances node['datadog']['supervisord']['instances'] 44 | logs node['datadog']['supervisord']['logs'] 45 | action :add 46 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 47 | end 48 | -------------------------------------------------------------------------------- /recipes/system_core.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: system_core 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | # 19 | include_recipe '::dd-agent' 20 | 21 | datadog_monitor 'system_core' 22 | -------------------------------------------------------------------------------- /recipes/system_swap.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: system_swap 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | include_recipe '::dd-agent' 20 | 21 | datadog_monitor 'system_swap' 22 | -------------------------------------------------------------------------------- /recipes/tcp_check.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor tcp 18 | # @see http://docs.datadoghq.com/guides/network_checks/ 19 | # 20 | # Assuming you have tcp connections you want to monitor 21 | # you need to set up the following attributes 22 | # node.datadog.tcp_check.instances = [ 23 | # { 24 | # :name => "http", 25 | # :host => "localhost", 26 | # :port => 80 27 | # } 28 | # ] 29 | 30 | datadog_monitor 'tcp_check' do 31 | instances node['datadog']['tcp_check']['instances'] 32 | logs node['datadog']['tcp_check']['logs'] 33 | action :add 34 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 35 | end 36 | -------------------------------------------------------------------------------- /recipes/tenable.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor Tenable 18 | # 19 | # Here is the description of acceptable attributes: 20 | # node.datadog.tenable = { 21 | # # logs - required: true 22 | # "logs" => nil, 23 | # } 24 | 25 | datadog_monitor 'tenable' do 26 | init_config node['datadog']['tenable']['init_config'] 27 | instances node['datadog']['tenable']['instances'] 28 | logs node['datadog']['tenable']['logs'] 29 | use_integration_template true 30 | action :add 31 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 32 | end 33 | -------------------------------------------------------------------------------- /recipes/tokumx.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor tokumx 18 | # 19 | # node.set['datadog']['tokumx']['instances'] = [ 20 | # { 21 | # 'host' => 'localhost', 22 | # 'port' => '27017' 23 | # } 24 | # ] 25 | 26 | datadog_monitor 'tokumx' do 27 | instances node['datadog']['tokumx']['instances'] 28 | logs node['datadog']['tokumx']['logs'] 29 | action :add 30 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 31 | end 32 | -------------------------------------------------------------------------------- /recipes/tomcat.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor tomcat 18 | # 19 | # Assuming you have 2 instances "test" and "prod", 20 | # one with and one without authentication 21 | # you need to set up the following attributes 22 | # node.datadog.tomcat.instances = [ 23 | # { 24 | # :server => "localhost", 25 | # :port => "7199", 26 | # :name => "prod", 27 | # :username => "username", 28 | # :password => "secret" 29 | # }, 30 | # { 31 | # :server => "localhost", 32 | # :port => "8199", 33 | # :name => "test" 34 | # } 35 | # ] 36 | 37 | datadog_monitor 'tomcat' do 38 | instances node['datadog']['tomcat']['instances'] 39 | logs node['datadog']['tomcat']['logs'] 40 | action :add 41 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 42 | end 43 | -------------------------------------------------------------------------------- /recipes/varnish.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor Varnish 18 | # 19 | # You'll need to set up the following attributes: 20 | # node.datadog.varnish.instances = [ 21 | # 22 | # # Path to varnishstat (required) 23 | # { 24 | # :varnishstat => "/opt/local/bin/varnishstat" 25 | # }, 26 | # 27 | # # Tags to apply to all varnish metrics (optional) 28 | # { 29 | # :tags => ["test", "cache"] 30 | # }, 31 | # 32 | # # Varnish instance name, passed to varnishstat -n (optional) 33 | # { 34 | # :name => "myvarnish0" 35 | # } 36 | # ] 37 | 38 | datadog_monitor 'varnish' do 39 | instances node['datadog']['varnish']['instances'] 40 | logs node['datadog']['varnish']['logs'] 41 | action :add 42 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 43 | end 44 | -------------------------------------------------------------------------------- /recipes/vault.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor vault 18 | # 19 | 20 | datadog_monitor 'vault' do 21 | instances node['datadog']['vault']['instances'] 22 | logs node['datadog']['vault']['logs'] 23 | action :add 24 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 25 | end 26 | -------------------------------------------------------------------------------- /recipes/weblogic.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor weblogic 18 | # 19 | # Assuming you have 2 instances "test" and "prod", 20 | # one with and one without authentication 21 | # you need to set up the following attributes 22 | # node.datadog.weblogic.instances = [ 23 | # { 24 | # :host => "localhost", 25 | # :port => "9090", 26 | # :name => "prod", 27 | # :username => "username", 28 | # :password => "secret" 29 | # }, 30 | # { 31 | # :host => "localhost", 32 | # :port => "9091", 33 | # :name => "test" 34 | # } 35 | # ] 36 | 37 | datadog_monitor 'weblogic' do 38 | init_config node['datadog']['weblogic']['init_config'] 39 | instances node['datadog']['weblogic']['instances'] 40 | logs node['datadog']['weblogic']['logs'] 41 | use_integration_template true 42 | action :add 43 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 44 | end 45 | -------------------------------------------------------------------------------- /recipes/win32_event_log.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | include_recipe '::dd-agent' 16 | 17 | # Monitor the Windows Event Log 18 | # @see https://github.com/DataDog/integrations-core/blob/master/win32_event_log/datadog_checks/win32_event_log/data/conf.yaml.example for details 19 | # 20 | # @example 21 | # node['datadog']['win32_event_log']['init_config'] = { 22 | # 'tag_event_id' => false # optional, defaults to false 23 | # } 24 | # node['datadog']['win32_event_log']['instances'] = [ 25 | # { 26 | # 'log_file' => ['Application'], 27 | # 'source_name' => ['MSSQLSERVER'], 28 | # 'type' => ['Warning', 'Error'], 29 | # 'message_filters' => ['%error%'], 30 | # 'tags' => ['sqlserver'] 31 | # } 32 | # ] 33 | 34 | datadog_monitor 'win32_event_log' do 35 | init_config node['datadog']['win32_event_log']['init_config'] 36 | instances node['datadog']['win32_event_log']['instances'] 37 | logs node['datadog']['win32_event_log']['logs'] 38 | action :add 39 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 40 | end 41 | -------------------------------------------------------------------------------- /recipes/zookeeper.rb: -------------------------------------------------------------------------------- 1 | # 2 | # Cookbook:: datadog 3 | # Recipe:: zookeeper 4 | # 5 | # Copyright:: 2011-Present, Datadog 6 | # 7 | # Licensed under the Apache License, Version 2.0 (the "License"); 8 | # you may not use this file except in compliance with the License. 9 | # You may obtain a copy of the License at 10 | # 11 | # http://www.apache.org/licenses/LICENSE-2.0 12 | # 13 | # Unless required by applicable law or agreed to in writing, software 14 | # distributed under the License is distributed on an "AS IS" BASIS, 15 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 16 | # See the License for the specific language governing permissions and 17 | # limitations under the License. 18 | 19 | include_recipe '::dd-agent' 20 | 21 | datadog_monitor 'zk' do 22 | instances node['datadog']['zookeeper']['instances'] 23 | logs node['datadog']['zookeeper']['logs'] 24 | action :add 25 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 26 | end 27 | -------------------------------------------------------------------------------- /spec/default_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'spec_helper' 16 | 17 | describe 'datadog::default' do 18 | context 'when converging this recipe' do 19 | let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '16.04').converge described_recipe } 20 | 21 | it 'should do nothing' do 22 | expect(chef_run.resource_collection.resources.count).to eq 0 23 | end 24 | end 25 | end 26 | -------------------------------------------------------------------------------- /spec/integrations/hive_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | describe 'datadog::hive' do 16 | expected_yaml = <<-EOF 17 | logs: ~ 18 | init_config: 19 | is_jmx: true 20 | collect_default_metrics: true 21 | instances: 22 | - host: localhost 23 | EOF 24 | 25 | cached(:chef_run) do 26 | ChefSpec::SoloRunner.new( 27 | platform: 'ubuntu', 28 | version: '16.04', 29 | step_into: ['datadog_monitor'] 30 | ) do |node| 31 | node.normal['datadog'] = { 32 | api_key: 'someapikey', 33 | hive: { 34 | instances: [ 35 | { 36 | host: 'localhost', 37 | } 38 | ] 39 | } 40 | } 41 | end.converge(described_recipe) 42 | end 43 | 44 | subject { chef_run } 45 | 46 | it_behaves_like 'datadog-agent' 47 | 48 | it { is_expected.to include_recipe('datadog::dd-agent') } 49 | 50 | it { is_expected.to add_datadog_monitor('hive') } 51 | 52 | it 'renders expected YAML config file' do 53 | expect(chef_run).to(render_file('/etc/datadog-agent/conf.d/hive.d/conf.yaml').with_content { |content| 54 | expect(YAML.safe_load(content).to_json).to be_json_eql(YAML.safe_load(expected_yaml).to_json) 55 | }) 56 | end 57 | end 58 | -------------------------------------------------------------------------------- /spec/integrations/system_swap_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | describe 'datadog::system_swap' do 16 | expected_yaml = <<-EOF 17 | # Generated by Chef, local modifications will be overwritten 18 | 19 | # This check takes no initial configuration 20 | logs: [] 21 | 22 | init_config: 23 | 24 | instances: 25 | [{}] 26 | EOF 27 | 28 | cached(:chef_run) do 29 | ChefSpec::SoloRunner.new( 30 | platform: 'ubuntu', 31 | version: '16.04', 32 | step_into: ['datadog_monitor'] 33 | ) do |node| 34 | node.automatic['languages'] = { 'python' => { 'version' => '2.7.2' } } 35 | node.normal['datadog'] = { 'api_key' => 'someapikey' } 36 | end.converge(described_recipe) 37 | end 38 | 39 | subject { chef_run } 40 | 41 | it_behaves_like 'datadog-agent' 42 | 43 | it { is_expected.to include_recipe('datadog::dd-agent') } 44 | 45 | it { is_expected.to add_datadog_monitor('system_swap') } 46 | 47 | it 'renders expected YAML config file' do 48 | expect(chef_run).to(render_file('/etc/datadog-agent/conf.d/system_swap.d/conf.yaml') 49 | .with_content { |content| 50 | expect(YAML.safe_load(content).to_json).to be_json_eql(YAML.safe_load(expected_yaml).to_json) 51 | }) 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /tasks/config_specification.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'inflecto' 16 | require 'virtus' 17 | require 'pp' 18 | 19 | module ConfigSpecification 20 | end 21 | 22 | require_relative 'config_specification/models' 23 | require_relative 'config_specification/template_cache' 24 | require_relative 'config_specification/overrider' 25 | require_relative 'config_specification/yaml_expander' 26 | require_relative 'config_specification/parameters_serializer' 27 | require_relative 'config_specification/monitor_serializer' 28 | -------------------------------------------------------------------------------- /tasks/config_specification/monitor_serializer.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module ConfigSpecification 16 | class MonitorSerializer 17 | def initialize(specification, integration_name) 18 | @specification = specification 19 | @integration_name = integration_name 20 | end 21 | 22 | def serialize 23 | %(include_recipe '::dd-agent' 24 | 25 | # Monitor #{specification.name} 26 | # 27 | # Here is the description of acceptable attributes: 28 | #{commented_parameters} 29 | datadog_monitor '#{integration_name}' do 30 | init_config node['datadog']['#{integration_name}']['init_config'] 31 | instances node['datadog']['#{integration_name}']['instances'] 32 | logs node['datadog']['#{integration_name}']['logs'] 33 | use_integration_template true 34 | action :add 35 | notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] 36 | end 37 | ) 38 | end 39 | 40 | private 41 | 42 | attr_reader :specification 43 | attr_reader :integration_name 44 | 45 | def commented_parameters 46 | "node.datadog.#{integration_name} = #{parameters}".gsub(/^(.*)/, '# \1') 47 | end 48 | 49 | def parameters 50 | ParametersSerializer.new(specification, integration_name).serialize 51 | end 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /tasks/config_specification/overrider.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module ConfigSpecification 16 | # Overriding values using the syntax from specification files 17 | class Overrider 18 | def initialize(overrides = {}) 19 | @overrides = overrides 20 | end 21 | 22 | def apply(object) 23 | overrides.each do |path, value| 24 | *steps, attribute = path.split('.') 25 | 26 | to_override = descend(object, steps) 27 | 28 | to_override[attribute] = value 29 | end 30 | 31 | object 32 | end 33 | 34 | private 35 | 36 | attr_reader :overrides 37 | 38 | def descend(object, steps) 39 | return object if steps.empty? 40 | 41 | next_step, *further_steps = steps 42 | 43 | sub_object = find_sub_object(object, next_step) 44 | 45 | raise "Cannot browse to #{next_step} on #{object.inspect}" unless sub_object 46 | 47 | descend(sub_object, further_steps) 48 | end 49 | 50 | def find_sub_object(object, next_step) 51 | case object 52 | when Array 53 | object.detect do |sub_object| 54 | sub_object['name'].downcase == next_step.downcase 55 | end 56 | when Hash 57 | object[next_step] 58 | end 59 | end 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /tasks/config_specification/template_cache.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | module ConfigSpecification 16 | # Bookeeping expanded templates 17 | class TemplateCache 18 | SUB_PATH = 'datadog_checks_dev/datadog_checks/dev/tooling/templates/configuration/'.freeze 19 | 20 | def initialize(core_path) 21 | @templates_path = Pathname.new(core_path) + SUB_PATH 22 | @templates = {} 23 | 24 | @expander = YAMLExpander.new(self) 25 | end 26 | 27 | def fetch_template(path) 28 | unless templates.key?(path) 29 | # load yaml of template 30 | template = YAML.load_file(templates_path + "#{path}.yaml") 31 | 32 | # expand template once and for all 33 | templates[path] = expander.expand(template) 34 | end 35 | 36 | # making deep_dup of template so that the caller 37 | # can use it as it wants 38 | templates[path].deep_dup 39 | end 40 | 41 | private 42 | 43 | attr_reader :templates 44 | attr_reader :templates_path 45 | attr_reader :expander 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /templates/default/apache.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - apache_status_url: <%= i['status_url'] %> 6 | <% if i['apache_user'] -%>apache_user: <%= i['apache_user'] %><% end -%> 7 | <% if i['apache_password'] -%>apache_password: <%= i['apache_password'] %><% end -%> 8 | <% if i['disable_ssl_validation'] -%>disable_ssl_validation: <%= i['disable_ssl_validation'] %><% end -%> 9 | 10 | <% if i.key?('tags') -%> 11 | tags: 12 | <% i['tags'].each do |t| -%> 13 | - <%= t %> 14 | <% end -%> 15 | <% end -%> 16 | <% end -%> 17 | 18 | # Nothing to configure here 19 | init_config: 20 | -------------------------------------------------------------------------------- /templates/default/cacti.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - mysql_host: <%= i['mysql_host'] %> 6 | mysql_user: <%= i['mysql_user'] %> 7 | mysql_password: <%= i['mysql_password'] %> 8 | rrd_path: <%= i['rrd_path'] %> 9 | <% if i['rrd_whitelist'] -%> 10 | rrd_whitelist: <%= i['rrd_whitelist'] %> 11 | <% end -%> 12 | 13 | <% if i.key?('field_names') -%> 14 | field_names: 15 | <% i['field_names'].each do |fn| -%> 16 | - <%= fn %> 17 | <% end -%> 18 | <% end -%> 19 | <% end -%> 20 | 21 | # Nothing to configure here 22 | init_config: 23 | -------------------------------------------------------------------------------- /templates/default/consul.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - url: <%= i['url'] %> 6 | <% unless i['new_leader_checks'].nil? %> 7 | new_leader_checks: <%= i['new_leader_checks'] %> 8 | <% end %> 9 | <% unless i['self_leader_check'].nil? %> 10 | self_leader_check: <%= i['self_leader_check'] %> 11 | <% end %> 12 | <% unless i['network_latency_checks'].nil? %> 13 | network_latency_checks: <%= i['network_latency_checks'] %> 14 | <% end %> 15 | <% unless i['catalog_checks'].nil? %> 16 | catalog_checks: <%= i['catalog_checks'] %> 17 | <% end %> 18 | <% unless i['service_whitelist'].nil? %> 19 | service_whitelist: <%= i['service_whitelist'] %> 20 | <% end %> 21 | <% if i.key?('tags') && !i['tags'].empty? -%> 22 | tags: 23 | <% i['tags'].each do |t| -%> 24 | - <%= t %> 25 | <% end -%> 26 | <% end -%> 27 | <% end -%> 28 | 29 | # Nothing to configure here 30 | init_config: 31 | -------------------------------------------------------------------------------- /templates/default/couch.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - server: <%= i['server'] %> 6 | <% (i.keys - ['server']).each do |key| -%> 7 | <%= key %>: <%= i[key] %> 8 | <% end -%> 9 | <% end -%> 10 | 11 | # Nothing to change below 12 | init_config: 13 | -------------------------------------------------------------------------------- /templates/default/couchbase.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({ 'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - server: <%= i['server'] %> 6 | user: <%= @node.fetch('couchbase', {}).fetch('server', {}).fetch('username', i.fetch('username', 'Administrator')) %> 7 | password: <%= @node.fetch('couchbase', {}).fetch('server', {}).fetch('password', i.fetch('password', '')) %> 8 | <% end %> 9 | init_config: 10 | -------------------------------------------------------------------------------- /templates/default/custom_log_collection.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml -%> 2 | -------------------------------------------------------------------------------- /templates/default/directory.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - directory: "<%= i['directory'] %>" 6 | <% if i['name'] -%>name: "<%= i['name'] %>"<% end -%> 7 | <% if i['dirtagname'] -%>dirtagname: "<%= i['dirtagname'] %>"<% end -%> 8 | <% if i['filetagname'] -%>filetagname: "<%= i['filetagname'] %>"<% end -%> 9 | <% if i.key?('filegauges') -%>filegauges: <%= i['filegauges'] %><% end -%> 10 | <% if i['pattern'] -%>pattern: "<%= i['pattern'] %>"<% end -%> 11 | <% if i.key?('recursive') -%>recursive: <%= i['recursive'] %><% end -%> 12 | <% if i.key?('tags') -%> 13 | tags: 14 | <% i['tags'].each do |t| -%> 15 | - <%= t %> 16 | <% end -%> 17 | <% end -%> 18 | <% end -%> 19 | 20 | # Nothing to configure here 21 | init_config: 22 | -------------------------------------------------------------------------------- /templates/default/disk.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'instances' => @instances, 'init_config' => @init_config, 'logs' => @logs }).to_json).to_yaml %> 4 | -------------------------------------------------------------------------------- /templates/default/dns_check.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - hostname: <%= i["hostname"] %> 6 | nameserver: <%= i["nameserver"] || '127.0.0.1' %> 7 | <% unless i["timeout"].nil? %> 8 | timeout: <%= i["timeout"] %> 9 | <% end %> 10 | <% end %> 11 | 12 | init_config: 13 | default_timeout: 4 14 | -------------------------------------------------------------------------------- /templates/default/docker.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | 5 | init_config: 6 | <% if @init_config %> 7 | <% if @init_config.key?('docker_root') -%> 8 | docker_root: <%= @init_config['docker_root'] %> 9 | <% end -%> 10 | <% if @init_config.key?('socket_timeout') -%> 11 | socket_timeout: <%= @init_config['socket_timeout'] %> 12 | <% end -%> 13 | <% end -%> 14 | -------------------------------------------------------------------------------- /templates/default/docker_daemon.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'init_config' => @init_config, 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | -------------------------------------------------------------------------------- /templates/default/elastic.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - url: <%= i["url"] %> 6 | <% unless i["shard_level_metrics"].nil? %> 7 | shard_level_metrics: <%= i["shard_level_metrics"] %> 8 | <% end %> 9 | <% unless i["pshard_stats"].nil? %> 10 | pshard_stats: <%= i["pshard_stats"] %> 11 | <% end %> 12 | <% unless i["cluster_stats"].nil? %> 13 | cluster_stats: <%= i["cluster_stats"] %> 14 | <% end %> 15 | <% unless i["index_stats"].nil? %> 16 | index_stats: <%= i["index_stats"] %> 17 | <% end %> 18 | <% unless i["is_external"].nil? %> 19 | is_external: <%= i["is_external"] %> 20 | <% end %> 21 | <% unless i["username"].nil? %> 22 | username: <%= i["username"] %> 23 | <% end %> 24 | <% unless i["password"].nil? %> 25 | password: <%= i["password"] %> 26 | <% end %> 27 | <% unless i["timeout"].nil? %> 28 | timeout: <%= i["timeout"] %> 29 | <% end %> 30 | <% unless i["pending_task_stats"].nil? %> 31 | pending_task_stats: <%= i["pending_task_stats"] %> 32 | <% end %> 33 | <% unless i["ssl_verify"].nil? %> 34 | ssl_verify: <%= i["ssl_verify"] %> 35 | <% end %> 36 | <% unless i["ssl_cert"].nil? %> 37 | ssl_cert: <%= i["ssl_cert"] %> 38 | <% end %> 39 | <% unless i["ssl_key"].nil? %> 40 | ssl_key: <%= i["ssl_key"] %> 41 | <% end %> 42 | <% if i.key?('tags') -%> 43 | tags: 44 | <% i['tags'].each do |t| -%> 45 | - <%= t %> 46 | <% end -%> 47 | <% end -%> 48 | <% end %> 49 | 50 | # Nothing to configure below 51 | init_config: 52 | -------------------------------------------------------------------------------- /templates/default/etcd.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - url: <%= i['url'] %> 6 | <% if i['timeout'] -%>timeout: <%= i['timeout'] %><% end -%> 7 | <% if i['ssl_keyfile'] -%>ssl_keyfile: <%= i['ssl_keyfile'] %><% end -%> 8 | <% if i['ssl_certfile'] -%>ssl_certfile: <%= i['ssl_certfile'] %><% end -%> 9 | <% if i['ssl_cert_validation'] -%>ssl_cert_validation: <%= i['ssl_cert_validation'] %><% end -%> 10 | <% if i['ssl_ca_certs'] -%>ssl_ca_certs: <%= i['ssl_ca_certs'] %><% end -%> 11 | <% if i.key?('tags') -%> 12 | tags: 13 | <% i['tags'].each do |t| -%> 14 | - <%= t %> 15 | <% end -%> 16 | <% end -%> 17 | <% end -%> 18 | 19 | # Nothing to configure here 20 | init_config: 21 | -------------------------------------------------------------------------------- /templates/default/fluentd.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 2 | 3 | # Nothing to configure here 4 | init_config: 5 | -------------------------------------------------------------------------------- /templates/default/gearmand.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml -%> 2 | 3 | instances: 4 | <% @instances.each do |i| %> 5 | <% if i['server'] -%> 6 | <% ip = i['server'] %> 7 | <% else %> 8 | <% ip = '127.0.0.1' %> 9 | <% end -%> 10 | - server: <%= ip %> 11 | <% if i['port'] -%> 12 | <% port = i['port'] %> 13 | <% else %> 14 | <% port = '4730' %> 15 | <% end -%> 16 | port: <%= port %> 17 | <% if i['tasks'] %> 18 | tasks: 19 | <% i['tasks'].each do |task| -%> 20 | - <%= task %> 21 | <% end %> 22 | <% end %> 23 | <% if i['tags'] %> 24 | tags: 25 | <% i['tags'].each do |tag| -%> 26 | - <%= tag %> 27 | <% end %> 28 | <% end %> 29 | <% if i['service'] %> 30 | service: <%= i['service'] %> 31 | <% end %> 32 | <% if i['min_collection_interval'] %> 33 | <% seconds = i['min_collection_interval'] %> 34 | <% else %> 35 | <% seconds = 15 %> 36 | <% end %> 37 | min_collection_interval: <%= seconds %> 38 | <% if i['empty_default_hostname'] %> 39 | <% boolean = i['empty_default_hostname'] %> 40 | <% else %> 41 | <% boolean = false %> 42 | <% end %> 43 | empty_default_hostname: <%= boolean %> 44 | <% if i['metric_patterns'] %> 45 | metric_patterns: 46 | <% if i['metric_patterns'].include?('include') %> 47 | include: 48 | <% i['metric_patterns']['include'].each do |regex| %> 49 | - <%= regex %> 50 | <% end %> 51 | <% end %> 52 | <% if i['metric_patterns'].include?('exclude') %> 53 | exclude: 54 | <% i['metric_patterns']['exclude'].each do |regex| %> 55 | - <%= regex %> 56 | <% end %> 57 | <% end %> 58 | <% end %> 59 | <% end -%> 60 | 61 | init_config: 62 | # No init_config details needed 63 | -------------------------------------------------------------------------------- /templates/default/go-metro.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'init_config' => @init_config, 'instances' => @instances, 'logs' => @logs}).to_json).to_yaml %> 4 | 5 | -------------------------------------------------------------------------------- /templates/default/go_expvar.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'init_config' => @init_config, 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | -------------------------------------------------------------------------------- /templates/default/gunicorn.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - proc_name: <%= i['proc_name'] %> 6 | <% if i.key?('tags') -%> 7 | tags: 8 | <% i['tags'].each do |t| -%> 9 | - <%= t %> 10 | <% end -%> 11 | <% end -%> 12 | <% end -%> 13 | 14 | # Nothing to configure here 15 | init_config: 16 | -------------------------------------------------------------------------------- /templates/default/haproxy.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | <% excluded_keys = ["url", "username", "password"] -%> 4 | instances: 5 | <% @instances.each do |i| -%> 6 | - url: <%= i['url'] %> 7 | <% if i.key?('username') && i.key?('password') -%> 8 | username: <%= i['username'] %> 9 | password: <%= i['password'] %> 10 | <% end -%> 11 | <% (i.keys - excluded_keys).each do |key| -%> 12 | <%= key %>: <%= i[key] %> 13 | <% end -%> 14 | <% end -%> 15 | 16 | # Nothing to configure below 17 | init_config: 18 | -------------------------------------------------------------------------------- /templates/default/hdfs.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | # Each instance requires a namenode hostname. 4 | # Port defaults to 8020. 5 | instances: 6 | <% @instances.each do |instance| -%> 7 | - namenode: <%= instance.fetch("fqdn"){ node["fqdn"] } %> 8 | port: <%= instance.fetch("port", 8020) %> 9 | <% if instance.key?("tags") -%> 10 | tags: 11 | <% instance["tags"].each do |tag| -%> 12 | - <%= tag %> 13 | <% end -%> 14 | <% end -%> 15 | <% end -%> 16 | 17 | # HDFS check does not require any init_config 18 | init_config: 19 | -------------------------------------------------------------------------------- /templates/default/http_check.yaml.erb: -------------------------------------------------------------------------------- 1 | <%# Sanitize the compiled Mash to standard Array/Hash objects by way of JSON -%> 2 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 3 | 4 | init_config: 5 | # Nothing to configure here 6 | -------------------------------------------------------------------------------- /templates/default/iis.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | # By default, this check will run against a single instance - the current 4 | # machine that the Agent is running on. It will check the WMI performance 5 | # counters for IIS on that machine. 6 | # 7 | # If you want to check other remote machines as well, you can add one 8 | # instance per host. Note: If you also want to check the counters on the 9 | # current machine, you will have to create an instance with empty params. 10 | 11 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 12 | 13 | instances: 14 | <% @instances.each do |i| -%> 15 | <% if i['host'] == 'localhost' -%> 16 | - host: . 17 | <% else -%> 18 | - host: <%= i['host'] %> 19 | <% end -%> 20 | <% if i.key?('username') -%> 21 | username: <%= i['username'] %> 22 | password: <%= i['password'] %> 23 | <% end -%> 24 | <% if i.key?('provider') -%> 25 | provider: <%= i['provider'] %> 26 | <% end -%> 27 | <% if i.key?('tags') -%> 28 | tags: 29 | <% i['tags'].each do |t| -%> 30 | - <%= t %> 31 | <% end -%> 32 | <% end -%> 33 | <% if i.key?('sites') -%> 34 | sites: 35 | <% i['sites'].each do |s| -%> 36 | - <%= s %> 37 | <% end -%> 38 | <% end -%> 39 | <% end -%> 40 | 41 | init_config: 42 | -------------------------------------------------------------------------------- /templates/default/install_info.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= 2 | { 3 | 'install_method' => { 4 | 'tool' => 'chef', 5 | 'tool_version' => "chef-#{@chef_version}", 6 | 'installer_version' => "datadog_cookbook-#{@cookbook_version}", 7 | }, 8 | }.to_yaml %> 9 | -------------------------------------------------------------------------------- /templates/default/integration.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'instances' => @instances, 'init_config' => @init_config, 'logs' => @logs }).to_json).to_yaml %> 4 | -------------------------------------------------------------------------------- /templates/default/jenkins.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - name: <%= i['name'] %> 6 | jenkins_home: <%= i['home'] %> 7 | <% end -%> 8 | 9 | init_config: 10 | -------------------------------------------------------------------------------- /templates/default/jmx.yaml.erb: -------------------------------------------------------------------------------- 1 | <%# Sanitize the compiled Mash to standard Array/Hash objects by way of JSON -%> 2 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 3 | 4 | init_config: 5 | # Nothing to configure here 6 | -------------------------------------------------------------------------------- /templates/default/kafka_consumer.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - kafka_connect_str: <%= i['kafka_connect_str'] %> 6 | <% if i['consumer_groups'] -%> 7 | consumer_groups: <%= i['name'] %> 8 | <% i["consumer_groups"].each do |consumer, t| -%> 9 | <%= consumer %>: 10 | <% t.each do |topic, l| -%> 11 | <%= topic %>: <%= l %> 12 | <% end -%> 13 | <% end -%> 14 | <% end -%> 15 | <% if i.key?('monitor_unlisted_consumer_groups') -%> 16 | monitor_unlisted_consumer_groups: <%= if i['monitor_unlisted_consumer_groups'] == true && !i['consumer_groups']; true; else false; end %> 17 | <% end -%> 18 | zk_connect_str: <%= i['zk_connect_str'] %> 19 | <% if i['zk_prefix'] -%> 20 | zk_prefix: <%= i['zk_prefix'] %> 21 | <% end -%> 22 | <% if i.key?('kafka_consumer_offsets') && i['kafka_consumer_offsets'] == true-%> 23 | kafka_consumer_offsets: true 24 | <% end -%> 25 | <% end -%> 26 | 27 | init_config: 28 | # The Kafka Consumer check does not require any init_config 29 | -------------------------------------------------------------------------------- /templates/default/kubernetes.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 2 | 3 | # Nothing to configure here 4 | init_config: 5 | -------------------------------------------------------------------------------- /templates/default/kyototycoon.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | # Add one or more instances, which accept report_url, 4 | # name, and optionally tags keys. The report URL should 5 | # be a URL to the Kyoto Tycoon "report" RPC endpoint. 6 | instances: 7 | <% @instances.each do |i| -%> 8 | - name: <%= i['name'] %> 9 | report_url: <%= i['report_url'] %> # e.g. http://localhost:1978/rpc/report 10 | <% if i.key?('tags') -%> 11 | tags: 12 | <% @tags.each do |k, v| -%> 13 | <%= k %>: <%= v %> 14 | <% end -%> 15 | <% end -%> 16 | <% end -%> 17 | 18 | init_config: 19 | # The Kyoto Tycoon check does not require any init_config 20 | -------------------------------------------------------------------------------- /templates/default/lighttpd.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - lighttpd_status_url: <%= i['status_url'] %> 6 | <% if i.key?('tags') -%> 7 | tags: 8 | <% i['tags'].each do |t| -%> 9 | - <%= t %> 10 | <% end -%> 11 | <% end -%> 12 | <% end -%> 13 | 14 | init_config: 15 | # No init_config section needed 16 | -------------------------------------------------------------------------------- /templates/default/mcache.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - url: <%= i['url'] %> 6 | <% if i.key?('port') -%> 7 | port: <%= i['port'] %> 8 | <% end -%> 9 | <% if i.key?('tags') -%> 10 | tags: 11 | <% i['tags'].each do |t| -%> 12 | - <%= t %> 13 | <% end -%> 14 | <% end -%> 15 | <% if i.key?('options') -%> 16 | options: 17 | <% i['options'].each do |o| -%> 18 | <%= o %> 19 | <% end -%> 20 | <% end -%> 21 | <% end -%> 22 | 23 | init_config: 24 | # No init_config section needed 25 | -------------------------------------------------------------------------------- /templates/default/mesos_master.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | 5 | init_config: 6 | <% if @init_config.key?('default_timeout') -%> 7 | default_timeout: <%= @init_config['default_timeout'] %> 8 | <% end -%> 9 | -------------------------------------------------------------------------------- /templates/default/mesos_slave.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | 5 | init_config: 6 | <% if @init_config.key?('default_timeout') -%> 7 | default_timeout: <%= @init_config['default_timeout'] %> 8 | <% end -%> 9 | -------------------------------------------------------------------------------- /templates/default/mongo.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - hosts: 6 | - <%= i['host']%>:<%= i['port'] %> 7 | <% if i.key?('username') -%> 8 | username: <%= i['username'] %> 9 | <% end -%> 10 | <% if i.key?('password') -%> 11 | password: <%= i['password'] %> 12 | <% end -%> 13 | <% if i.key?('timeout') -%> 14 | timeout: <%= i['timeout'] %> 15 | <% end -%> 16 | <% if i.key?('tags') -%> 17 | tags: 18 | <% i['tags'].each do |t| -%> 19 | - <%= t %> 20 | <% end -%> 21 | <% end -%> 22 | <% if i.key?('ssl') -%> 23 | ssl: <%= i['ssl'] %> 24 | ssl_ca_certs: <%= i['ssl_ca_certs'] %> 25 | ssl_cert_reqs: <%= i['ssl_cert_reqs'] %> 26 | ssl_certfile: <%= i['ssl_certfile'] %> 27 | ssl_keyfile: <%= i['ssl_keyfile'] %> 28 | <% end %> 29 | <% if i.key?('additional_metrics') -%> 30 | additional_metrics: 31 | <% i['additional_metrics'].each do |t| %> 32 | - <%= t %> 33 | <%end -%> 34 | <% end %> 35 | <% if i.key?('collections') -%> 36 | collections: 37 | <% i['collections'].each do |t| %> 38 | - <%= t %> 39 | <%end -%> 40 | <% end %> 41 | <% end -%> 42 | 43 | init_config: 44 | # No init_config details needed 45 | -------------------------------------------------------------------------------- /templates/default/mysql.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - server: <%= i['server'] %> 6 | <% if i.key?('port') -%> 7 | port: <%= i['port'] %> 8 | <% end -%> 9 | user: <%= i['user'] %> 10 | pass: <%= i['pass'] %> 11 | <% if i.key?('sock') -%> 12 | sock: <%= i['sock'] %> 13 | <% end -%> 14 | <% if i.key?('min_collection_interval') -%> 15 | min_collection_interval: <%= i['min_collection_interval'] %> 16 | <% end -%> 17 | <% if i.key?('tags') -%> 18 | tags: 19 | <% i['tags'].each do |t| -%> 20 | - <%= t %> 21 | <% end -%> 22 | <% end -%> 23 | <% if i.key?('options') -%> 24 | options: 25 | <% i['options'].each do |o| -%> 26 | <%= o %> 27 | <% end -%> 28 | <% end -%> 29 | <% if i.key?('queries') -%> 30 | queries: 31 | <% i['queries'].each do |q| -%> 32 | - type: <%= q['type'] %> 33 | field: <%= q['field'] %> 34 | metric: <%= q['metric'] %> 35 | query: <%= q['query'] %> 36 | <% end -%> 37 | <% end -%> 38 | <% end -%> 39 | 40 | # Nothing to configure here 41 | init_config: 42 | -------------------------------------------------------------------------------- /templates/default/network.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | init_config: 4 | 5 | # Network check supports only one configured instance 6 | instances: 7 | <% @instances.each do |i| -%> 8 | - collect_connection_state: <%= i['collect_connection_state'] || 'false' %> 9 | excluded_interfaces: 10 | <% i["excluded_interfaces"].each do |interface| -%> 11 | - <%= interface %> 12 | <% end -%> 13 | combine_connection_states: <%= i['combine_connection_states'] || 'true' %> 14 | collect_count_metrics: <%= i['collect_count_metrics'] || 'false' %> 15 | <% end -%> 16 | -------------------------------------------------------------------------------- /templates/default/nginx.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - nginx_status_url: <%= i['nginx_status_url'] %> 6 | <% unless i['ssl_validation'].nil? -%> 7 | ssl_validation: <%= i['ssl_validation'] %> 8 | <% end -%> 9 | <% unless i['skip_proxy'].nil? -%> 10 | skip_proxy: <%= i['skip_proxy'] %> 11 | <% end -%> 12 | <% unless i['use_plus_api'].nil? -%> 13 | use_plus_api: <%= i['use_plus_api'] %> 14 | <% end -%> 15 | <% unless i['plus_api_version'].nil? -%> 16 | plus_api_version: <%= i['plus_api_version'] %> 17 | <% end -%> 18 | <% unless i['use_vts'].nil? -%> 19 | use_vts: <%= i['use_vts'] %> 20 | <% end -%> 21 | <%# don't print user/password if either is nil -%> 22 | <% unless i['user'].nil? || i['password'].nil? -%> 23 | user: <%= i['user'] %> 24 | password: <%= i['password'] %> 25 | <% end -%> 26 | <% if i.key?('tags') -%> 27 | tags: 28 | <% i['tags'].each do |t| -%> 29 | - <%= t %> 30 | <% end -%> 31 | <% end -%> 32 | <% end -%> 33 | 34 | # Nothing to configure here 35 | init_config: 36 | -------------------------------------------------------------------------------- /templates/default/ntp.yaml.erb: -------------------------------------------------------------------------------- 1 | <%# Sanitize the compiled Mash to standard Array/Hash objects by way of JSON -%> 2 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 3 | 4 | init_config: 5 | # Nothing to configure here 6 | -------------------------------------------------------------------------------- /templates/default/pgbouncer.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | 5 | init_config: 6 | # Nothing to configure here 7 | -------------------------------------------------------------------------------- /templates/default/php_fpm.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 2 | 3 | init_config: 4 | # nothing to add here 5 | -------------------------------------------------------------------------------- /templates/default/postfix.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | # Each instance requires a directory and an array of queues. 4 | # Tags are optional. 5 | instances: 6 | <% @instances.each do |instance| -%> 7 | - directory: <%= instance['directory'] %> 8 | queues: 9 | <% Array(instance['queues']).each do |queue| -%> 10 | - <%= queue %> 11 | <% end -%> 12 | <% if instance.key?('tags') -%> 13 | tags: 14 | <% Array(instance['tags']).each do |tag| -%> 15 | - <%= tag %> 16 | <% end -%> 17 | <% end -%> 18 | <% end -%> 19 | 20 | # Postfix check does not require any init_config 21 | init_config: 22 | -------------------------------------------------------------------------------- /templates/default/postgres.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%# TODO: Breaking change, remove defaults -%> 4 | <% 5 | # Apply default transformations to @instances, an ImmutableArray 6 | instances = @instances.to_a 7 | 8 | instances.each do |instance| 9 | # The `server` key renders as a `host` value 10 | # `if` test future-proofs the key from being modified if users change to 11 | # using `host` as their key. 12 | instance['host'] = instance.delete 'server' if instance['server'] 13 | 14 | # If `port` is unspecified and host is not a domain socket, set to 5432 15 | instance['port'] = 5432 if (instance['port'].nil? and !instance['host'].start_with?('/')) 16 | end 17 | -%> 18 | <%= JSON.parse(({ 'instances' => instances, 'logs' => @logs }).to_json).to_yaml %> 19 | 20 | init_config: 21 | # Nothing to configure here 22 | -------------------------------------------------------------------------------- /templates/default/process.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 2 | 3 | init_config: -------------------------------------------------------------------------------- /templates/default/redisdb.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | <% if i.key?("unix_socket_path") -%> 6 | - unix_socket_path: <%= i["unix_socket_path"] %> 7 | <% else -%> 8 | - host: <%= i["server"] %> 9 | port: <%= i["port"] || 6379 %> 10 | <% end -%> 11 | <% if i.key?("password") -%> 12 | password: <%= i["password"] %> 13 | <% end -%> 14 | <% if i.key?("db") -%> 15 | db: <%= i["db"] %> 16 | <% end -%> 17 | <% if i.key?("ssl") -%> 18 | ssl: <%= i["ssl"] %> 19 | <% if i.key?("ssl_keyfile") -%> 20 | ssl_keyfile: <%= i["ssl_keyfile"] %> 21 | <% end %> 22 | <% if i.key?("ssl_certfile") -%> 23 | ssl_certfile: <%= i["ssl_certfile"] %> 24 | <% end %> 25 | <% if i.key?("ssl_ca_certs") -%> 26 | ssl_ca_certs: <%= i["ssl_ca_certs"] %> 27 | <% end %> 28 | <% if i.key?("ssl_cert_reqs") -%> 29 | ssl_cert_reqs: <%= i["ssl_cert_reqs"] %> 30 | <% end %> 31 | <% end -%> 32 | <% if i.key?("tags") -%> 33 | tags: 34 | <% i["tags"].each do |t| -%> 35 | - <%= t %> 36 | <% end -%> 37 | <% end -%> 38 | <% if i.key?("keys") -%> 39 | <% if i.key?("warn_on_missing_keys") -%> 40 | warn_on_missing_keys: <%= i['warn_on_missing_keys'] %> 41 | <% end -%> 42 | keys: 43 | <% i["keys"].each do |k| -%> 44 | - <%= k %> 45 | <% end -%> 46 | <% end -%> 47 | <% if i.key?('slowlog-max-len') -%>slowlog-max-len: <%= i['slowlog-max-len'] %><% end -%> 48 | <% if i.key?('socket_timeout') -%>socket_timeout: <%= i['socket_timeout'] %><% end -%> 49 | <% if i.key?('command_stats') -%>command_stats: <%= i['command_stats'] %><% end -%> 50 | <% end -%> 51 | 52 | init_config: 53 | # nothing to add here 54 | -------------------------------------------------------------------------------- /templates/default/security-agent.yaml.erb: -------------------------------------------------------------------------------- 1 | <% 2 | ## Populate system_probe_config ## 3 | security_agent_config = { 4 | runtime_security_config: { 5 | enabled: @runtime_security_enabled, 6 | }.merge(@runtime_security_extra_config), 7 | compliance_config: { 8 | enabled: @compliance_enabled, 9 | }.merge(@compliance_extra_config), 10 | } 11 | -%> 12 | 13 | <%= JSON.parse(security_agent_config.to_json).to_yaml %> -------------------------------------------------------------------------------- /templates/default/snmp.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({'init_config' => @init_config, 'instances' => @instances, 'logs' => @logs}).to_json).to_yaml %> 4 | -------------------------------------------------------------------------------- /templates/default/sqlserver.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({'init_config' => @init_config, 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | -------------------------------------------------------------------------------- /templates/default/ssh_check.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - host: <%= i['host'] %> 6 | username: <%= i['username'] %> 7 | <% 8 | keys = %w(password port sftp_check private_key_file add_missing_keys min_collection_interval tags) 9 | keys.each do |key| 10 | if i.key?(key) 11 | -%> 12 | <%= key %>: <%= i[key] %> 13 | <% 14 | end 15 | end 16 | -%> 17 | <% if i.key?('tags') -%> 18 | tags: 19 | <% i['tags'].each do |t| -%> 20 | - <%= t %> 21 | <% end -%> 22 | <% end -%> 23 | <% end -%> 24 | 25 | # Nothing to configure here 26 | init_config: 27 | -------------------------------------------------------------------------------- /templates/default/supervisord.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | 5 | # Nothing to configure here 6 | init_config: 7 | -------------------------------------------------------------------------------- /templates/default/system_core.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 3 | 4 | init_config: 5 | 6 | instances: 7 | # No configuration is needed for this check. 8 | # A single instance needs to be defined with any value. 9 | - foo: bar 10 | -------------------------------------------------------------------------------- /templates/default/system_probe.yaml.erb: -------------------------------------------------------------------------------- 1 | <% 2 | ## Populate system_probe_config ## 3 | system_probe_config = { 4 | system_probe_config: { 5 | enabled: @enabled, 6 | sysprobe_socket: @sysprobe_socket, 7 | debug_port: @debug_port, 8 | bpf_debug: @bpf_debug, 9 | enable_conntrack: @enable_conntrack, 10 | }.merge(@system_probe_extra_config), 11 | } 12 | 13 | if @runtime_security_enabled 14 | system_probe_config['runtime_security_config'] = { 15 | enabled: @runtime_security_enabled 16 | }.merge(@runtime_security_extra_config) 17 | end 18 | 19 | # We let the Agent default value take effect if user didn't explicitly 20 | # specify something else than nil for 'network_enabled' 21 | if !node['datadog']['system_probe']['network_enabled'].nil? 22 | system_probe_config['network_config'] = { 23 | 'enabled': node['datadog']['system_probe']['network_enabled'], 24 | } 25 | end 26 | if !node['datadog']['system_probe']['service_monitoring_enabled'].nil? 27 | system_probe_config['service_monitoring_config'] = { 28 | 'enabled': node['datadog']['system_probe']['service_monitoring_enabled'], 29 | } 30 | end 31 | -%> 32 | # Generated by Chef, local modifications will be overwritten 33 | 34 | <%= JSON.parse(system_probe_config.to_json).to_yaml %> 35 | -------------------------------------------------------------------------------- /templates/default/system_swap.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 4 | 5 | # This check takes no initial configuration 6 | init_config: 7 | 8 | instances: 9 | [{}] 10 | -------------------------------------------------------------------------------- /templates/default/systemd.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml -%> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - unit_names: 6 | <% i['unit_names'].each do |u| -%> 7 | - <%= u %> 8 | <% end -%> 9 | <% if i.key?('substate_status_mapping') -%> 10 | substate_status_mapping: 11 | <% i['substate_status_mapping'].each do |s| -%> 12 | <% %w(targets services sockets devices mounts automounts swaps paths timers snapshots slices scopes busnames).each do |unit_type| -%> 13 | <% if s.key?(unit_type)-%> 14 | <% s[unit_type].each do |k| -%> 15 | <% k.keys.each do |j| -%> 16 | <%= j %>.<%= unit_type.chomp('s') %>: 17 | <% k[j].each do |l,v| %> 18 | <%= l %>: <%= v %> 19 | <% end -%> 20 | <% end -%> 21 | <% end -%> 22 | <% end -%> 23 | <% end -%> 24 | <% end -%> 25 | <% end -%> 26 | <% if i.key?('tags') -%> 27 | tags: 28 | <% i['tags'].each do |t| -%> 29 | - <%= t %> 30 | <% end -%> 31 | <% end -%> 32 | <% end -%> 33 | 34 | init_config: 35 | # No init_config details needed 36 | -------------------------------------------------------------------------------- /templates/default/tcp_check.yaml.erb: -------------------------------------------------------------------------------- 1 | <%# Sanitize the compiled Mash to standard Array/Hash objects by way of JSON -%> 2 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 3 | 4 | init_config: 5 | # Nothing to configure here 6 | -------------------------------------------------------------------------------- /templates/default/tokumx.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({ 'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - server: mongodb://<%= i['host']%>:<%= i['port'] %> 6 | <% if i.key?('tags') -%> 7 | tags: 8 | <% i['tags'].each do |t| -%> 9 | - <%= t %> 10 | <% end -%> 11 | <% end -%> 12 | <% if i.key?('ssl') -%> 13 | ssl: <%= i['ssl'] %> 14 | ssl_ca_certs: <%= i['ssl_ca_certs'] %> 15 | ssl_cert_reqs: <%= i['ssl_cert_reqs'] %> 16 | ssl_certfile: <%= i['ssl_certfile'] %> 17 | ssl_keyfile: <%= i['ssl_keyfile'] %> 18 | <% end %> 19 | <% if i.key?('additional_metrics') -%> 20 | additional_metrics: 21 | <% i['additional_metrics'].each do |t| %> 22 | - <%= t %> 23 | <%end -%> 24 | <% end %> 25 | <% if i.key?('collections') -%> 26 | collections: 27 | <% i['collections'].each do |t| %> 28 | - <%= t %> 29 | <%end -%> 30 | <% end %> 31 | <% end -%> 32 | 33 | init_config: 34 | # No init_config details needed 35 | -------------------------------------------------------------------------------- /templates/default/varnish.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - varnishstat: <%= i["varnishstat"] || "/usr/bin/varnishstat" %> 6 | <% if i.key?("name") -%> 7 | name: <%= i["name"] %> 8 | <% end -%> 9 | <% if i.key?("tags") -%> 10 | tags: 11 | <% i["tags"].each do |t| -%> 12 | - <%= t %> 13 | <% end -%> 14 | <% end -%> 15 | <% if i.key?("varnishadm") -%> 16 | varnishadm: <%= i["varnishadm"] %> 17 | <% end -%> 18 | <% if i.key?("secretfile") -%> 19 | secretfile: <%= i["secretfile"] %> 20 | <% end -%> 21 | <% end -%> 22 | 23 | init_config: 24 | # Nothing to configure here 25 | -------------------------------------------------------------------------------- /templates/default/vault.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | instances: 4 | <% @instances.each do |i| -%> 5 | - api_url: <%= i['api_url'] %> 6 | <% unless i['detect_leader'].nil? %> 7 | detect_leader: <%= i['detect_leader'] %> 8 | <% end %> 9 | <% unless i['skip_proxy'].nil? %> 10 | skip_proxy: <%= i['skip_proxy'] %> 11 | <% end %> 12 | <% unless i['ssl_verify'].nil? %> 13 | ssl_verify: <%= i['ssl_verify'] %> 14 | <% end %> 15 | <% unless i['ssl_ca_cert'].nil? %> 16 | ssl_ca_cert: <%= i['ssl_ca_cert'] %> 17 | <% end %> 18 | <% unless i['timeout'].nil? %> 19 | timeout: <%= i['timeout'] %> 20 | <% end %> 21 | <% if i.key?('tags') && !i['tags'].empty? -%> 22 | tags: 23 | <% i['tags'].each do |t| -%> 24 | - <%= t %> 25 | <% end -%> 26 | <% end -%> 27 | <% end -%> 28 | 29 | # Nothing to configure here 30 | init_config: 31 | -------------------------------------------------------------------------------- /templates/default/win32_event_log.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({'init_config' => @init_config, 'instances' => @instances, 'logs' => @logs}).to_json).to_yaml %> 4 | -------------------------------------------------------------------------------- /templates/default/windows_service.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | 5 | # Nothing to configure here 6 | init_config: 7 | -------------------------------------------------------------------------------- /templates/default/wmi_check.yaml.erb: -------------------------------------------------------------------------------- 1 | # Generated by Chef, local modifications will be overwritten 2 | 3 | <%= JSON.parse(({ 'instances' => @instances, 'logs' => @logs }).to_json).to_yaml %> 4 | 5 | # Nothing to configure here 6 | init_config: 7 | -------------------------------------------------------------------------------- /templates/default/zk.yaml.erb: -------------------------------------------------------------------------------- 1 | <%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> 2 | 3 | <% excluded_keys = ["host", "port", "timeout", "tags"] -%> 4 | instances: 5 | <% @instances.each do |instance| -%> 6 | - host: <%= instance["host"] %> 7 | port: <%= instance["port"] %> 8 | <% if instance.key?("timeout") -%> 9 | timeout: <%= instance["timeout"] %> 10 | <% end -%> 11 | <% if instance.key?("tags") -%> 12 | tags: 13 | <% instance["tags"].each do |tag| -%> 14 | - <%= tag %> 15 | <% end -%> 16 | <% end -%> 17 | <% (instance.keys - excluded_keys).each do |key| -%> 18 | <%= key %>: <%= instance[key] %> 19 | <% end -%> 20 | <% end %> 21 | 22 | init_config: 23 | -------------------------------------------------------------------------------- /test/cookbooks/test/metadata.rb: -------------------------------------------------------------------------------- 1 | name 'test' 2 | maintainer 'Datadog' 3 | maintainer_email 'package@datadoghq.com' 4 | license 'Apache-2.0' 5 | version '0.0.1' 6 | description 'Tests cookbooks' 7 | depends 'datadog' 8 | -------------------------------------------------------------------------------- /test/cookbooks/test/recipes/dd_integration_resource.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | datadog_integration 'datadog-aerospike' do 16 | action :remove 17 | notifies :restart, 'service[datadog-agent]' 18 | end 19 | # This time Chef should mention "up to date" 20 | datadog_integration 'datadog-aerospike' do 21 | action :remove 22 | end 23 | datadog_integration 'datadog-aerospike' do 24 | action :install 25 | version '1.2.0' 26 | end 27 | # This time Chef should mention "up to date" 28 | datadog_integration 'datadog-aerospike' do 29 | action :install 30 | version '1.2.0' 31 | end 32 | 33 | datadog_integration 'datadog-elastic' do 34 | action :remove 35 | notifies :restart, 'service[datadog-agent]' 36 | end 37 | # This time Chef should mention "up to date" 38 | datadog_integration 'datadog-elastic' do 39 | action :remove 40 | end 41 | datadog_integration 'datadog-elastic' do 42 | action :install 43 | version '1.11.0' 44 | end 45 | # This time Chef should mention "up to date" 46 | datadog_integration 'datadog-elastic' do 47 | action :install 48 | version '1.11.0' 49 | end 50 | -------------------------------------------------------------------------------- /test/cookbooks/test/recipes/monitor_add.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | datadog_monitor 'potato' do 16 | action :add 17 | end 18 | 19 | datadog_monitor 'potato' do 20 | action :add 21 | config_name 'potato-one' 22 | end -------------------------------------------------------------------------------- /test/cookbooks/test/recipes/monitor_remove.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | datadog_monitor 'potato' do 16 | action :remove 17 | end 18 | 19 | datadog_monitor 'potato' do 20 | action :remove 21 | config_name 'potato-one' 22 | end -------------------------------------------------------------------------------- /test/integration/datadog_apache/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_apache/serverspec_datadog/apache_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/apache.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'apache_status_url' => 'http://mysite.com/server-status?auto', 35 | 'apache_user' => 'someusername', 36 | 'apache_password' => 'sekret', 37 | 'tags' => ['kitchen', 'sink'] 38 | } 39 | ], 40 | 'logs' => nil, 41 | 'init_config' => nil 42 | } 43 | 44 | expect(generated.to_json).to be_json_eql expected.to_json 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /test/integration/datadog_cacti/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_cacti/serverspec_datadog/cacti_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/cacti.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | field_names: ['ifIndex', 'dskDevice', 'ifName'], 35 | mysql_host: 'localhost', 36 | mysql_password: 'mysql_read_only_password', 37 | mysql_user: 'mysql_read_only', 38 | rrd_path: '/path/to/cacti/rra', 39 | rrd_whitelist: '/path/to/rrd_whitelist.txt' 40 | } 41 | ], 42 | 'logs' => nil, 43 | 'init_config' => nil 44 | } 45 | 46 | expect(generated.to_json).to be_json_eql expected.to_json 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /test/integration/datadog_cassandra/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_cassandra_greater_22/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_consul/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_consul/serverspec_datadog/consul_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | require 'json_spec' 19 | require 'serverspec' 20 | require 'yaml' 21 | 22 | set :backend, :exec 23 | set :path, '/sbin:/usr/local/sbin:$PATH' 24 | 25 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/consul.d/conf.yaml') 26 | 27 | describe service(@agent_service_name) do 28 | it { should be_running } 29 | end 30 | 31 | describe file(AGENT_CONFIG) do 32 | it { should be_a_file } 33 | 34 | it 'is valid yaml matching input values' do 35 | generated = YAML.load_file(AGENT_CONFIG) 36 | 37 | expected = { 38 | 'instances' => [ 39 | { 40 | 'url' => 'http://localhost:8500', 41 | 'new_leader_checks' => false, 42 | 'catalog_checks' => false, 43 | 'service_whitelist' => 'consul', 44 | 'tags' => ['_default'] 45 | } 46 | ], 47 | 'logs' => nil, 48 | 'init_config' => nil 49 | } 50 | 51 | expect(generated.to_json).to be_json_eql expected.to_json 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /test/integration/datadog_couchdb/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_couchdb/serverspec_datadog/couchdb_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/couch.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | password: 'somepass', 35 | server: 'http://localhost:5984', 36 | user: 'someuser' 37 | } 38 | ], 39 | 'logs' => nil, 40 | 'init_config' => nil 41 | } 42 | 43 | expect(generated.to_json).to be_json_eql expected.to_json 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /test/integration/datadog_docker/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_elasticsearch/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_elasticsearch/serverspec_datadog/elasticsearch_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/elastic.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'url' => 'http://localhost:9200', 35 | 'username' => 'someuser', 36 | 'password' => 'somepass', 37 | 'is_external' => false, 38 | 'pshard_stats' => true, 39 | 'index_stats' => true, 40 | 'shard_level_metrics' => true, 41 | 'tags' => ['kitchen', 'sink'] 42 | } 43 | ], 44 | 'logs' => nil, 45 | 'init_config' => nil 46 | } 47 | 48 | expect(generated.to_json).to be_json_eql expected.to_json 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /test/integration/datadog_etcd/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_etcd/serverspec_datadog/etcd_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | require 'json_spec' 19 | require 'serverspec' 20 | require 'yaml' 21 | 22 | set :backend, :exec 23 | set :path, '/sbin:/usr/local/sbin:$PATH' 24 | 25 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/etcd.d/conf.yaml') 26 | 27 | describe service(@agent_service_name) do 28 | it { should be_running } 29 | end 30 | 31 | describe file(AGENT_CONFIG) do 32 | it { should be_a_file } 33 | 34 | it 'is valid yaml matching input values' do 35 | generated = YAML.load_file(AGENT_CONFIG) 36 | 37 | expected = { 38 | 'instances' => [ 39 | { 40 | 'url' => 'http://localhost:2379', 41 | 'timeout' => 5, 42 | 'ssl_keyfile' => '/etc/etcd/ssl.key', 43 | 'ssl_certfile' => '/etc/etcd/ssl.crt', 44 | 'ssl_cert_validation' => true, 45 | 'ssl_ca_certs' => '/etc/etcd/ca-certs.crt' 46 | } 47 | ], 48 | 'logs' => nil, 49 | 'init_config' => nil 50 | } 51 | 52 | expect(generated.to_json).to be_json_eql expected.to_json 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /test/integration/datadog_fluentd/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_fluentd/serverspec_datadog/fluentd_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/fluentd.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'monitor_agent_url' => 'http://localhost.com:24220/api/plugins.json', 35 | 'plugin_ids' => ['api', 'plugin'], 36 | 'tags' => ['kitchen', 'sink'] 37 | } 38 | ], 39 | 'logs' => nil, 40 | 'init_config' => nil 41 | } 42 | 43 | expect(generated.to_json).to be_json_eql expected.to_json 44 | end 45 | end 46 | -------------------------------------------------------------------------------- /test/integration/datadog_haproxy/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_haproxy/serverspec_datadog/haproxy_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/haproxy.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'collect_aggregates_only' => true, 35 | 'collect_status_metrics' => true, 36 | 'password' => 'sekret', 37 | 'status_check' => false, 38 | 'url' => 'http://localhost:22002/status', 39 | 'username' => 'admin' 40 | } 41 | ], 42 | 'logs' => nil, 43 | 'init_config' => nil 44 | } 45 | 46 | expect(generated.to_json).to be_json_eql expected.to_json 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /test/integration/datadog_http_check/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_http_check/serverspec_datadog/http_check_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/http_check.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'name' => 'test', 35 | 'url' => 'http://localhost/' 36 | }, 37 | { 38 | 'name' => 'test2', 39 | 'url' => 'http://localhost/' 40 | } 41 | ], 42 | 'logs' => nil, 43 | 'init_config' => nil 44 | } 45 | 46 | expect(generated.to_json).to be_json_eql expected.to_json 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /test/integration/datadog_integrations/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_integrations/serverspec_datadog/integrations_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/twemproxy.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | instances: [ 33 | { 34 | url: 'http://localhost:22222' 35 | } 36 | ], 37 | 'logs' => nil, 38 | init_config: {} 39 | } 40 | 41 | expect(generated.to_json).to be_json_eql expected.to_json 42 | end 43 | 44 | describe package('dd-check-twemproxy') do 45 | it { should be_installed.with_version('0.1.0-1') } 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /test/integration/datadog_jmx/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_kafka/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_kafka_consumer/serverspec_datadog/kafka_consumer_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | require 'spec_helper' 17 | 18 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/kafka_consumer.d/conf.yaml') 19 | 20 | describe service(@agent_service_name) do 21 | it { should be_running } 22 | end 23 | 24 | describe file(AGENT_CONFIG) do 25 | it { should be_a_file } 26 | 27 | it 'is valid yaml matching input values' do 28 | generated = YAML.load_file(AGENT_CONFIG) 29 | 30 | expected = { 31 | 'instances' => [ 32 | { 33 | :kafka_connect_str => 'localhost:19092', 34 | :consumer_groups => { 35 | :my_consumer => { 36 | :my_topic => [0, 1, 4, 12] 37 | } 38 | }, 39 | :monitor_unlisted_consumer_groups => false, 40 | :zk_connect_str => 'localhost:2181', 41 | :zk_prefix => '/0.8', 42 | :kafka_consumer_offsets => true 43 | } 44 | ], 45 | 'logs' => nil, 46 | 'init_config' => nil 47 | } 48 | 49 | expect(generated.to_json).to be_json_eql expected.to_json 50 | end 51 | end 52 | -------------------------------------------------------------------------------- /test/integration/datadog_mesos_master/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_mesos_master/serverspec_datadog/mesos_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/mesos_master.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | instances: [ 33 | { 34 | url: 'localhost:5050', 35 | timeout: 8, 36 | tags: ['master', 'tata'] 37 | } 38 | ], 39 | 'logs' => nil, 40 | init_config: { 41 | default_timeout: 10 42 | } 43 | } 44 | 45 | expect(generated.to_json).to be_json_eql expected.to_json 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /test/integration/datadog_mesos_slave/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_mesos_slave/serverspec_datadog/mesos_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/mesos_slave.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | instances: [ 33 | { 34 | url: 'localhost:5050', 35 | timeout: 8, 36 | tags: ['slave', 'tata'] 37 | } 38 | ], 39 | 'logs' => nil, 40 | init_config: { 41 | default_timeout: 10 42 | } 43 | } 44 | 45 | expect(generated.to_json).to be_json_eql expected.to_json 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /test/integration/datadog_mongo/serverspec_datadog/mongo_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/mongo.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'hosts' => 'localhost:27017', 35 | 'username' => 'someuser', 36 | 'password' => 'somepassword', 37 | 'timeout' => 30 38 | } 39 | ], 40 | 'logs' => nil, 41 | 'init_config' => nil 42 | } 43 | 44 | expect(generated.to_json).to be_json_eql expected.to_json 45 | end 46 | end 47 | -------------------------------------------------------------------------------- /test/integration/datadog_mysql/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_ntp/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_ntp/serverspec_datadog/ntp_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/ntp.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'offset_threshold' => 600, 35 | 'host' => 'europe.pool.ntp.org', 36 | 'port' => 9999, 37 | 'version' => 4, 38 | 'timeout' => 10 39 | } 40 | ], 41 | 'logs' => nil, 42 | 'init_config' => nil 43 | } 44 | 45 | expect(generated.to_json).to be_json_eql expected.to_json 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /test/integration/datadog_pgbouncer/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_pgbouncer/serverspec_datadog/pgbouncer_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | require 'json_spec' 19 | require 'serverspec' 20 | require 'yaml' 21 | 22 | set :backend, :exec 23 | set :path, '/sbin:/usr/local/sbin:$PATH' 24 | 25 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/pgbouncer.d/conf.yaml') 26 | 27 | describe service(@agent_service_name) do 28 | it { should be_running } 29 | end 30 | 31 | describe file(AGENT_CONFIG) do 32 | it { should be_a_file } 33 | 34 | it 'is valid yaml matching input values' do 35 | generated = YAML.load_file(AGENT_CONFIG) 36 | 37 | expected = { 38 | instances: [ 39 | { 40 | host: 'localhost', 41 | port: 6432, 42 | username: 'john', 43 | password: 'doe', 44 | tags: ['toto', 'tata'] 45 | } 46 | ], 47 | 'logs' => nil, 48 | init_config: nil 49 | } 50 | 51 | expect(generated.to_json).to be_json_eql expected.to_json 52 | end 53 | end 54 | -------------------------------------------------------------------------------- /test/integration/datadog_postfix/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_postfix/serverspec_datadog/postfix_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | require 'json_spec' 19 | require 'serverspec' 20 | require 'yaml' 21 | 22 | set :backend, :exec 23 | set :path, '/sbin:/usr/local/sbin:$PATH' 24 | 25 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/postfix.d/conf.yaml') 26 | 27 | describe service(@agent_service_name) do 28 | it { should be_running } 29 | end 30 | 31 | describe file(AGENT_CONFIG) do 32 | it { should be_a_file } 33 | 34 | it 'is valid yaml matching input values' do 35 | generated = YAML.load_file(AGENT_CONFIG) 36 | 37 | expected = { 38 | 'instances' => [ 39 | { 40 | 'directory' => '/var/spool/postfix', 41 | 'queues' => ['incoming', 'active', 'deferred'], 42 | 'tags' => ['prod', 'postfix_core'] 43 | }, 44 | { 45 | 'directory' => '/var/spool/postfix', 46 | 'queues' => ['bounce'], 47 | 'tags' => ['test'] 48 | } 49 | ], 50 | 'logs' => nil, 51 | 'init_config' => nil 52 | } 53 | 54 | expect(generated.to_json).to be_json_eql expected.to_json 55 | end 56 | end 57 | -------------------------------------------------------------------------------- /test/integration/datadog_process/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_process/serverspec_datadog/dd-agent-process_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | PROCESS_CONFIG = File.join(@agent_config_dir, 'conf.d/process.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(PROCESS_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(PROCESS_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'name' => 'pidname', 35 | 'exact_match' => false, 36 | 'ignore_denied_access' => true, 37 | 'tags' => ['env:test', 'appname:somename'], 38 | 'search_string' => ['somepid', 'pidname'] 39 | } 40 | ], 41 | 'logs' => nil, 42 | 'init_config' => nil 43 | } 44 | 45 | expect(generated.to_json).to be_json_eql expected.to_json 46 | end 47 | end 48 | -------------------------------------------------------------------------------- /test/integration/datadog_ssh_check/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_supervisord/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_supervisord/serverspec_datadog/supervisord_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | require 'json_spec' 19 | require 'serverspec' 20 | require 'yaml' 21 | 22 | set :backend, :exec 23 | set :path, '/sbin:/usr/local/sbin:$PATH' 24 | 25 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/supervisord.d/conf.yaml') 26 | 27 | describe service(@agent_service_name) do 28 | it { should be_running } 29 | end 30 | 31 | describe file(AGENT_CONFIG) do 32 | it { should be_a_file } 33 | 34 | it 'is valid yaml matching input values' do 35 | generated = YAML.load_file(AGENT_CONFIG) 36 | 37 | expected = { 38 | instances: [ 39 | { 40 | name: 'server0', 41 | socket: 'unix:///var/run/default-supervisor.sock' 42 | }, 43 | { 44 | name: 'server1', 45 | host: 'localhost', 46 | port: 9001, 47 | user: 'user', 48 | pass: 'pass', 49 | proc_names: [ 50 | 'apache2', 51 | 'webapp' 52 | ] 53 | } 54 | ], 55 | 'logs' => nil, 56 | init_config: nil 57 | } 58 | 59 | expect(generated.to_json).to be_json_eql expected.to_json 60 | end 61 | end 62 | -------------------------------------------------------------------------------- /test/integration/datadog_systemd/serverspec_datadog/systemd_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/systemd.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'unit_names' => [ 35 | 'myservice1.service', 36 | 'myservice2.service', 37 | 'mysocket.socket', 38 | 'mytimer.timer' 39 | ] 40 | } 41 | ], 42 | 'logs' => nil, 43 | 'init_config' => nil 44 | } 45 | 46 | expect(generated.to_json).to be_json_eql expected.to_json 47 | end 48 | end 49 | -------------------------------------------------------------------------------- /test/integration/datadog_tcp_check/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_tcp_check/serverspec_datadog/tcp_check_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/tcp_check.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | 'instances' => [ 33 | { 34 | 'name' => 'test', 35 | 'host' => 'localhost', 36 | 'port' => 1234 37 | }, 38 | { 39 | 'name' => 'test2', 40 | 'host' => 'localhost', 41 | 'port' => 5678 42 | } 43 | ], 44 | 'logs' => nil, 45 | 'init_config' => nil 46 | } 47 | 48 | expect(generated.to_json).to be_json_eql expected.to_json 49 | end 50 | end 51 | -------------------------------------------------------------------------------- /test/integration/datadog_vault/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec/Gemfile -------------------------------------------------------------------------------- /test/integration/datadog_vault/serverspec_datadog/vault_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | require 'json_spec' 19 | require 'serverspec' 20 | require 'yaml' 21 | 22 | set :backend, :exec 23 | set :path, '/sbin:/usr/local/sbin:$PATH' 24 | 25 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/vault.d/conf.yaml') 26 | 27 | describe service(@agent_service_name) do 28 | it { should be_running } 29 | end 30 | 31 | describe file(AGENT_CONFIG) do 32 | it { should be_a_file } 33 | 34 | it 'is valid yaml matching input values' do 35 | generated = YAML.load_file(AGENT_CONFIG) 36 | 37 | expected = { 38 | 'instances' => [ 39 | { 40 | 'api_url' => 'http://localhost:8200/v1', 41 | 'detect_leader' => false, 42 | 'skip_proxy' => false, 43 | 'ssl_verify' => true, 44 | 'tags' => ['_default'], 45 | 'timeout' => 20 46 | } 47 | ], 48 | 'logs' => nil, 49 | 'init_config' => nil 50 | } 51 | 52 | expect(generated.to_json).to be_json_eql expected.to_json 53 | end 54 | end 55 | -------------------------------------------------------------------------------- /test/integration/dd-agent-gpgcheck-older/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') 4 | 5 | if RUBY_VERSION < '2.6' 6 | gem 'net-ssh', '~> 6.1.0' 7 | gem 'public_suffix', '~> 4.0.0' 8 | end 9 | 10 | if RUBY_VERSION < '3.0.0' 11 | gem 'rspec-its', '= 1.3.1' 12 | end 13 | 14 | gem 'json_spec', '~> 1.1.0' 15 | 16 | if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' 17 | gem 'train-core', '~> 3.9.0' 18 | end 19 | -------------------------------------------------------------------------------- /test/integration/dd-agent-gpgcheck-older/serverspec_datadog/dd-handler_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'spec_helper' 16 | 17 | # the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec 18 | describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do 19 | it { should be_installed.by('gem') } 20 | end 21 | -------------------------------------------------------------------------------- /test/integration/dd-agent-gpgcheck-recent/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') 4 | 5 | if RUBY_VERSION < '2.6' 6 | gem 'net-ssh', '~> 6.1.0' 7 | gem 'public_suffix', '~> 4.0.0' 8 | end 9 | 10 | if RUBY_VERSION < '3.0.0' 11 | gem 'rspec-its', '= 1.3.1' 12 | end 13 | 14 | gem 'json_spec', '~> 1.1.0' 15 | 16 | if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' 17 | gem 'train-core', '~> 3.9.0' 18 | end 19 | -------------------------------------------------------------------------------- /test/integration/dd-agent-gpgcheck-recent/serverspec_datadog/dd-handler_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'spec_helper' 16 | 17 | # the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec 18 | describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do 19 | it { should be_installed.by('gem') } 20 | end 21 | -------------------------------------------------------------------------------- /test/integration/dd-agent-handler/serverspec_datadog/dd-agent_spec.rb: -------------------------------------------------------------------------------- 1 | ../../dd-agent/serverspec_datadog/dd-agent_spec.rb -------------------------------------------------------------------------------- /test/integration/dd-agent-handler/serverspec_datadog/dd-handler_spec.rb: -------------------------------------------------------------------------------- 1 | ../../dd-agent/serverspec_datadog/dd-handler_spec.rb -------------------------------------------------------------------------------- /test/integration/dd-agent-handler5/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') 4 | 5 | if RUBY_VERSION < '2.6' 6 | gem 'net-ssh', '~> 6.1.0' 7 | gem 'public_suffix', '~> 4.0.0' 8 | end 9 | 10 | if RUBY_VERSION < '3.0.0' 11 | gem 'rspec-its', '= 1.3.1' 12 | end 13 | 14 | gem 'json_spec', '~> 1.1.0' 15 | 16 | if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' 17 | gem 'train-core', '~> 3.9.0' 18 | end 19 | -------------------------------------------------------------------------------- /test/integration/dd-agent-handler5/serverspec_datadog/dd-handler_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'spec_helper' 16 | 17 | # the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec 18 | describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do 19 | it { should be_installed.by('gem') } 20 | end 21 | -------------------------------------------------------------------------------- /test/integration/dd-agent-handler6/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') 4 | 5 | if RUBY_VERSION < '2.6' 6 | gem 'net-ssh', '~> 6.1.0' 7 | gem 'public_suffix', '~> 4.0.0' 8 | end 9 | 10 | if RUBY_VERSION < '3.0.0' 11 | gem 'rspec-its', '= 1.3.1' 12 | end 13 | 14 | gem 'json_spec', '~> 1.1.0' 15 | 16 | if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' 17 | gem 'train-core', '~> 3.9.0' 18 | end 19 | -------------------------------------------------------------------------------- /test/integration/dd-agent-handler6/serverspec_datadog/dd-handler_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'spec_helper' 16 | 17 | # the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec 18 | describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do 19 | it { should be_installed.by('gem') } 20 | end 21 | -------------------------------------------------------------------------------- /test/integration/dd-agent-handler7/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') 4 | 5 | if RUBY_VERSION < '2.6' 6 | gem 'net-ssh', '~> 6.1.0' 7 | gem 'public_suffix', '~> 4.0.0' 8 | end 9 | 10 | if RUBY_VERSION < '3.0.0' 11 | gem 'rspec-its', '= 1.3.1' 12 | end 13 | 14 | gem 'json_spec', '~> 1.1.0' 15 | 16 | if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' 17 | gem 'train-core', '~> 3.9.0' 18 | end 19 | -------------------------------------------------------------------------------- /test/integration/dd-agent-handler7/serverspec_datadog/dd-handler_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'spec_helper' 16 | 17 | # the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec 18 | describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do 19 | it { should be_installed.by('gem') } 20 | end 21 | -------------------------------------------------------------------------------- /test/integration/dd-agent-iot/serverspec_datadog/install_info_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'spec_helper' 16 | 17 | @agent_package_name = 'datadog-iot-agent' 18 | 19 | describe 'Install infos' do 20 | let(:install_info_path) do 21 | if os == :windows 22 | "#{ENV['ProgramData']}\\Datadog\\install_info" 23 | else 24 | '/etc/datadog-agent/install_info' 25 | end 26 | end 27 | 28 | let(:install_info) do 29 | YAML.load_file(install_info_path) 30 | end 31 | 32 | it 'adds an install_info' do 33 | expect(install_info['install_method']).to match( 34 | 'tool_version' => /chef-\d+\.\d+\.\d+/, 35 | 'tool' => 'chef', 36 | 'installer_version' => /^datadog_cookbook-\d+\.\d+\.\d+$/ 37 | ) 38 | end 39 | end 40 | -------------------------------------------------------------------------------- /test/integration/dd-agent/serverspec_datadog/install_info_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'spec_helper' 16 | 17 | describe 'Install infos' do 18 | let(:install_info_path) do 19 | if os == :windows 20 | "#{ENV['ProgramData']}\\Datadog\\install_info" 21 | else 22 | '/etc/datadog-agent/install_info' 23 | end 24 | end 25 | 26 | let(:install_info) do 27 | YAML.load_file(install_info_path) 28 | end 29 | 30 | it 'adds an install_info' do 31 | expect(install_info['install_method']).to match( 32 | 'tool_version' => /chef-\d+\.\d+\.\d+/, 33 | 'tool' => 'chef', 34 | 'installer_version' => /^datadog_cookbook-\d+\.\d+\.\d+$/ 35 | ) 36 | end 37 | end 38 | -------------------------------------------------------------------------------- /test/integration/dd-handler/serverspec_datadog/dd-handler_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | require 'spec_helper' 16 | 17 | # the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec 18 | describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do 19 | it { should be_installed.by('gem') } 20 | end 21 | -------------------------------------------------------------------------------- /test/integration/dd_integration_resource/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | ../../helpers/serverspec_datadog/Gemfile -------------------------------------------------------------------------------- /test/integration/dd_integration_resource/serverspec_datadog/resource_integration_spec.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'serverspec' 18 | 19 | set :backend, :exec 20 | set :path, '/sbin:/usr/local/sbin:$PATH' 21 | 22 | describe service('datadog-agent') do 23 | it { should be_running } 24 | end 25 | 26 | # Checks that it's installed properly and with the good version 27 | describe command('/opt/datadog-agent/bin/agent/agent integration show datadog-aerospike') do 28 | its(:stdout) { should match /Package datadog-aerospike:\nInstalled version:/ } 29 | end 30 | -------------------------------------------------------------------------------- /test/integration/default/bats/sanity.bats: -------------------------------------------------------------------------------- 1 | # This is a basic sanity test, to ensure that the plugins work as designed. 2 | 3 | @test "gives me a /tmp directory" { 4 | [ -d /tmp ] 5 | } 6 | -------------------------------------------------------------------------------- /test/integration/helpers/serverspec_datadog/Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'json_spec', '~> 1.1.0' 4 | -------------------------------------------------------------------------------- /test/integration/helpers/serverspec_datadog/spec_helper.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Shared helper for all serverspec tests 16 | require 'json_spec' 17 | require 'serverspec' 18 | require 'yaml' 19 | 20 | # manually determine if the platform is Windows or not 21 | # Serverspec as of v2.24 cannot detect the OS family of Windows target hosts 22 | # For reference see https://github.com/serverspec/serverspec/blob/master/WINDOWS_SUPPORT.md 23 | if ENV['OS'] == 'Windows_NT' 24 | set :backend, :cmd 25 | # On Windows, set the target host's OS explicitly 26 | set :os, :family => 'windows' 27 | @agent_package_name = 'Datadog Agent' 28 | @agent_service_name = 'DatadogAgent' 29 | @agent_config_dir = "#{ENV['ProgramData']}/Datadog" 30 | else 31 | set :backend, :exec 32 | @agent_package_name = 'datadog-agent' 33 | @agent_service_name = 'datadog-agent' 34 | @agent_config_dir = '/etc/datadog-agent' 35 | end 36 | 37 | set :path, '/sbin:/usr/local/sbin:$PATH' unless os[:family] == 'windows' 38 | -------------------------------------------------------------------------------- /test/integration/helpers/serverspec_datadog/spec_template.rb: -------------------------------------------------------------------------------- 1 | # Copyright:: 2011-Present, Datadog 2 | # 3 | # Licensed under the Apache License, Version 2.0 (the "License"); 4 | # you may not use this file except in compliance with the License. 5 | # You may obtain a copy of the License at 6 | # 7 | # http://www.apache.org/licenses/LICENSE-2.0 8 | # 9 | # Unless required by applicable law or agreed to in writing, software 10 | # distributed under the License is distributed on an "AS IS" BASIS, 11 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12 | # See the License for the specific language governing permissions and 13 | # limitations under the License. 14 | 15 | # Encoding: utf-8 16 | 17 | require 'spec_helper' 18 | 19 | AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/REPLACEME.d/conf.yaml') 20 | 21 | describe service(@agent_service_name) do 22 | it { should be_running } 23 | end 24 | 25 | describe file(AGENT_CONFIG) do 26 | it { should be_a_file } 27 | 28 | it 'is valid yaml matching input values' do 29 | generated = YAML.load_file(AGENT_CONFIG) 30 | 31 | expected = { 32 | instances: [ 33 | { 34 | config_param: 'value', 35 | tags: ['kitchen', 'sink'] 36 | } 37 | ], 38 | init_config: nil 39 | } 40 | 41 | expect(generated.to_json).to be_json_eql expected.to_json 42 | end 43 | end 44 | --------------------------------------------------------------------------------