diff --git a/cookbooks/datadog/CHANGELOG.md b/cookbooks/datadog/CHANGELOG.md index 00dd9833..5c394270 100644 --- a/cookbooks/datadog/CHANGELOG.md +++ b/cookbooks/datadog/CHANGELOG.md @@ -1,10 +1,52 @@ Changes ======= -# Unreleased - -* [FEATURE] Enabled unified mode on compatible platforms since it will be the default on Chef 18. See [CHEF-33](https://docs.chef.io/deprecations_unified_mode/) deprecation. -* [FEATURE] Added support for Chef 18+. +# 4.18.0 / 2023-07-25 + * [BUGFIX] Syntax update to support old chef-infra versions [#898] [@chouetz] + * [FEATURE] Update recipes to support amazonlinux 2023 installation [#896] [@chouetz] + * [FEATURE] Add agent configuration value to config template [#888] [@nichols2k] + * [FEATURE] Actually enforce `apt` and `yum` versions in the `metadata.rb` file [#874] [@amenasria] + * [FEATURE] support weblogic integration [#891] [@vigohe] + * [FEATURE] Add new APT and RPM signing keys [#890] [@chouetz] + * [BUGFIX] Fix dead link in http_check.rb recipe [#887] [@amenasria] + +# 4.17.0 / 2023-02-20 +* [FEATURE] Added the option to enable Universal Service Monitoring (USM) [#876][] [@guyarb][] +* [BUGFIX] Fix crash for jmx integrations with `init_config` attributes set [#869][] [@KSerrania][] + +# 4.16.0 / 2023-01-12 + +* [DEPRECATION] Remove old RPM GPG key. This also removes the `yumrepo_gpgkey` parameter [#877][] [@amenasria][] +* [FEATURE] Add min_collection_interval option to ssh_check config [#867][] [@nilskuehme][] +* [BUGFIX] Remove source file and datadog-signing-keys package when removing the Agent [#865][] [@amenasria][] + +# 4.15.0 / 2022-10-06 +* [BUGFIX] Enforce calls of agent version without color output [#863][] [@KSerrania][] +* [FEATURE] Add configuration for custom_log_collection [#861][] [@nilskuehme][] +* [FEATURE] Add configuration for gearmand integration [#860][] [@nilskuehme][] +* [FEATURE] Add unit types to Systemd integration [#859][] [@nilskuehme][] +* [BUGFIX] Specify release but not epoch for RPM packages on Chef < 14 [#858][] [@KSerrania][] +* [BUGFIX] Don't use epoch/release for yum package version on Chef < 14 [#856][] [@bkabrda][] +* [FEATURE] Use agent version instead of agent status to determine the current Agent version [#852][] [@amenasria][] + +# 4.14.0 / 2022-06-14 +* [BUGFIX] Fix system probe recipe on Windows [#850][] [@julien-lebot][] + +# 4.13.0 / 2022-03-30 + +* [FEATURE] Allow enabling CWS and CSPM [#843][] [@lebauce][] +* [FEATURE] Add support for AlmaLinux and Rocky Linux [#836][] [@bkabrda][] +* [FEATURE] Add `monitor_unlisted_consumer_groups` and `kafka_consumer_offsets` to kafka_consumer [#834][] [@ganeshkumarsv][] +* [BUGFIX] Specify package epoch on RH-like platforms to ensure proper upgrade path [#839][] [@bkabrda][] +* [BUGFIX] Use the correct socket for system probe on Windows [#833][] [@julien-lebot][] +* [BUGFIX] Add is_jmx by default to jmxfetch checks [#792][] [@albertvaka][] + +# 4.12.0 / 2021-12-03 + +* [FEATURE] Added support for Chef 18+. [@axl89][] [#822][] +* [FEATURE] Enabled unified mode on compatible platforms since it will be the default on Chef 18. See [CHEF-33](https://docs.chef.io/deprecations_unified_mode/) deprecation. [@axl89][] [#822][] +* [FEATURE] Include `dogstatsd_port` in `datadog.yaml` for Agent 6 and Agent 7 [@brentm5][] [#828][] +* [BUGFIX] Ignore `apt update` failures to keep running if some sources are offline [#830][] [@bkabrda][] # 4.11.1 / 2021-08-24 @@ -994,6 +1036,7 @@ A fix has gone in to `apt` 2.1.0 that relaxes this condition, and plays well wit [#786]: https://github.com/DataDog/chef-datadog/issues/786 [#789]: https://github.com/DataDog/chef-datadog/issues/789 [#791]: https://github.com/DataDog/chef-datadog/issues/791 +[#792]: https://github.com/DataDog/chef-datadog/issues/792 [#793]: https://github.com/DataDog/chef-datadog/issues/793 [#796]: https://github.com/DataDog/chef-datadog/issues/796 [#799]: https://github.com/DataDog/chef-datadog/issues/799 @@ -1002,6 +1045,35 @@ A fix has gone in to `apt` 2.1.0 that relaxes this condition, and plays well wit [#806]: https://github.com/DataDog/chef-datadog/issues/806 [#810]: https://github.com/DataDog/chef-datadog/issues/810 [#813]: https://github.com/DataDog/chef-datadog/issues/813 +[#822]: https://github.com/DataDog/chef-datadog/issues/822 +[#828]: https://github.com/DataDog/chef-datadog/issues/828 +[#830]: https://github.com/DataDog/chef-datadog/issues/830 +[#833]: https://github.com/DataDog/chef-datadog/issues/833 +[#834]: https://github.com/DataDog/chef-datadog/issues/834 +[#836]: https://github.com/DataDog/chef-datadog/issues/836 +[#839]: https://github.com/DataDog/chef-datadog/issues/839 +[#843]: https://github.com/DataDog/chef-datadog/issues/843 +[#850]: https://github.com/DataDog/chef-datadog/issues/850 +[#852]: https://github.com/DataDog/chef-datadog/issues/852 +[#856]: https://github.com/DataDog/chef-datadog/issues/856 +[#858]: https://github.com/DataDog/chef-datadog/issues/858 +[#859]: https://github.com/DataDog/chef-datadog/issues/859 +[#860]: https://github.com/DataDog/chef-datadog/issues/860 +[#861]: https://github.com/DataDog/chef-datadog/issues/861 +[#863]: https://github.com/DataDog/chef-datadog/issues/863 +[#865]: https://github.com/DataDog/chef-datadog/issues/865 +[#867]: https://github.com/DataDog/chef-datadog/issues/867 +[#869]: https://github.com/DataDog/chef-datadog/issues/869 +[#874]: https://github.com/DataDog/chef-datadog/issues/874 +[#876]: https://github.com/DataDog/chef-datadog/issues/876 +[#877]: https://github.com/DataDog/chef-datadog/issues/877 +[#887]: https://github.com/DataDog/chef-datadog/issues/887 +[#888]: https://github.com/DataDog/chef-datadog/issues/888 +[#890]: https://github.com/DataDog/chef-datadog/issues/890 +[#891]: https://github.com/DataDog/chef-datadog/issues/891 +[#895]: https://github.com/DataDog/chef-datadog/issues/895 +[#896]: https://github.com/DataDog/chef-datadog/issues/896 +[#898]: https://github.com/DataDog/chef-datadog/issues/898 [@ABrehm264]: https://github.com/ABrehm264 [@AlexBevan]: https://github.com/AlexBevan [@Azraeht]: https://github.com/Azraeht @@ -1024,9 +1096,11 @@ A fix has gone in to `apt` 2.1.0 that relaxes this condition, and plays well wit [@albertvaka]: https://github.com/albertvaka [@alexism]: https://github.com/alexism [@alq]: https://github.com/alq +[@amenasria]: https://github.com/amenasria [@antonio-osorio]: https://github.com/antonio-osorio [@arthurnn]: https://github.com/arthurnn [@asherf]: https://github.com/asherf +[@axl89]: https://github.com/axl89 [@aymen-chetoui]: https://github.com/aymen-chetoui [@azuretek]: https://github.com/azuretek [@babbottscott]: https://github.com/babbottscott @@ -1068,12 +1142,14 @@ A fix has gone in to `apt` 2.1.0 that relaxes this condition, and plays well wit [@flah00]: https://github.com/flah00 [@foobarto]: https://github.com/foobarto [@frezbo]: https://github.com/frezbo +[@ganeshkumarsv]: https://github.com/ganeshkumarsv [@gkze]: https://github.com/gkze [@gmmeyer]: https://github.com/gmmeyer [@graemej]: https://github.com/graemej [@gregf]: https://github.com/gregf [@grogancolin]: https://github.com/grogancolin [@gswallow]: https://github.com/gswallow +[@guyarb]: https://github.com/guyarb [@haidars]: https://github.com/haidars [@hartfordfive]: https://github.com/hartfordfive [@hilli]: https://github.com/hilli @@ -1106,6 +1182,7 @@ A fix has gone in to `apt` 2.1.0 that relaxes this condition, and plays well wit [@kurochan]: https://github.com/kurochan [@kylegoch]: https://github.com/kylegoch [@lchayoun]: https://github.com/lchayoun +[@lebauce]: https://github.com/lebauce [@lefthand]: https://github.com/lefthand [@martinisoft]: https://github.com/martinisoft [@mattrobenolt]: https://github.com/mattrobenolt @@ -1162,4 +1239,7 @@ A fix has gone in to `apt` 2.1.0 that relaxes this condition, and plays well wit [@wolf31o2]: https://github.com/wolf31o2 [@xt99]: https://github.com/xt99 [@yannmh]: https://github.com/yannmh -[@zshenker]: https://github.com/zshenker \ No newline at end of file +[@zshenker]: https://github.com/zshenker +[@nichols2k]: https://github.com/nichols2k +[@chouetz]: https://github.com/chouetz +[@vigohe]: https://github.com/vigohe diff --git a/cookbooks/datadog/Gemfile b/cookbooks/datadog/Gemfile index 8a666720..27d5b563 100644 --- a/cookbooks/datadog/Gemfile +++ b/cookbooks/datadog/Gemfile @@ -15,6 +15,9 @@ gem 'test-kitchen' gem 'json_spec', '~> 1.1.4' gem 'kitchen-vagrant' gem 'kitchen-docker', '~> 2.3.0' +gem 'rbnacl', '~> 4.0.2' +gem 'rbnacl-libsodium', '~> 1.0.16' +gem 'bcrypt_pbkdf', '>= 1.0', '< 2.0' if RUBY_VERSION < '2.4' gem 'json', '~> 2.4.1' diff --git a/cookbooks/datadog/Gemfile.lock b/cookbooks/datadog/Gemfile.lock index 77bf0cce..12f63c9b 100644 --- a/cookbooks/datadog/Gemfile.lock +++ b/cookbooks/datadog/Gemfile.lock @@ -227,6 +227,10 @@ GEM rack (2.2.3) rainbow (3.0.0) rake (13.0.1) + rbnacl (4.0.2) + ffi + rbnacl-libsodium (1.0.16) + rbnacl (>= 3.0.1) retryable (3.0.5) rexml (3.2.5) rspec (3.9.0) @@ -365,6 +369,7 @@ PLATFORMS DEPENDENCIES activesupport (~> 6.0.3) + bcrypt_pbkdf (>= 1.0, < 2.0) berkshelf chef (= 14.10.9) chefspec @@ -378,10 +383,12 @@ DEPENDENCIES kitchen-docker (~> 2.3.0) kitchen-vagrant rake + rbnacl (~> 4.0.2) + rbnacl-libsodium (~> 1.0.16) rubocop (~> 0.80.1) test-kitchen virtus yaml BUNDLED WITH - 1.17.3 + 2.3.26 diff --git a/cookbooks/datadog/LICENSE b/cookbooks/datadog/LICENSE index a213ba60..f49a4e16 100644 --- a/cookbooks/datadog/LICENSE +++ b/cookbooks/datadog/LICENSE @@ -1,13 +1,201 @@ -Copyright 2012, 2013, 2014, 2015, 2016 Datadog, Inc. + Apache License + Version 2.0, January 2004 + http://www.apache.org/licenses/ -Licensed under the Apache License, Version 2.0 (the "License"); -you may not use this file except in compliance with the License. -You may obtain a copy of the License at + TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION - http://www.apache.org/licenses/LICENSE-2.0 + 1. Definitions. -Unless required by applicable law or agreed to in writing, software -distributed under the License is distributed on an "AS IS" BASIS, -WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -See the License for the specific language governing permissions and -limitations under the License. + "License" shall mean the terms and conditions for use, reproduction, + and distribution as defined by Sections 1 through 9 of this document. + + "Licensor" shall mean the copyright owner or entity authorized by + the copyright owner that is granting the License. + + "Legal Entity" shall mean the union of the acting entity and all + other entities that control, are controlled by, or are under common + control with that entity. For the purposes of this definition, + "control" means (i) the power, direct or indirect, to cause the + direction or management of such entity, whether by contract or + otherwise, or (ii) ownership of fifty percent (50%) or more of the + outstanding shares, or (iii) beneficial ownership of such entity. + + "You" (or "Your") shall mean an individual or Legal Entity + exercising permissions granted by this License. + + "Source" form shall mean the preferred form for making modifications, + including but not limited to software source code, documentation + source, and configuration files. + + "Object" form shall mean any form resulting from mechanical + transformation or translation of a Source form, including but + not limited to compiled object code, generated documentation, + and conversions to other media types. + + "Work" shall mean the work of authorship, whether in Source or + Object form, made available under the License, as indicated by a + copyright notice that is included in or attached to the work + (an example is provided in the Appendix below). + + "Derivative Works" shall mean any work, whether in Source or Object + form, that is based on (or derived from) the Work and for which the + editorial revisions, annotations, elaborations, or other modifications + represent, as a whole, an original work of authorship. For the purposes + of this License, Derivative Works shall not include works that remain + separable from, or merely link (or bind by name) to the interfaces of, + the Work and Derivative Works thereof. + + "Contribution" shall mean any work of authorship, including + the original version of the Work and any modifications or additions + to that Work or Derivative Works thereof, that is intentionally + submitted to Licensor for inclusion in the Work by the copyright owner + or by an individual or Legal Entity authorized to submit on behalf of + the copyright owner. For the purposes of this definition, "submitted" + means any form of electronic, verbal, or written communication sent + to the Licensor or its representatives, including but not limited to + communication on electronic mailing lists, source code control systems, + and issue tracking systems that are managed by, or on behalf of, the + Licensor for the purpose of discussing and improving the Work, but + excluding communication that is conspicuously marked or otherwise + designated in writing by the copyright owner as "Not a Contribution." + + "Contributor" shall mean Licensor and any individual or Legal Entity + on behalf of whom a Contribution has been received by Licensor and + subsequently incorporated within the Work. + + 2. Grant of Copyright License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + copyright license to reproduce, prepare Derivative Works of, + publicly display, publicly perform, sublicense, and distribute the + Work and such Derivative Works in Source or Object form. + + 3. Grant of Patent License. Subject to the terms and conditions of + this License, each Contributor hereby grants to You a perpetual, + worldwide, non-exclusive, no-charge, royalty-free, irrevocable + (except as stated in this section) patent license to make, have made, + use, offer to sell, sell, import, and otherwise transfer the Work, + where such license applies only to those patent claims licensable + by such Contributor that are necessarily infringed by their + Contribution(s) alone or by combination of their Contribution(s) + with the Work to which such Contribution(s) was submitted. If You + institute patent litigation against any entity (including a + cross-claim or counterclaim in a lawsuit) alleging that the Work + or a Contribution incorporated within the Work constitutes direct + or contributory patent infringement, then any patent licenses + granted to You under this License for that Work shall terminate + as of the date such litigation is filed. + + 4. Redistribution. You may reproduce and distribute copies of the + Work or Derivative Works thereof in any medium, with or without + modifications, and in Source or Object form, provided that You + meet the following conditions: + + (a) You must give any other recipients of the Work or + Derivative Works a copy of this License; and + + (b) You must cause any modified files to carry prominent notices + stating that You changed the files; and + + (c) You must retain, in the Source form of any Derivative Works + that You distribute, all copyright, patent, trademark, and + attribution notices from the Source form of the Work, + excluding those notices that do not pertain to any part of + the Derivative Works; and + + (d) If the Work includes a "NOTICE" text file as part of its + distribution, then any Derivative Works that You distribute must + include a readable copy of the attribution notices contained + within such NOTICE file, excluding those notices that do not + pertain to any part of the Derivative Works, in at least one + of the following places: within a NOTICE text file distributed + as part of the Derivative Works; within the Source form or + documentation, if provided along with the Derivative Works; or, + within a display generated by the Derivative Works, if and + wherever such third-party notices normally appear. The contents + of the NOTICE file are for informational purposes only and + do not modify the License. You may add Your own attribution + notices within Derivative Works that You distribute, alongside + or as an addendum to the NOTICE text from the Work, provided + that such additional attribution notices cannot be construed + as modifying the License. + + You may add Your own copyright statement to Your modifications and + may provide additional or different license terms and conditions + for use, reproduction, or distribution of Your modifications, or + for any such Derivative Works as a whole, provided Your use, + reproduction, and distribution of the Work otherwise complies with + the conditions stated in this License. + + 5. Submission of Contributions. Unless You explicitly state otherwise, + any Contribution intentionally submitted for inclusion in the Work + by You to the Licensor shall be under the terms and conditions of + this License, without any additional terms or conditions. + Notwithstanding the above, nothing herein shall supersede or modify + the terms of any separate license agreement you may have executed + with Licensor regarding such Contributions. + + 6. Trademarks. This License does not grant permission to use the trade + names, trademarks, service marks, or product names of the Licensor, + except as required for reasonable and customary use in describing the + origin of the Work and reproducing the content of the NOTICE file. + + 7. Disclaimer of Warranty. Unless required by applicable law or + agreed to in writing, Licensor provides the Work (and each + Contributor provides its Contributions) on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or + implied, including, without limitation, any warranties or conditions + of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A + PARTICULAR PURPOSE. You are solely responsible for determining the + appropriateness of using or redistributing the Work and assume any + risks associated with Your exercise of permissions under this License. + + 8. Limitation of Liability. In no event and under no legal theory, + whether in tort (including negligence), contract, or otherwise, + unless required by applicable law (such as deliberate and grossly + negligent acts) or agreed to in writing, shall any Contributor be + liable to You for damages, including any direct, indirect, special, + incidental, or consequential damages of any character arising as a + result of this License or out of the use or inability to use the + Work (including but not limited to damages for loss of goodwill, + work stoppage, computer failure or malfunction, or any and all + other commercial damages or losses), even if such Contributor + has been advised of the possibility of such damages. + + 9. Accepting Warranty or Additional Liability. While redistributing + the Work or Derivative Works thereof, You may choose to offer, + and charge a fee for, acceptance of support, warranty, indemnity, + or other liability obligations and/or rights consistent with this + License. However, in accepting such obligations, You may act only + on Your own behalf and on Your sole responsibility, not on behalf + of any other Contributor, and only if You agree to indemnify, + defend, and hold each Contributor harmless for any liability + incurred by, or claims asserted against, such Contributor by reason + of your accepting any such warranty or additional liability. + + END OF TERMS AND CONDITIONS + + APPENDIX: How to apply the Apache License to your work. + + To apply the Apache License to your work, attach the following + boilerplate notice, with the fields enclosed by brackets "[]" + replaced with your own identifying information. (Don't include + the brackets!) The text should be enclosed in the appropriate + comment syntax for the file format. We also recommend that a + file or class name and description of purpose be included on the + same "printed page" as the copyright notice for easier + identification within third-party archives. + + Copyright [yyyy] [name of copyright owner] + + Licensed under the Apache License, Version 2.0 (the "License"); + you may not use this file except in compliance with the License. + You may obtain a copy of the License at + + http://www.apache.org/licenses/LICENSE-2.0 + + Unless required by applicable law or agreed to in writing, software + distributed under the License is distributed on an "AS IS" BASIS, + WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + See the License for the specific language governing permissions and + limitations under the License. \ No newline at end of file diff --git a/cookbooks/datadog/NOTICE b/cookbooks/datadog/NOTICE new file mode 100644 index 00000000..fbd8ad8c --- /dev/null +++ b/cookbooks/datadog/NOTICE @@ -0,0 +1,4 @@ +Datadog chef-datadog +Copyright [2011-Present] Datadog, Inc. + +This product includes software developed at Datadog (https://www.datadoghq.com/). \ No newline at end of file diff --git a/cookbooks/datadog/README.md b/cookbooks/datadog/README.md index fb004482..f7f8eb7d 100644 --- a/cookbooks/datadog/README.md +++ b/cookbooks/datadog/README.md @@ -19,10 +19,12 @@ The Datadog Chef cookbook is compatible with `chef-client` >= 12.7. If you need The following platforms are supported: +* AlmaLinux (requires Chef 16 >= 16.10.8 or Chef >= 17.0.69) * Amazon Linux * CentOS * Debian * RedHat (RHEL 8 requires Chef >= 15) +* Rocky (requires Chef 16 >= 16.17.4 or Chef >= 17.1.35) * Scientific Linux * Ubuntu * Windows @@ -40,23 +42,8 @@ The following Opscode cookbooks are dependencies: #### Chef -**Chef 12 users**: Depending on your version of Chef 12, additional dependency constraints may apply: - -```ruby -# Chef < 12.14 -depends 'yum', '< 5.0' -``` - -```ruby -# Chef < 12.9 -depends 'apt', '< 6.0.0' -depends 'yum', '< 5.0' -``` - **Chef 13 users**: With Chef 13 and `chef_handler` 1.x, you may have trouble using the `dd-handler` recipe. The known workaround is to update your dependency to `chef_handler` >= 2.1. -**Chef 14 and later users**: To support Chef 12 and 13, the `datadog` cookbook has a dependency on the `chef_handler` cookbook, which is shipped as a resource in Chef 14. Unfortunately, this causes a deprecation message on Chef 14 and later. - ### Installation 1. Add the cookbook to your Chef server with [Berkshelf][5] or [Knife][6]: @@ -222,7 +209,7 @@ Some attribute names have changed from version 3.x to 4.x of the cookbook. Use t | Pin agent version | `'agent_version'` or `'agent6_version'` | `'agent_version'` for all versions | | Change package_action | `'agent_package_action'` or `'agent6_package_action'` | `'agent_package_action'` for all versions | | Change APT repo URL | `'aptrepo'` or `'agent6_aptrepo'` | `'aptrepo'` for all versions | -| Change APT repo dist | `'aptrepo_dist'` or `'agent6_aptrepo_dist'` | `'aptrepo_dist'` for all versions | +| Change APT repo distribution | `'aptrepo_dist'` or `'agent6_aptrepo_dist'` | `'aptrepo_dist'` for all versions | | Change YUM repo | `'yumrepo'` or `'agent6_yumrepo'` | `'yumrepo'` for all versions | | Change SUSE repo | `'yumrepo_suse'` or `'agent6_yumrepo_suse'` | `'yumrepo_suse'` for all versions | @@ -311,6 +298,8 @@ The [system-probe recipe][17] is automatically included by default. It writes th To enable [Network Performance Monitoring][7] (NPM) in `system-probe.yaml`, set `node['datadog']['system_probe']['network_enabled']` to true. +To enable [Universal Service Monitoring][7] (USM) in `system-probe.yaml`, set `node['datadog']['system_probe']['service_monitoring_enabled']` to true. + **Note for Windows users**: NPM is supported on Windows with Agent v6.27+ and v7.27+. It ships as an optional component that is only installed if `node['datadog']['system_probe']['network_enabled']` is set to true when the Agent is installed or upgraded. Because of this, existing installations might need to do an uninstall and reinstall of the Agent once to install the NPM component, unless the Agent is upgraded at the same time. ## Resources diff --git a/cookbooks/datadog/attributes/cassandra.rb b/cookbooks/datadog/attributes/cassandra.rb index 3df57b70..72ea4d97 100644 --- a/cookbooks/datadog/attributes/cassandra.rb +++ b/cookbooks/datadog/attributes/cassandra.rb @@ -1 +1,15 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + default['datadog']['cassandra']['version'] = 1 diff --git a/cookbooks/datadog/attributes/default.rb b/cookbooks/datadog/attributes/default.rb index 6ef1c7dd..9cb9347e 100644 --- a/cookbooks/datadog/attributes/default.rb +++ b/cookbooks/datadog/attributes/default.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Attributes:: default # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -161,7 +161,6 @@ # not running on RHEL/CentOS <= 5 and not providing custom yumrepo. # You can set it to true/false explicitly to override this behaviour. default['datadog']['yumrepo_repo_gpgcheck'] = nil -default['datadog']['yumrepo_gpgkey'] = "#{yum_protocol}://keys.datadoghq.com/DATADOG_RPM_KEY.public" default['datadog']['yumrepo_proxy'] = nil default['datadog']['yumrepo_proxy_username'] = nil default['datadog']['yumrepo_proxy_password'] = nil @@ -176,8 +175,9 @@ # of the Agent will be signed with this key. # DATADOG_RPM_KEY_CURRENT always contains the key that is used to sign repodata and latest packages default['datadog']['yumrepo_gpgkey_new_current'] = "#{yum_protocol}://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public" -default['datadog']['yumrepo_gpgkey_new_e09422b3'] = "#{yum_protocol}://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public" +default['datadog']['yumrepo_gpgkey_new_b01082d3'] = "#{yum_protocol}://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public" default['datadog']['yumrepo_gpgkey_new_fd4bf915'] = "#{yum_protocol}://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public" +default['datadog']['yumrepo_gpgkey_new_e09422b3'] = "#{yum_protocol}://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public" # Windows Agent Blacklist # Attribute to enforce silent failures on agent installs when attempting to install a @@ -360,6 +360,10 @@ default['datadog']['process_agent']['container_interval'] = nil default['datadog']['process_agent']['rtcontainer_interval'] = nil +# Cloud Workload Security functionality settings +default['datadog']['security_agent']['cws']['enabled'] = false +default['datadog']['security_agent']['cspm']['enabled'] = false + # System probe functionality settings # Whether this cookbook should write system-probe.yaml or not. @@ -369,7 +373,13 @@ # the NPM module of system probe will still run. default['datadog']['system_probe']['enabled'] = false # sysprobe_socket defines the unix socket location -default['datadog']['system_probe']['sysprobe_socket'] = '/opt/datadog-agent/run/sysprobe.sock' +default['datadog']['system_probe']['sysprobe_socket'] = + if platform_family?('windows') + 'localhost:3333' + else + '/opt/datadog-agent/run/sysprobe.sock' + end + # debug_port is the http port for expvar, it is disabled if set to 0 default['datadog']['system_probe']['debug_port'] = 0 default['datadog']['system_probe']['bpf_debug'] = false @@ -380,6 +390,7 @@ # When this is set to nil (default), `network_config` won't be rendered in system-probe.yaml, # making the Agent use the default setting for this value. default['datadog']['system_probe']['network_enabled'] = nil +default['datadog']['system_probe']['service_monitoring_enabled'] = nil # Logs functionality settings (Agent 6/7 only) # Set `enable_logs_agent` to: diff --git a/cookbooks/datadog/attributes/go-metro.rb b/cookbooks/datadog/attributes/go-metro.rb index 8da68958..c3f41595 100644 --- a/cookbooks/datadog/attributes/go-metro.rb +++ b/cookbooks/datadog/attributes/go-metro.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # The implementation for the go-metro recipe allows any package resource # property to be defined as an attribute underneath the # node['datadog']['go-metro']['libcap_package'] namespace diff --git a/cookbooks/datadog/attributes/kafka.rb b/cookbooks/datadog/attributes/kafka.rb index 45ceaf04..8165b807 100644 --- a/cookbooks/datadog/attributes/kafka.rb +++ b/cookbooks/datadog/attributes/kafka.rb @@ -1 +1,15 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + default['datadog']['kafka']['version'] = 1 diff --git a/cookbooks/datadog/attributes/network.rb b/cookbooks/datadog/attributes/network.rb index 00c30b21..a83bbf6e 100644 --- a/cookbooks/datadog/attributes/network.rb +++ b/cookbooks/datadog/attributes/network.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + default['datadog']['network']['instances'] = [ { 'collect_connection_state' => 'false', diff --git a/cookbooks/datadog/docker_test_env/Dockerfile b/cookbooks/datadog/docker_test_env/Dockerfile index a3214aef..0ec95bc3 100644 --- a/cookbooks/datadog/docker_test_env/Dockerfile +++ b/cookbooks/datadog/docker_test_env/Dockerfile @@ -1,4 +1,4 @@ -# docker run --rm -it -v /dev/vboxdrv:/dev/vboxdrv +# docker run --rm -it -v /dev/vboxdrv:/dev/vboxdrv ARG BASE_IMAGE=ubuntu:20.04 FROM $BASE_IMAGE ARG TZ=America/New_York diff --git a/cookbooks/datadog/kitchen.docker.yml b/cookbooks/datadog/kitchen.docker.yml index 88d62f8e..40b3da76 100644 --- a/cookbooks/datadog/kitchen.docker.yml +++ b/cookbooks/datadog/kitchen.docker.yml @@ -39,6 +39,15 @@ platforms: - name: debian-8.11 driver_config: require_chef_omnibus: 14.12 + # The Debian 8 (Jessie) GPG key expired on Sat Nov 19 2022 21:01:13 GMT+0000. + # This Docker image uses gpgv wrapper that ignores key expiration date but checks package signatures. + image: 'datadog/docker-library:chef_kitchen_apt_debian_8' + - name: rocky-8 + driver_config: + platform: rhel # kitchen-docker doesn't recognize rocky otherwise + require_chef_omnibus: 16.17.4 + image: 'datadog/docker-library:chef_kitchen_systemd_rocky_8' + run_command: /root/start.sh suites: <% @@ -65,4 +74,8 @@ suites: - ubuntu-14.04 - debian-8.11 <% end %> + <% if %w(5).include?(agent_major_version) %> + excludes: + - centos-7.7 + <% end %> <% end %> diff --git a/cookbooks/datadog/kitchen.yml b/cookbooks/datadog/kitchen.yml index 306dbd12..4e0ef1d1 100644 --- a/cookbooks/datadog/kitchen.yml +++ b/cookbooks/datadog/kitchen.yml @@ -15,10 +15,13 @@ platforms: centos-6.6 centos-7.1 debian-7.8 + debian-9.13 + debian-10.11 + rockylinux-8.5 ) chef_versions = %w( 12.7.2 - 14 + 14.10.9 16.5 17 18 @@ -386,11 +389,13 @@ suites: kafka_consumer: instances: - kafka_connect_str: localhost:19092 - zk_connect_str: localhost:2181 - zk_prefix: /0.8 consumer_groups: my_consumer: my_topic: [0, 1, 4, 12] + monitor_unlisted_consumer_groups: true + zk_connect_str: localhost:2181 + zk_prefix: /0.8 + kafka_consumer_offsets: true - name: datadog_mesos_master run_list: @@ -591,3 +596,15 @@ suites: - host: localhost port: 49112 +- name: datadog_jboss_wildfly + run_list: + - recipe[datadog::jboss_wildfly] + attributes: + datadog: + <<: *DATADOG + jboss_wildfly: + init_config: + custom_jar_paths: ["/opt/wildfly/bin/client/jboss-client.jar"] + instances: + - jmx_url: localhost:9990 + tools_jar_path: /opt/wildfly/bin/client/jboss-client.jar diff --git a/cookbooks/datadog/libraries/recipe_helpers.rb b/cookbooks/datadog/libraries/recipe_helpers.rb index 37b38150..db72c646 100644 --- a/cookbooks/datadog/libraries/recipe_helpers.rb +++ b/cookbooks/datadog/libraries/recipe_helpers.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + class Chef # Helper class for Datadog Chef recipes class Datadog @@ -7,6 +21,17 @@ class << self datadog-iot-agent ].freeze + # This method stores a variable that is used across recipes so we needed a place to define it. + # Global variables like this are usually set in the attributes/default.rb file for users to edit them. + # We don't want this variable to be changed by the user though, hence the place. + def apt_sources_list_file + '/etc/apt/sources.list.d/datadog.list' + end + + def chef_version_ge?(version) + Gem::Requirement.new(">= #{version}").satisfied_by?(Gem::Version.new(Chef::VERSION)) + end + def agent_version(node) dd_agent_version = node['datadog']['agent_version'] if dd_agent_version.respond_to?(:each_pair) @@ -18,9 +43,14 @@ def agent_version(node) dd_agent_version = dd_agent_version[platform_family] end if !dd_agent_version.nil? && dd_agent_version.match(/^[0-9]+\.[0-9]+\.[0-9]+((?:~|-)[^0-9\s-]+[^-\s]*)?$/) - if node['platform_family'] == 'suse' || node['platform_family'] == 'debian' + # For RHEL-based distros: + # - we can only add epoch and release when running Chef >= 14, as Chef < 14 + # has different yum logic that doesn't know how to work with epoch and release + # - for Chef < 14, we only add release + if %w[debian suse].include?(node['platform_family']) || + (%w[amazon fedora rhel].include?(node['platform_family']) && chef_version_ge?(14)) dd_agent_version = '1:' + dd_agent_version + '-1' - elsif node['platform_family'] == 'rhel' || node['platform_family'] == 'fedora' || node['platform_family'] == 'amazon' + elsif %w[amazon fedora rhel].include?(node['platform_family']) dd_agent_version += '-1' end end @@ -102,6 +132,10 @@ def cookbook_version(run_context) run_context.cookbook_collection['datadog'].version end + def systemd_platform?(node) + (node['platform'] == 'amazon' || node['platform_family'] == 'amazon') && node['platform_version'].to_i >= 2022 + end + def upstart_platform?(node) agent_major_version(node) > 5 && (((node['platform'] == 'amazon' || node['platform_family'] == 'amazon') && node['platform_version'].to_i != 2) || @@ -116,6 +150,9 @@ def service_provider(node) service_provider = Chef::Provider::Service.const_get(specified_provider) end service_provider + # Specific catch for Amazon Linux >= 2022 where Upstart doesn't work + elsif systemd_platform?(node) + Chef::Provider::Service::Systemd elsif upstart_platform?(node) Chef::Provider::Service::Upstart end @@ -157,18 +194,21 @@ def must_reinstall?(node) private include Chef::Mixin::ShellOut - def agent_status + def agent_get_version return nil unless File.exist?(WIN_BIN_PATH) - shell_out("\"#{WIN_BIN_PATH}\" status").stdout.strip + shell_out("\"#{WIN_BIN_PATH}\" version -n").stdout.strip end def fetch_current_version - status = agent_status - return nil if status.nil? - match_data = status.match(/^Agent \(v(.*)\)/) + raw_version = agent_get_version + return nil if raw_version.nil? + match_data = raw_version.match(/^Agent ([^\s]*) (- Meta: ([^\s]*) )?- Commit/) - # Nightlies like 6.20.0-devel+git.38.cd7f989 fail to parse as Gem::Version because of the '+' sign - version = match_data[1].tr('+', '-') if match_data + version = match_data[1] if match_data + nightly_version = match_data[3] if match_data[2] + # If the Meta tag is catched, we'll add it to the version to specify the nightly version we're using + # Nightlies like 6.20.0-devel+git.38.cd7f989 fail to parse as Gem::Version because of the '+' sign so let's use '-' + version = version + '-' + nightly_version if nightly_version Gem::Version.new(version) if version end @@ -186,7 +226,7 @@ def chef_version_can_uninstall? # because they cannot correctly fetch the registry keys of 64 bits # applications for uninstallation so we are only using the downgrade # feature on chef >= to 14 - Gem::Requirement.new('>= 14').satisfied_by?(Gem::Version.new(Chef::VERSION)) + Chef::Datadog.chef_version_ge? 14 end end end diff --git a/cookbooks/datadog/libraries/test_helpers.rb b/cookbooks/datadog/libraries/test_helpers.rb index 595f846a..0e084466 100644 --- a/cookbooks/datadog/libraries/test_helpers.rb +++ b/cookbooks/datadog/libraries/test_helpers.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + class Mock class ShellCommandResult @stdout = '' diff --git a/cookbooks/datadog/metadata.rb b/cookbooks/datadog/metadata.rb index 4f3c7acb..43433d22 100644 --- a/cookbooks/datadog/metadata.rb +++ b/cookbooks/datadog/metadata.rb @@ -3,7 +3,7 @@ maintainer_email 'package@datadoghq.com' license 'Apache-2.0' description 'Installs/Configures datadog components' -version '4.11.1' +version '4.18.0' chef_version '>= 12.7' source_url 'https://github.com/DataDog/chef-datadog' issues_url 'https://github.com/DataDog/chef-datadog/issues' @@ -22,18 +22,31 @@ supports os end -#depends 'chef_handler', '>= 1.2' -depends 'apt' # Use '< 6.0.0' with Chef < 12.9 -depends 'yum', '>= 3.0' # Use '< 5.0' with Chef < 12.14 +current_chef_version = if Chef::VERSION.instance_of? String + # For Chef < 13.1.33 Chef::VERSION was a String + Gem::Version.new(Chef::VERSION.to_f) + else + # Else Chef::VERSION is already a VersionString + Chef::VERSION + end -recipe 'datadog::default', 'Default' -recipe 'datadog::dd-agent', 'Installs the Datadog Agent' -recipe 'datadog::dd-handler', 'Installs a Chef handler for Datadog' -recipe 'datadog::repository', 'Installs the Datadog package repository' -recipe 'datadog::dogstatsd-ruby', 'Installs the Ruby dogstatsd package for custom metrics' -recipe 'datadog::ddtrace-ruby', 'Installs the Ruby ddtrace package for APM' +if current_chef_version < Gem::Version.new(14) + # The chef_handler cookbook is shipped as part of Chef >= 14, + # so from Chef >= 14 chef_handler cookbook is deprecated. + depends 'chef_handler', '>= 1.2' +end + +# Use '< 6.0.0' with Chef < 12.9 +if current_chef_version < Gem::Version.new(12.9) + depends 'apt', '< 6.0' +else + depends 'apt' +end -# integration-specific -recipe 'datadog::cassandra', 'Installs and configures the Cassandra integration' -recipe 'datadog::couchdb', 'Installs and configures the CouchDB integration' -recipe 'datadog::postfix', 'Installs and configures the Postfix integration' \ No newline at end of file +# Must be '>= 3.0' and '< 5.0' with Chef < 12.14 +# Chef allows only one constraint and '~> 3.0' means '>= 3.0' and '< 4.0' +if current_chef_version < Gem::Version.new(12.14) + depends 'yum', '~> 3.0' +else + depends 'yum', '>= 3.0' +end diff --git a/cookbooks/datadog/recipes/_agent6_config.rb b/cookbooks/datadog/recipes/_agent6_config.rb index 5bbaf09f..a9fe1b28 100644 --- a/cookbooks/datadog/recipes/_agent6_config.rb +++ b/cookbooks/datadog/recipes/_agent6_config.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: _agent6_config # -# Copyright:: 2011-2017, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/_install-linux.rb b/cookbooks/datadog/recipes/_install-linux.rb index 8fee008b..070e66f0 100644 --- a/cookbooks/datadog/recipes/_install-linux.rb +++ b/cookbooks/datadog/recipes/_install-linux.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: _install-linux # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -45,9 +45,10 @@ action :upgrade end when 'rhel', 'fedora', 'amazon' - if platform_family?('rhel') && node['platform_version'].to_i >= 8 && !platform?('amazon') || - platform_family?('fedora') && node['platform_version'].to_i >= 28 - # yum_package doesn't work on RHEL 8 and Fedora >= 28 + if (platform_family?('rhel') && node['platform_version'].to_i >= 8) || + (platform_family?('fedora') && node['platform_version'].to_i >= 28) || + (platform_family?('amazon') && node['platform_version'].to_i >= 2022) + # yum_package doesn't work on RHEL >= 8, Fedora >= 28 and AmazonLinux >=2022 # dnf_package only works on RHEL 8 / Fedora >= 28 if Chef 15+ is used dnf_package dd_agent_flavor do version dd_agent_version diff --git a/cookbooks/datadog/recipes/_install-windows.rb b/cookbooks/datadog/recipes/_install-windows.rb index 6dd51b97..92954790 100644 --- a/cookbooks/datadog/recipes/_install-windows.rb +++ b/cookbooks/datadog/recipes/_install-windows.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: _install-windows # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -17,7 +17,9 @@ # limitations under the License. # -include_recipe 'chef_handler' +if Chef::VERSION < Gem::Version.new(14) + include_recipe 'chef_handler' +end dd_agent_flavor = Chef::Datadog.agent_flavor(node) diff --git a/cookbooks/datadog/recipes/active_directory.rb b/cookbooks/datadog/recipes/active_directory.rb index 22efa4ae..0dcf8cbc 100644 --- a/cookbooks/datadog/recipes/active_directory.rb +++ b/cookbooks/datadog/recipes/active_directory.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Active Directory diff --git a/cookbooks/datadog/recipes/activemq.rb b/cookbooks/datadog/recipes/activemq.rb index 6834e49d..e6e17cf0 100644 --- a/cookbooks/datadog/recipes/activemq.rb +++ b/cookbooks/datadog/recipes/activemq.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor activemq diff --git a/cookbooks/datadog/recipes/activemq_xml.rb b/cookbooks/datadog/recipes/activemq_xml.rb index f097ef60..d0c1a2b1 100644 --- a/cookbooks/datadog/recipes/activemq_xml.rb +++ b/cookbooks/datadog/recipes/activemq_xml.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor ActiveMQ XML diff --git a/cookbooks/datadog/recipes/aerospike.rb b/cookbooks/datadog/recipes/aerospike.rb index e9ddf840..1a8390b9 100644 --- a/cookbooks/datadog/recipes/aerospike.rb +++ b/cookbooks/datadog/recipes/aerospike.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Aerospike diff --git a/cookbooks/datadog/recipes/airflow.rb b/cookbooks/datadog/recipes/airflow.rb index d6b949d4..f7871858 100644 --- a/cookbooks/datadog/recipes/airflow.rb +++ b/cookbooks/datadog/recipes/airflow.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Airflow diff --git a/cookbooks/datadog/recipes/amazon_msk.rb b/cookbooks/datadog/recipes/amazon_msk.rb index bbf4f83e..68d8528e 100644 --- a/cookbooks/datadog/recipes/amazon_msk.rb +++ b/cookbooks/datadog/recipes/amazon_msk.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Amazon Kafka diff --git a/cookbooks/datadog/recipes/ambari.rb b/cookbooks/datadog/recipes/ambari.rb index 92196421..1d018376 100644 --- a/cookbooks/datadog/recipes/ambari.rb +++ b/cookbooks/datadog/recipes/ambari.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Ambari diff --git a/cookbooks/datadog/recipes/apache.rb b/cookbooks/datadog/recipes/apache.rb index 0cba0f29..0287a65f 100644 --- a/cookbooks/datadog/recipes/apache.rb +++ b/cookbooks/datadog/recipes/apache.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor apache diff --git a/cookbooks/datadog/recipes/aspdotnet.rb b/cookbooks/datadog/recipes/aspdotnet.rb index 915ea849..3b9ec09f 100644 --- a/cookbooks/datadog/recipes/aspdotnet.rb +++ b/cookbooks/datadog/recipes/aspdotnet.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor ASP.NET diff --git a/cookbooks/datadog/recipes/btrfs.rb b/cookbooks/datadog/recipes/btrfs.rb index 1024ecd6..0c6251d3 100644 --- a/cookbooks/datadog/recipes/btrfs.rb +++ b/cookbooks/datadog/recipes/btrfs.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Btrfs diff --git a/cookbooks/datadog/recipes/cacti.rb b/cookbooks/datadog/recipes/cacti.rb index 28235357..c612a762 100644 --- a/cookbooks/datadog/recipes/cacti.rb +++ b/cookbooks/datadog/recipes/cacti.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Import cacti data diff --git a/cookbooks/datadog/recipes/cassandra.rb b/cookbooks/datadog/recipes/cassandra.rb index 1a15d152..029b8c64 100644 --- a/cookbooks/datadog/recipes/cassandra.rb +++ b/cookbooks/datadog/recipes/cassandra.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Cassandra diff --git a/cookbooks/datadog/recipes/cassandra_nodetool.rb b/cookbooks/datadog/recipes/cassandra_nodetool.rb index 1414a9d2..3b2fa4ec 100644 --- a/cookbooks/datadog/recipes/cassandra_nodetool.rb +++ b/cookbooks/datadog/recipes/cassandra_nodetool.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Cassandra Nodetool diff --git a/cookbooks/datadog/recipes/ceph.rb b/cookbooks/datadog/recipes/ceph.rb index c6699c64..833bc1af 100644 --- a/cookbooks/datadog/recipes/ceph.rb +++ b/cookbooks/datadog/recipes/ceph.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Ceph diff --git a/cookbooks/datadog/recipes/cilium.rb b/cookbooks/datadog/recipes/cilium.rb index e18b5584..81131043 100644 --- a/cookbooks/datadog/recipes/cilium.rb +++ b/cookbooks/datadog/recipes/cilium.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Cilium diff --git a/cookbooks/datadog/recipes/cisco_aci.rb b/cookbooks/datadog/recipes/cisco_aci.rb index 6f3da0b9..5346ee3b 100644 --- a/cookbooks/datadog/recipes/cisco_aci.rb +++ b/cookbooks/datadog/recipes/cisco_aci.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Cisco ACI diff --git a/cookbooks/datadog/recipes/clickhouse.rb b/cookbooks/datadog/recipes/clickhouse.rb index 8dbf0a30..29e0fba8 100644 --- a/cookbooks/datadog/recipes/clickhouse.rb +++ b/cookbooks/datadog/recipes/clickhouse.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor ClickHouse diff --git a/cookbooks/datadog/recipes/cloud_foundry_api.rb b/cookbooks/datadog/recipes/cloud_foundry_api.rb index 5d02d557..70926964 100644 --- a/cookbooks/datadog/recipes/cloud_foundry_api.rb +++ b/cookbooks/datadog/recipes/cloud_foundry_api.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Cloud Foundry API diff --git a/cookbooks/datadog/recipes/cockroachdb.rb b/cookbooks/datadog/recipes/cockroachdb.rb index 66abc6fd..6b3c7bd6 100644 --- a/cookbooks/datadog/recipes/cockroachdb.rb +++ b/cookbooks/datadog/recipes/cockroachdb.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor CockroachDB diff --git a/cookbooks/datadog/recipes/confluent_platform.rb b/cookbooks/datadog/recipes/confluent_platform.rb index 188e88ff..7b58f488 100644 --- a/cookbooks/datadog/recipes/confluent_platform.rb +++ b/cookbooks/datadog/recipes/confluent_platform.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Confluent Platform @@ -89,6 +103,7 @@ init_config node['datadog']['confluent_platform']['init_config'] instances node['datadog']['confluent_platform']['instances'] logs node['datadog']['confluent_platform']['logs'] + is_jmx true use_integration_template true action :add notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] diff --git a/cookbooks/datadog/recipes/consul.rb b/cookbooks/datadog/recipes/consul.rb index 9a15882b..7b75ddd6 100644 --- a/cookbooks/datadog/recipes/consul.rb +++ b/cookbooks/datadog/recipes/consul.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor consul diff --git a/cookbooks/datadog/recipes/couchbase.rb b/cookbooks/datadog/recipes/couchbase.rb index 771817c8..49cb9c6b 100644 --- a/cookbooks/datadog/recipes/couchbase.rb +++ b/cookbooks/datadog/recipes/couchbase.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor couchbase diff --git a/cookbooks/datadog/recipes/couchdb.rb b/cookbooks/datadog/recipes/couchdb.rb index 0091e137..96ef49f9 100644 --- a/cookbooks/datadog/recipes/couchdb.rb +++ b/cookbooks/datadog/recipes/couchdb.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor couchDB diff --git a/cookbooks/datadog/recipes/custom_log_collection.rb b/cookbooks/datadog/recipes/custom_log_collection.rb new file mode 100644 index 00000000..fc9b1ee2 --- /dev/null +++ b/cookbooks/datadog/recipes/custom_log_collection.rb @@ -0,0 +1,33 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +include_recipe '::dd-agent' + +# node.default['datadog']['custom_log_collection']['logs'] = [ +# { +# 'type' => 'file', +# 'path' => '', +# 'source' => '', +# 'tags' => [ +# 'tag1:value1', +# 'tag2:value2' +# ] +# } +# ] + +datadog_monitor 'custom_log_collection' do + logs node['datadog']['custom_log_collection']['logs'] + action :add + notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] +end diff --git a/cookbooks/datadog/recipes/dd-agent.rb b/cookbooks/datadog/recipes/dd-agent.rb index 5f190188..188d227b 100644 --- a/cookbooks/datadog/recipes/dd-agent.rb +++ b/cookbooks/datadog/recipes/dd-agent.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: dd-agent # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -166,6 +166,9 @@ def template_vars # system-probe is a dependency of the agent on Linux or Windows include_recipe '::system-probe' if system_probe_managed && system_probe_supported +# security-agent is a dependency of the agent on Linux or Windows +include_recipe '::security-agent' unless is_windows + # Installation metadata to let know the agent about installation method and its version include_recipe '::install_info' diff --git a/cookbooks/datadog/recipes/dd-handler.rb b/cookbooks/datadog/recipes/dd-handler.rb index f009ba1a..a95ae468 100644 --- a/cookbooks/datadog/recipes/dd-handler.rb +++ b/cookbooks/datadog/recipes/dd-handler.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: dd-handler # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/ddtrace-ruby.rb b/cookbooks/datadog/recipes/ddtrace-ruby.rb index e00a1453..95da742b 100644 --- a/cookbooks/datadog/recipes/ddtrace-ruby.rb +++ b/cookbooks/datadog/recipes/ddtrace-ruby.rb @@ -2,6 +2,19 @@ # Cookbook:: datadog # Recipe:: ddtrace-ruby.rb # +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. gem_package 'ddtrace' do version node['datadog']['ddtrace_gem_version'] diff --git a/cookbooks/datadog/recipes/default.rb b/cookbooks/datadog/recipes/default.rb index c1b693b4..ee50110b 100644 --- a/cookbooks/datadog/recipes/default.rb +++ b/cookbooks/datadog/recipes/default.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: default # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/directory.rb b/cookbooks/datadog/recipes/directory.rb index adfd15f2..5629ca4e 100644 --- a/cookbooks/datadog/recipes/directory.rb +++ b/cookbooks/datadog/recipes/directory.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor files in a directory diff --git a/cookbooks/datadog/recipes/disk.rb b/cookbooks/datadog/recipes/disk.rb index 7fc13cdc..1d5e6da7 100644 --- a/cookbooks/datadog/recipes/disk.rb +++ b/cookbooks/datadog/recipes/disk.rb @@ -2,6 +2,20 @@ # Cookbook:: datadog # Recipe:: disk # +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# # This recipe exists to apply (optional) configuration to the disk integration # This recipe does not need to be included to use the disk integration, # but it allows you to override some defaults that the disk integration diff --git a/cookbooks/datadog/recipes/dns_check.rb b/cookbooks/datadog/recipes/dns_check.rb index 66d7d61d..75129aa5 100644 --- a/cookbooks/datadog/recipes/dns_check.rb +++ b/cookbooks/datadog/recipes/dns_check.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor dns diff --git a/cookbooks/datadog/recipes/docker.rb b/cookbooks/datadog/recipes/docker.rb index 03f975e8..f9ca9a15 100644 --- a/cookbooks/datadog/recipes/docker.rb +++ b/cookbooks/datadog/recipes/docker.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: docker # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/docker_daemon.rb b/cookbooks/datadog/recipes/docker_daemon.rb index 17399a63..39d2f36a 100644 --- a/cookbooks/datadog/recipes/docker_daemon.rb +++ b/cookbooks/datadog/recipes/docker_daemon.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: docker_daemon # -# Copyright:: 2011-2016, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/dogstatsd-ruby.rb b/cookbooks/datadog/recipes/dogstatsd-ruby.rb index 50596a13..a6471d75 100644 --- a/cookbooks/datadog/recipes/dogstatsd-ruby.rb +++ b/cookbooks/datadog/recipes/dogstatsd-ruby.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: dogstatsd-ruby # -# Copyright:: 2013-2015, Datadog +# Copyright:: 2013-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/dotnetclr.rb b/cookbooks/datadog/recipes/dotnetclr.rb index a230f1d4..0465b43f 100644 --- a/cookbooks/datadog/recipes/dotnetclr.rb +++ b/cookbooks/datadog/recipes/dotnetclr.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor .NET CLR diff --git a/cookbooks/datadog/recipes/druid.rb b/cookbooks/datadog/recipes/druid.rb index 0de21a60..3fb33f81 100644 --- a/cookbooks/datadog/recipes/druid.rb +++ b/cookbooks/datadog/recipes/druid.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Druid diff --git a/cookbooks/datadog/recipes/elasticsearch.rb b/cookbooks/datadog/recipes/elasticsearch.rb index 4f6ba4ac..84ec3263 100644 --- a/cookbooks/datadog/recipes/elasticsearch.rb +++ b/cookbooks/datadog/recipes/elasticsearch.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor elasticsearch diff --git a/cookbooks/datadog/recipes/envoy.rb b/cookbooks/datadog/recipes/envoy.rb index c30173cd..0a26d4dd 100644 --- a/cookbooks/datadog/recipes/envoy.rb +++ b/cookbooks/datadog/recipes/envoy.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Envoy diff --git a/cookbooks/datadog/recipes/etcd.rb b/cookbooks/datadog/recipes/etcd.rb index adcd27a6..2b68f9b2 100644 --- a/cookbooks/datadog/recipes/etcd.rb +++ b/cookbooks/datadog/recipes/etcd.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor etcd diff --git a/cookbooks/datadog/recipes/flink.rb b/cookbooks/datadog/recipes/flink.rb index 6d318ad0..6e30e3ea 100644 --- a/cookbooks/datadog/recipes/flink.rb +++ b/cookbooks/datadog/recipes/flink.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor flink diff --git a/cookbooks/datadog/recipes/fluentd.rb b/cookbooks/datadog/recipes/fluentd.rb index 604f59d1..2f2cfa20 100644 --- a/cookbooks/datadog/recipes/fluentd.rb +++ b/cookbooks/datadog/recipes/fluentd.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor fluentd diff --git a/cookbooks/datadog/recipes/gearmand.rb b/cookbooks/datadog/recipes/gearmand.rb new file mode 100644 index 00000000..75628c16 --- /dev/null +++ b/cookbooks/datadog/recipes/gearmand.rb @@ -0,0 +1,53 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +include_recipe '::dd-agent' + +# All attributes are optional. +# node.default['datadog']['gearmand']['instances'] = [ +# { +# # Defaults to 127.0.0.1 if not set +# 'server' => '127.0.0.1', +# # Defaults to 4730 if not set +# 'port' => '4730', +# 'tasks' => [ +# 'TASK_1', +# 'TASK_2', +# ], +# 'tags' => [ +# ':', +# ':' +# ], +# 'service' => '', +# # Defaults to 15 if not set +# 'min_collection_interval' => 60, +# # Defaults to false if not set +# 'empty_default_hostname' => true, +# 'metric_patterns' => { +# 'include' => [ +# '' +# ], +# 'exclude' => [ +# '' +# ] +# } +# } +# ] + +datadog_monitor 'gearmand' do + instances node['datadog']['gearmand']['instances'] + logs node['datadog']['gearmand']['logs'] + action :add + notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] +end diff --git a/cookbooks/datadog/recipes/gitlab.rb b/cookbooks/datadog/recipes/gitlab.rb index 46954d59..800c4645 100644 --- a/cookbooks/datadog/recipes/gitlab.rb +++ b/cookbooks/datadog/recipes/gitlab.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Gitlab diff --git a/cookbooks/datadog/recipes/gitlab_runner.rb b/cookbooks/datadog/recipes/gitlab_runner.rb index 65d4cd1d..9b020862 100644 --- a/cookbooks/datadog/recipes/gitlab_runner.rb +++ b/cookbooks/datadog/recipes/gitlab_runner.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Gitlab Runner diff --git a/cookbooks/datadog/recipes/go-metro.rb b/cookbooks/datadog/recipes/go-metro.rb index 943b573b..9c1e3e6d 100644 --- a/cookbooks/datadog/recipes/go-metro.rb +++ b/cookbooks/datadog/recipes/go-metro.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Go-Metro (TCP RTT) Integration: Passively monitor TCP Round Trip Time diff --git a/cookbooks/datadog/recipes/go_expvar.rb b/cookbooks/datadog/recipes/go_expvar.rb index 9dc1fcac..18a537f9 100644 --- a/cookbooks/datadog/recipes/go_expvar.rb +++ b/cookbooks/datadog/recipes/go_expvar.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Go metrics exported via expvar diff --git a/cookbooks/datadog/recipes/gunicorn.rb b/cookbooks/datadog/recipes/gunicorn.rb index 506d180e..4c810602 100644 --- a/cookbooks/datadog/recipes/gunicorn.rb +++ b/cookbooks/datadog/recipes/gunicorn.rb @@ -2,6 +2,19 @@ # Cookbook:: datadog # Recipe:: gunicorn # +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # Monitor gunicorn # diff --git a/cookbooks/datadog/recipes/haproxy.rb b/cookbooks/datadog/recipes/haproxy.rb index a690887f..416cd530 100644 --- a/cookbooks/datadog/recipes/haproxy.rb +++ b/cookbooks/datadog/recipes/haproxy.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor haproxy diff --git a/cookbooks/datadog/recipes/hazelcast.rb b/cookbooks/datadog/recipes/hazelcast.rb index e09fa541..f5dd87f8 100644 --- a/cookbooks/datadog/recipes/hazelcast.rb +++ b/cookbooks/datadog/recipes/hazelcast.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Hazelcast @@ -99,6 +113,7 @@ init_config node['datadog']['hazelcast']['init_config'] instances node['datadog']['hazelcast']['instances'] logs node['datadog']['hazelcast']['logs'] + is_jmx true use_integration_template true action :add notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] diff --git a/cookbooks/datadog/recipes/hdfs.rb b/cookbooks/datadog/recipes/hdfs.rb index 2eb971c7..2265e6f9 100644 --- a/cookbooks/datadog/recipes/hdfs.rb +++ b/cookbooks/datadog/recipes/hdfs.rb @@ -2,6 +2,19 @@ # Cookbook:: datadog # Recipe:: hdfs # +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # Monitor hdfs # diff --git a/cookbooks/datadog/recipes/hdfs_datanode.rb b/cookbooks/datadog/recipes/hdfs_datanode.rb index 1a384149..4df88bb2 100644 --- a/cookbooks/datadog/recipes/hdfs_datanode.rb +++ b/cookbooks/datadog/recipes/hdfs_datanode.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor HDFS Datanode diff --git a/cookbooks/datadog/recipes/hdfs_namenode.rb b/cookbooks/datadog/recipes/hdfs_namenode.rb index 324a2645..a7895616 100644 --- a/cookbooks/datadog/recipes/hdfs_namenode.rb +++ b/cookbooks/datadog/recipes/hdfs_namenode.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor HDFS Namenode diff --git a/cookbooks/datadog/recipes/hive.rb b/cookbooks/datadog/recipes/hive.rb index fe328999..da2eaceb 100644 --- a/cookbooks/datadog/recipes/hive.rb +++ b/cookbooks/datadog/recipes/hive.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Hive @@ -89,6 +103,7 @@ init_config node['datadog']['hive']['init_config'] instances node['datadog']['hive']['instances'] logs node['datadog']['hive']['logs'] + is_jmx true use_integration_template true action :add notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] diff --git a/cookbooks/datadog/recipes/hivemq.rb b/cookbooks/datadog/recipes/hivemq.rb index 085cee4b..56f3e369 100644 --- a/cookbooks/datadog/recipes/hivemq.rb +++ b/cookbooks/datadog/recipes/hivemq.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor HiveMQ @@ -89,6 +103,7 @@ init_config node['datadog']['hivemq']['init_config'] instances node['datadog']['hivemq']['instances'] logs node['datadog']['hivemq']['logs'] + is_jmx true use_integration_template true action :add notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] diff --git a/cookbooks/datadog/recipes/http_check.rb b/cookbooks/datadog/recipes/http_check.rb index ad09dfa5..8828fa71 100644 --- a/cookbooks/datadog/recipes/http_check.rb +++ b/cookbooks/datadog/recipes/http_check.rb @@ -1,7 +1,21 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Build a data structure with configuration. -# @see http://docs.datadoghq.com/guides/network_checks/ +# @see https://docs.datadoghq.com/integrations/http_check/ # @example # node.override['datadog']['http_check']['instances'] = [ # { diff --git a/cookbooks/datadog/recipes/hyperv.rb b/cookbooks/datadog/recipes/hyperv.rb index 1ae38c76..4f89c7df 100644 --- a/cookbooks/datadog/recipes/hyperv.rb +++ b/cookbooks/datadog/recipes/hyperv.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor HyperV diff --git a/cookbooks/datadog/recipes/ibm_mq.rb b/cookbooks/datadog/recipes/ibm_mq.rb index 502f7689..da268e79 100644 --- a/cookbooks/datadog/recipes/ibm_mq.rb +++ b/cookbooks/datadog/recipes/ibm_mq.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor IBM MQ diff --git a/cookbooks/datadog/recipes/ignite.rb b/cookbooks/datadog/recipes/ignite.rb index f4246ee6..8da655bc 100644 --- a/cookbooks/datadog/recipes/ignite.rb +++ b/cookbooks/datadog/recipes/ignite.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Ignite @@ -89,6 +103,7 @@ init_config node['datadog']['ignite']['init_config'] instances node['datadog']['ignite']['instances'] logs node['datadog']['ignite']['logs'] + is_jmx true use_integration_template true action :add notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] diff --git a/cookbooks/datadog/recipes/iis.rb b/cookbooks/datadog/recipes/iis.rb index ae775a0f..8c1a7dd4 100644 --- a/cookbooks/datadog/recipes/iis.rb +++ b/cookbooks/datadog/recipes/iis.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Integrate IIS metrics diff --git a/cookbooks/datadog/recipes/install_info.rb b/cookbooks/datadog/recipes/install_info.rb index 957c9b48..09f68da2 100644 --- a/cookbooks/datadog/recipes/install_info.rb +++ b/cookbooks/datadog/recipes/install_info.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: install_info # -# Copyright:: 2011-2020, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/integrations.rb b/cookbooks/datadog/recipes/integrations.rb index 1abd3aee..1365bad7 100644 --- a/cookbooks/datadog/recipes/integrations.rb +++ b/cookbooks/datadog/recipes/integrations.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: integrations # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/istio.rb b/cookbooks/datadog/recipes/istio.rb index f9bac92b..8283de71 100644 --- a/cookbooks/datadog/recipes/istio.rb +++ b/cookbooks/datadog/recipes/istio.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Istio diff --git a/cookbooks/datadog/recipes/jboss_wildfly.rb b/cookbooks/datadog/recipes/jboss_wildfly.rb index f64e2831..6233e763 100644 --- a/cookbooks/datadog/recipes/jboss_wildfly.rb +++ b/cookbooks/datadog/recipes/jboss_wildfly.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor JBoss/WildFly @@ -89,6 +103,7 @@ init_config node['datadog']['jboss_wildfly']['init_config'] instances node['datadog']['jboss_wildfly']['instances'] logs node['datadog']['jboss_wildfly']['logs'] + is_jmx true use_integration_template true action :add notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] diff --git a/cookbooks/datadog/recipes/jenkins.rb b/cookbooks/datadog/recipes/jenkins.rb index 5dafbee6..54db7a96 100644 --- a/cookbooks/datadog/recipes/jenkins.rb +++ b/cookbooks/datadog/recipes/jenkins.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Integrate jenkins builds diff --git a/cookbooks/datadog/recipes/jmx.rb b/cookbooks/datadog/recipes/jmx.rb index 97de3f8a..02f76d30 100644 --- a/cookbooks/datadog/recipes/jmx.rb +++ b/cookbooks/datadog/recipes/jmx.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Build a data structure with configuration. diff --git a/cookbooks/datadog/recipes/kafka.rb b/cookbooks/datadog/recipes/kafka.rb index a5a22294..aa446dd7 100644 --- a/cookbooks/datadog/recipes/kafka.rb +++ b/cookbooks/datadog/recipes/kafka.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Kafka diff --git a/cookbooks/datadog/recipes/kafka_consumer.rb b/cookbooks/datadog/recipes/kafka_consumer.rb index 46fcd712..be3f3409 100644 --- a/cookbooks/datadog/recipes/kafka_consumer.rb +++ b/cookbooks/datadog/recipes/kafka_consumer.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Kafka @@ -6,8 +20,18 @@ # node.datadog.kafka_consumer.instances = [ # { # :kafka_connect_str => "localhost:19092", +# :consumer_groups => { +# :my_consumer => { +# :my_topic => [, , , ] +# } , +# # optional -if consumer_groups is set do false no matter of it's set to true or not. +# # false is the default configuration, but since there is a dependency on consumer_groups +# # it will be added to conf.yaml as false. +# :monitor_unlisted_consumer_groups >> true, # :zk_connect_str => "localhost:2181", -# :zk_prefix => "/0.8" +# :zk_prefix => "/0.8", +# # optional -if it's set to false it will no added to conf.yaml because false is default. +# :kafka_consumer_offsets => true # } # ] diff --git a/cookbooks/datadog/recipes/kong.rb b/cookbooks/datadog/recipes/kong.rb index f44e2fa1..a6722eeb 100644 --- a/cookbooks/datadog/recipes/kong.rb +++ b/cookbooks/datadog/recipes/kong.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Kong diff --git a/cookbooks/datadog/recipes/kube_apiserver_metrics.rb b/cookbooks/datadog/recipes/kube_apiserver_metrics.rb index b597221f..21266932 100644 --- a/cookbooks/datadog/recipes/kube_apiserver_metrics.rb +++ b/cookbooks/datadog/recipes/kube_apiserver_metrics.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Kubernetes API server metrics diff --git a/cookbooks/datadog/recipes/kubernetes.rb b/cookbooks/datadog/recipes/kubernetes.rb index d0e344fa..b1bfff5b 100644 --- a/cookbooks/datadog/recipes/kubernetes.rb +++ b/cookbooks/datadog/recipes/kubernetes.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor kubernetes diff --git a/cookbooks/datadog/recipes/kyototycoon.rb b/cookbooks/datadog/recipes/kyototycoon.rb index 18e5d866..cfd109c3 100644 --- a/cookbooks/datadog/recipes/kyototycoon.rb +++ b/cookbooks/datadog/recipes/kyototycoon.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Integrate Kyoto Tycoon metrics into Datadog diff --git a/cookbooks/datadog/recipes/lighttpd.rb b/cookbooks/datadog/recipes/lighttpd.rb index 07d17c46..c0dfde8f 100644 --- a/cookbooks/datadog/recipes/lighttpd.rb +++ b/cookbooks/datadog/recipes/lighttpd.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' datadog_monitor 'lighttpd' do diff --git a/cookbooks/datadog/recipes/mapreduce.rb b/cookbooks/datadog/recipes/mapreduce.rb index 96a2e443..e6dd8cd1 100644 --- a/cookbooks/datadog/recipes/mapreduce.rb +++ b/cookbooks/datadog/recipes/mapreduce.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor MapReduce diff --git a/cookbooks/datadog/recipes/marathon.rb b/cookbooks/datadog/recipes/marathon.rb index 9bb0843f..146e66d8 100644 --- a/cookbooks/datadog/recipes/marathon.rb +++ b/cookbooks/datadog/recipes/marathon.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Marathon diff --git a/cookbooks/datadog/recipes/marklogic.rb b/cookbooks/datadog/recipes/marklogic.rb index 028afbd1..5002046b 100644 --- a/cookbooks/datadog/recipes/marklogic.rb +++ b/cookbooks/datadog/recipes/marklogic.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor MarkLogic diff --git a/cookbooks/datadog/recipes/memcache.rb b/cookbooks/datadog/recipes/memcache.rb index 308d5658..acd68a01 100644 --- a/cookbooks/datadog/recipes/memcache.rb +++ b/cookbooks/datadog/recipes/memcache.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Integrate memcache metrics into Datadog diff --git a/cookbooks/datadog/recipes/mesos_master.rb b/cookbooks/datadog/recipes/mesos_master.rb index c2d01f5a..c66a1b03 100644 --- a/cookbooks/datadog/recipes/mesos_master.rb +++ b/cookbooks/datadog/recipes/mesos_master.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: mesos # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/mesos_slave.rb b/cookbooks/datadog/recipes/mesos_slave.rb index 01487af9..15e15e91 100644 --- a/cookbooks/datadog/recipes/mesos_slave.rb +++ b/cookbooks/datadog/recipes/mesos_slave.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: mesos_slave # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/mongo.rb b/cookbooks/datadog/recipes/mongo.rb index b3d76584..d8766dff 100644 --- a/cookbooks/datadog/recipes/mongo.rb +++ b/cookbooks/datadog/recipes/mongo.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor mongo diff --git a/cookbooks/datadog/recipes/mysql.rb b/cookbooks/datadog/recipes/mysql.rb index dc98173b..90d7f15f 100644 --- a/cookbooks/datadog/recipes/mysql.rb +++ b/cookbooks/datadog/recipes/mysql.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor mysql diff --git a/cookbooks/datadog/recipes/network.rb b/cookbooks/datadog/recipes/network.rb index 83e79777..6cfa15ce 100644 --- a/cookbooks/datadog/recipes/network.rb +++ b/cookbooks/datadog/recipes/network.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor network diff --git a/cookbooks/datadog/recipes/nfsstat.rb b/cookbooks/datadog/recipes/nfsstat.rb index fdd79ef3..36c971fd 100644 --- a/cookbooks/datadog/recipes/nfsstat.rb +++ b/cookbooks/datadog/recipes/nfsstat.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Nfsstat diff --git a/cookbooks/datadog/recipes/nginx.rb b/cookbooks/datadog/recipes/nginx.rb index 2e0cb715..b1bae733 100644 --- a/cookbooks/datadog/recipes/nginx.rb +++ b/cookbooks/datadog/recipes/nginx.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor nginx diff --git a/cookbooks/datadog/recipes/nginx_ingress_controller.rb b/cookbooks/datadog/recipes/nginx_ingress_controller.rb index 54439e9e..9c37fa68 100644 --- a/cookbooks/datadog/recipes/nginx_ingress_controller.rb +++ b/cookbooks/datadog/recipes/nginx_ingress_controller.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor nginx-ingress-controller diff --git a/cookbooks/datadog/recipes/ntp.rb b/cookbooks/datadog/recipes/ntp.rb index cb130a2d..017a6ae0 100644 --- a/cookbooks/datadog/recipes/ntp.rb +++ b/cookbooks/datadog/recipes/ntp.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Build a data structure with configuration. diff --git a/cookbooks/datadog/recipes/openmetrics.rb b/cookbooks/datadog/recipes/openmetrics.rb index 70e645db..50d197fe 100644 --- a/cookbooks/datadog/recipes/openmetrics.rb +++ b/cookbooks/datadog/recipes/openmetrics.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor OpenMetrics diff --git a/cookbooks/datadog/recipes/pdh_check.rb b/cookbooks/datadog/recipes/pdh_check.rb index 267ab9b5..9e1884fe 100644 --- a/cookbooks/datadog/recipes/pdh_check.rb +++ b/cookbooks/datadog/recipes/pdh_check.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor PDH diff --git a/cookbooks/datadog/recipes/pgbouncer.rb b/cookbooks/datadog/recipes/pgbouncer.rb index a405ed25..2aa152a4 100644 --- a/cookbooks/datadog/recipes/pgbouncer.rb +++ b/cookbooks/datadog/recipes/pgbouncer.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: pgbouncer # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/php_fpm.rb b/cookbooks/datadog/recipes/php_fpm.rb index 3a0c7814..5312027c 100644 --- a/cookbooks/datadog/recipes/php_fpm.rb +++ b/cookbooks/datadog/recipes/php_fpm.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Build a data structure with configuration. diff --git a/cookbooks/datadog/recipes/postfix.rb b/cookbooks/datadog/recipes/postfix.rb index 61204afb..b01d889f 100644 --- a/cookbooks/datadog/recipes/postfix.rb +++ b/cookbooks/datadog/recipes/postfix.rb @@ -2,6 +2,19 @@ # Cookbook:: datadog # Recipe:: postfix # +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # Monitor postfix # diff --git a/cookbooks/datadog/recipes/postgres.rb b/cookbooks/datadog/recipes/postgres.rb index 123f34d0..550cdb15 100644 --- a/cookbooks/datadog/recipes/postgres.rb +++ b/cookbooks/datadog/recipes/postgres.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Build a data structure with configuration. diff --git a/cookbooks/datadog/recipes/process.rb b/cookbooks/datadog/recipes/process.rb index 64974a22..1c7363c8 100644 --- a/cookbooks/datadog/recipes/process.rb +++ b/cookbooks/datadog/recipes/process.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor processes diff --git a/cookbooks/datadog/recipes/proxysql.rb b/cookbooks/datadog/recipes/proxysql.rb index 30442c11..75552fc7 100644 --- a/cookbooks/datadog/recipes/proxysql.rb +++ b/cookbooks/datadog/recipes/proxysql.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor ProxySQL diff --git a/cookbooks/datadog/recipes/rabbitmq.rb b/cookbooks/datadog/recipes/rabbitmq.rb index 4bdcb7de..b357e869 100644 --- a/cookbooks/datadog/recipes/rabbitmq.rb +++ b/cookbooks/datadog/recipes/rabbitmq.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Integrate rabbitmq metrics into Datadog diff --git a/cookbooks/datadog/recipes/redisdb.rb b/cookbooks/datadog/recipes/redisdb.rb index 0ddd4dcb..926b420c 100644 --- a/cookbooks/datadog/recipes/redisdb.rb +++ b/cookbooks/datadog/recipes/redisdb.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Build a data structure with configuration. diff --git a/cookbooks/datadog/recipes/remove-dd-agent.rb b/cookbooks/datadog/recipes/remove-dd-agent.rb index 4e7755c8..3eacb6e5 100644 --- a/cookbooks/datadog/recipes/remove-dd-agent.rb +++ b/cookbooks/datadog/recipes/remove-dd-agent.rb @@ -1,13 +1,52 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Run this recipe to completely remove the Datadog Agent # On Windows, this recipe works only with Chef >= 12.6 +# Importing apt_sources_list_file variable from recipe_helpers.rb +apt_sources_list_file = Chef::Datadog.apt_sources_list_file + case node['os'] when 'linux' + # First remove the datadog-agent package package 'datadog-agent' do action :purge end + + # Then remove the installation files (depending on the OS: sources_list file, datadog-signing-keys package...) + case node['platform_family'] + when 'amazon', 'rhel', 'fedora' # 'rhel' includes redhat, centos, rocky, scientific and almalinux + yum_repository 'datadog' do + action :remove + end + when 'debian' # 'debian' includes debian and ubuntu + apt_package 'datadog-signing-keys' do + action :purge + end + file apt_sources_list_file do + action :delete + end + when 'suse' + zypper_repository 'datadog' do + action :remove + end + end + when 'windows' + # Remove the datadog-agent package (no need to remove other files as for Linux) package 'Datadog Agent' do action :remove end diff --git a/cookbooks/datadog/recipes/repository.rb b/cookbooks/datadog/recipes/repository.rb index d33c8481..edd1df80 100644 --- a/cookbooks/datadog/recipes/repository.rb +++ b/cookbooks/datadog/recipes/repository.rb @@ -1,7 +1,8 @@ # # Cookbook:: datadog # Recipe:: repository -# Copyright:: 2013-2015, Datadog +# +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -29,22 +30,27 @@ # DATADOG_APT_KEY_CURRENT always contains the key that is used to sign repodata and latest packages # A2923DFF56EDA6E76E55E492D3A80E30382E94DE expires in 2022 # D75CEA17048B9ACBF186794B32637D44F14F620E expires in 2032 +# 5F1E256061D813B125E156E8E6266D4AC0962C7D expires in 2028 apt_gpg_keys = { 'DATADOG_APT_KEY_CURRENT.public' => 'https://keys.datadoghq.com/DATADOG_APT_KEY_CURRENT.public', + '5F1E256061D813B125E156E8E6266D4AC0962C7D' => 'https://keys.datadoghq.com/DATADOG_APT_KEY_C0962C7D.public', 'D75CEA17048B9ACBF186794B32637D44F14F620E' => 'https://keys.datadoghq.com/DATADOG_APT_KEY_F14F620E.public', 'A2923DFF56EDA6E76E55E492D3A80E30382E94DE' => 'https://keys.datadoghq.com/DATADOG_APT_KEY_382E94DE.public', } apt_trusted_d_keyring = '/etc/apt/trusted.gpg.d/datadog-archive-keyring.gpg' apt_usr_share_keyring = '/usr/share/keyrings/datadog-archive-keyring.gpg' -apt_sources_list_file = '/etc/apt/sources.list.d/datadog.list' +# Importing apt_sources_list_file variable from recipe_helpers.rb +apt_sources_list_file = Chef::Datadog.apt_sources_list_file apt_repo_uri = 'https://apt.datadoghq.com' # DATADOG_RPM_KEY_CURRENT always contains the key that is used to sign repodata and latest packages # DATADOG_RPM_KEY_E09422B3.public expires in 2022 # DATADOG_RPM_KEY_FD4BF915.public expires in 2024 +# DATADOG_RPM_KEY_B01082D3.public expires in 2028 rpm_gpg_keys = [['DATADOG_RPM_KEY_CURRENT.public', 'current', ''], - ['DATADOG_RPM_KEY_E09422B3.public', 'e09422b3', 'A4C0 B90D 7443 CF6E 4E8A A341 F106 8E14 E094 22B3'], - ['DATADOG_RPM_KEY_FD4BF915.public', 'fd4bf915', 'C655 9B69 0CA8 82F0 23BD F3F6 3F4D 1729 FD4B F915']] + ['DATADOG_RPM_KEY_B01082D3.public', 'b01082d3', '7408 BFD5 6BC5 BF0C 361A AAE8 5D88 EEA3 B010 82D3'], + ['DATADOG_RPM_KEY_FD4BF915.public', 'fd4bf915', 'C655 9B69 0CA8 82F0 23BD F3F6 3F4D 1729 FD4B F915'], + ['DATADOG_RPM_KEY_E09422B3.public', 'e09422b3', 'A4C0 B90D 7443 CF6E 4E8A A341 F106 8E14 E094 22B3']] # Local file name of the key rpm_gpg_keys_name = 0 @@ -53,6 +59,25 @@ # Space delimited full fingerprint rpm_gpg_keys_full_fingerprint = 2 +# This method deletes an RPM GPG key if it is installed +def remove_rpm_gpg_key(rpm_gpg_key_full_fingerprint) + execute "rpm-remove old gpg key #{rpm_gpg_key_full_fingerprint}" do + command "rpm --erase gpg-pubkey-#{rpm_gpg_key_full_fingerprint}" + only_if "rpm -q gpg-pubkey-#{rpm_gpg_key_full_fingerprint}" + action :run + end +end + +def warn_deprecated_yumrepo_gpgkey + log 'yum deprecated parameters warning' do + level :warn + message 'Attribute "yumrepo_gpgkey" is deprecated since version 4.16.0' + only_if { + !node['datadog']['yumrepo_gpgkey'].nil? + } + end +end + case node['platform_family'] when 'debian' log 'apt deprecated parameters warning' do @@ -63,7 +88,9 @@ } end - apt_update 'update' + apt_update 'update' do + ignore_failure true + end package 'install-apt-transport-https' do package_name 'apt-transport-https' @@ -147,19 +174,18 @@ end # Previous versions of the cookbook could create these repo files, make sure we remove it now - apt_repository 'datadog-beta' do - action :remove - end - - apt_repository 'datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE' do - action :remove - end - - apt_repository 'datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E' do - action :remove + ['datadog-beta', + 'datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E', + 'datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE'].each do |repo| + apt_repository repo do + action :remove + end end when 'rhel', 'fedora', 'amazon' + # The yumrepo_gpgkey parameter was removed because the DATADOG_RPM_KEY.public (4172a230) is not used anymore + warn_deprecated_yumrepo_gpgkey() + # gnupg is required to check the downloaded key's fingerprint package 'gnupg' do action :install @@ -192,6 +218,9 @@ end end + # The DATADOG_RPM_KEY.public (4172a230) is not used anymore, it should be deleted if present + remove_rpm_gpg_key('4172a230-55dd14f6') + # When the user has set yumrepo_repo_gpgcheck explicitly, we respect that. # Otherwise, we turn on repo_gpgcheck by default when both: # * We're not running on RHEL/CentOS 5 or older @@ -232,9 +261,6 @@ yumrepo_gpgkeys.push(node['datadog']["yumrepo_gpgkey_new_#{rpm_gpg_key[rpm_gpg_keys_short_fingerprint]}"]) end end - # yum/dnf go through entries in the order in which they're set in the repofile; - # add the old key last so it doesn't get imported at all if a newer key can be used - yumrepo_gpgkeys.push(node['datadog']['yumrepo_gpgkey']) if agent_major_version < 7 yum_repository 'datadog' do description 'datadog' @@ -248,6 +274,9 @@ action :create end when 'suse' + # The yumrepo_gpgkey parameter was removed because the DATADOG_RPM_KEY.public (4172a230) is not used anymore + warn_deprecated_yumrepo_gpgkey() + # Import new RPM key rpm_gpg_keys.each do |rpm_gpg_key| next unless node['datadog']["yumrepo_gpgkey_new_#{rpm_gpg_key[rpm_gpg_keys_short_fingerprint]}"] @@ -272,21 +301,8 @@ end end - # Now the old key is mostly hard-coded - old_key_local_path = ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY.public') - remote_file 'DATADOG_RPM_KEY.public' do - path old_key_local_path - source node['datadog']['yumrepo_gpgkey'] - not_if 'rpm -q gpg-pubkey-4172a230' # (key already imported) - notifies :run, 'execute[rpm-import datadog key 4172a230]', :immediately - end - - # Import key if fingerprint matches - execute 'rpm-import datadog key 4172a230' do - command "rpm --import #{old_key_local_path}" - only_if "gpg --dry-run --quiet --with-fingerprint #{old_key_local_path} | grep '60A3 89A4 4A0C 32BA E3C0 3F0B 069B 56F5 4172 A230' || gpg --dry-run --import --import-options import-show #{old_key_local_path} | grep '60A389A44A0C32BAE3C03F0B069B56F54172A230'" - action :nothing - end + # The DATADOG_RPM_KEY.public (4172a230) is not used anymore, it should be deleted if present + remove_rpm_gpg_key('4172a230-55dd14f6') if !node['datadog']['yumrepo_suse'].nil? baseurl = node['datadog']['yumrepo_suse'] @@ -305,7 +321,7 @@ zypper_repository 'datadog' do description 'datadog' baseurl baseurl - gpgkey agent_major_version < 6 ? node['datadog']['yumrepo_gpgkey'] : node['datadog']['yumrepo_gpgkey_new_current'] + gpgkey node['datadog']['yumrepo_gpgkey_new_current'] gpgautoimportkeys false gpgcheck false # zypper has no repo_gpgcheck option, but it does repodata signature checks diff --git a/cookbooks/datadog/recipes/rethinkdb.rb b/cookbooks/datadog/recipes/rethinkdb.rb index 32343507..ad9253cb 100644 --- a/cookbooks/datadog/recipes/rethinkdb.rb +++ b/cookbooks/datadog/recipes/rethinkdb.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor RethinkDB diff --git a/cookbooks/datadog/recipes/riak.rb b/cookbooks/datadog/recipes/riak.rb index 518d57b0..970c158f 100644 --- a/cookbooks/datadog/recipes/riak.rb +++ b/cookbooks/datadog/recipes/riak.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Riak diff --git a/cookbooks/datadog/recipes/security-agent.rb b/cookbooks/datadog/recipes/security-agent.rb new file mode 100644 index 00000000..0e58ff05 --- /dev/null +++ b/cookbooks/datadog/recipes/security-agent.rb @@ -0,0 +1,78 @@ +# +# Cookbook:: datadog +# Recipe:: security-agent +# +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. +# + +is_windows = platform_family?('windows') + +# Set the correct agent startup action +security_agent_enabled = !is_windows && node['datadog']['security_agent']['cws']['enabled'] || node['datadog']['security_agent']['cspm']['enabled'] + +# +# Configures security-agent agent +security_agent_config_file = '/etc/datadog-agent/security-agent.yaml' +security_agent_config_file_exists = ::File.exist?(security_agent_config_file) + +template security_agent_config_file do + runtime_security_extra_config = {} + if node['datadog']['extra_config'] && node['datadog']['extra_config']['security_agent'] && node['datadog']['extra_config']['security_agent']['runtime_security_config'] + node['datadog']['extra_config']['security_agent']['runtime_security_config'].each do |k, v| + next if v.nil? + runtime_security_extra_config[k] = v + end + end + + compliance_extra_config = {} + if node['datadog']['extra_config'] && node['datadog']['extra_config']['security_agent'] && node['datadog']['extra_config']['security_agent']['compliance_config'] + node['datadog']['extra_config']['security_agent']['compliance_config'].each do |k, v| + next if v.nil? + compliance_extra_config[k] = v + end + end + + source 'security-agent.yaml.erb' + variables( + runtime_security_enabled: node['datadog']['security_agent']['cws']['enabled'], + runtime_security_extra_config: runtime_security_extra_config, + compliance_enabled: node['datadog']['security_agent']['cspm']['enabled'], + compliance_extra_config: compliance_extra_config + ) + + owner 'root' + group 'dd-agent' + mode '640' + + notifies :restart, 'service[datadog-agent-security]', :delayed if security_agent_enabled + + # Security agent is not enabled and the file doesn't exists, don't create it + not_if { !security_agent_enabled && !security_agent_config_file_exists } +end + +# Common configuration +service_provider = Chef::Datadog.service_provider(node) + +service_name = 'datadog-agent-security' + +if security_agent_enabled + service 'datadog-agent-security' do + service_name service_name + action :start + provider service_provider unless service_provider.nil? + supports :restart => true, :status => true, :start => true, :stop => true + subscribes :restart, "template[#{security_agent_config_file}]", :delayed + end +end \ No newline at end of file diff --git a/cookbooks/datadog/recipes/sidekiq.rb b/cookbooks/datadog/recipes/sidekiq.rb index ef119cea..1638a262 100644 --- a/cookbooks/datadog/recipes/sidekiq.rb +++ b/cookbooks/datadog/recipes/sidekiq.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Sidekiq diff --git a/cookbooks/datadog/recipes/snmp.rb b/cookbooks/datadog/recipes/snmp.rb index c9aaa8f9..c4edc659 100644 --- a/cookbooks/datadog/recipes/snmp.rb +++ b/cookbooks/datadog/recipes/snmp.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # see example configuration file here: diff --git a/cookbooks/datadog/recipes/solr.rb b/cookbooks/datadog/recipes/solr.rb index b206360e..1f145049 100644 --- a/cookbooks/datadog/recipes/solr.rb +++ b/cookbooks/datadog/recipes/solr.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor solr diff --git a/cookbooks/datadog/recipes/spark.rb b/cookbooks/datadog/recipes/spark.rb index c18af6c7..bf9b7aab 100644 --- a/cookbooks/datadog/recipes/spark.rb +++ b/cookbooks/datadog/recipes/spark.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Spark diff --git a/cookbooks/datadog/recipes/sqlserver.rb b/cookbooks/datadog/recipes/sqlserver.rb index 9352e16a..d8c767bd 100644 --- a/cookbooks/datadog/recipes/sqlserver.rb +++ b/cookbooks/datadog/recipes/sqlserver.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # see example configuration file here: diff --git a/cookbooks/datadog/recipes/squid.rb b/cookbooks/datadog/recipes/squid.rb index 21f3a7e1..f43f7272 100644 --- a/cookbooks/datadog/recipes/squid.rb +++ b/cookbooks/datadog/recipes/squid.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Squid diff --git a/cookbooks/datadog/recipes/ssh_check.rb b/cookbooks/datadog/recipes/ssh_check.rb index f11bfe71..c1c5a473 100644 --- a/cookbooks/datadog/recipes/ssh_check.rb +++ b/cookbooks/datadog/recipes/ssh_check.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor SSH connectivity @@ -6,7 +20,7 @@ # up the following attributes at some point in your Chef run, in either a role # or another cookbook. # -# node['datadog']['ssh_check']['instances'] = [ +# node.default['datadog']['ssh_check']['instances'] = [ # { # 'host' => '1.2.3.4', # required for each instance # 'username' => 'user', # required for each instance @@ -15,6 +29,7 @@ # 'sftp_check' => true, # optional, defaults to true # 'private_key_file' => '/path/to/key', # optional # 'add_missing_keys' => false, # optional, defaults to false +# 'min_collection_interval' => 300, # optional, defaults to 15 # 'tags' => [node.chef_environment] # optional # } # ] diff --git a/cookbooks/datadog/recipes/statsd.rb b/cookbooks/datadog/recipes/statsd.rb index 5efbd6a2..06a1e820 100644 --- a/cookbooks/datadog/recipes/statsd.rb +++ b/cookbooks/datadog/recipes/statsd.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor StatsD diff --git a/cookbooks/datadog/recipes/supervisord.rb b/cookbooks/datadog/recipes/supervisord.rb index ace7b729..d27c19fd 100644 --- a/cookbooks/datadog/recipes/supervisord.rb +++ b/cookbooks/datadog/recipes/supervisord.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: supervisord # -# Copyright:: 2011-2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/system-probe.rb b/cookbooks/datadog/recipes/system-probe.rb index 3477480d..91aa2522 100644 --- a/cookbooks/datadog/recipes/system-probe.rb +++ b/cookbooks/datadog/recipes/system-probe.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: system-probe # -# Copyright:: 2011-2019, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -20,12 +20,13 @@ is_windows = platform_family?('windows') # Set the correct agent startup action +cws_enabled = node['datadog']['security_agent']['cws']['enabled'] sysprobe_enabled = if is_windows node['datadog']['system_probe']['network_enabled'] else - node['datadog']['system_probe']['enabled'] || node['datadog']['system_probe']['network_enabled'] + node['datadog']['system_probe']['enabled'] || node['datadog']['system_probe']['network_enabled'] || node['datadog']['system_probe']['service_monitoring_enabled'] || cws_enabled end -sysprobe_agent_start = sysprobe_enabled ? :start : :stop +sysprobe_agent_start = sysprobe_enabled && node['datadog']['agent_start'] && node['datadog']['agent_enable'] ? :start : :stop # # Configures system-probe agent @@ -47,6 +48,14 @@ end end + runtime_security_extra_config = {} + if node['datadog']['extra_config'] && node['datadog']['extra_config']['security_agent'] && node['datadog']['extra_config']['security_agent']['runtime_security_config'] + node['datadog']['extra_config']['security_agent']['runtime_security_config'].each do |k, v| + next if v.nil? + runtime_security_extra_config[k] = v + end + end + source 'system_probe.yaml.erb' variables( enabled: node['datadog']['system_probe']['enabled'], @@ -54,14 +63,12 @@ debug_port: node['datadog']['system_probe']['debug_port'], bpf_debug: node['datadog']['system_probe']['bpf_debug'], enable_conntrack: node['datadog']['system_probe']['enable_conntrack'], - extra_config: extra_config + system_probe_extra_config: extra_config, + runtime_security_enabled: cws_enabled, + runtime_security_extra_config: runtime_security_extra_config ) - if is_windows - owner 'Administrators' - rights :full_control, 'Administrators' - inherits false - else + unless is_windows owner 'root' group 'dd-agent' mode '640' @@ -70,6 +77,7 @@ notifies :restart, 'service[datadog-agent-sysprobe]', :delayed if sysprobe_enabled # since process-agent collects network info through system-probe, enabling system-probe should also restart process-agent notifies :restart, 'service[datadog-agent]', :delayed if sysprobe_enabled + notifies :restart, 'service[datadog-agent-security]', :delayed if cws_enabled # System probe is not enabled and the file doesn't exists, don't create it not_if { !sysprobe_enabled && !system_probe_config_file_exists } diff --git a/cookbooks/datadog/recipes/system_core.rb b/cookbooks/datadog/recipes/system_core.rb index 8d921090..602e2b38 100644 --- a/cookbooks/datadog/recipes/system_core.rb +++ b/cookbooks/datadog/recipes/system_core.rb @@ -2,7 +2,7 @@ # Cookbook:: datadog # Recipe:: system_core # -# Copyright:: 2015, Datadog +# Copyright:: 2011-Present, Datadog # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. diff --git a/cookbooks/datadog/recipes/system_swap.rb b/cookbooks/datadog/recipes/system_swap.rb index 2497372b..60c91778 100644 --- a/cookbooks/datadog/recipes/system_swap.rb +++ b/cookbooks/datadog/recipes/system_swap.rb @@ -2,6 +2,20 @@ # Cookbook:: datadog # Recipe:: system_swap # +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' datadog_monitor 'system_swap' diff --git a/cookbooks/datadog/recipes/systemd.rb b/cookbooks/datadog/recipes/systemd.rb index b137af54..c0148f56 100644 --- a/cookbooks/datadog/recipes/systemd.rb +++ b/cookbooks/datadog/recipes/systemd.rb @@ -1,13 +1,28 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Systemd -# +# It works for all unit types like targets, services, sockets, devices, mounts, automounts, swaps, paths, timers, snapshots, slices, scopes, busnames # node.default['datadog']['systemd']['instances'] = [ # { # 'unit_names' => [ # 'myservice1.service', # 'myservice2.service', -# 'mysocket.socket' +# 'mysocket.socket', +# 'mytimer.timer' # ], # 'substate_status_mapping' => [ # 'services' => [ @@ -28,6 +43,12 @@ # 'running' => 'ok', # 'exited' => 'critical' # } +# ], +# 'timers' => [ +# 'mytimer' => { +# 'running' => 'ok', +# 'exited' => 'critical' +# } # ] # ], # 'tags' => [ diff --git a/cookbooks/datadog/recipes/tcp_check.rb b/cookbooks/datadog/recipes/tcp_check.rb index df1f0e47..c19a52c4 100644 --- a/cookbooks/datadog/recipes/tcp_check.rb +++ b/cookbooks/datadog/recipes/tcp_check.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor tcp diff --git a/cookbooks/datadog/recipes/teamcity.rb b/cookbooks/datadog/recipes/teamcity.rb index 80e7a645..1e4f4b02 100644 --- a/cookbooks/datadog/recipes/teamcity.rb +++ b/cookbooks/datadog/recipes/teamcity.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Teamcity diff --git a/cookbooks/datadog/recipes/tenable.rb b/cookbooks/datadog/recipes/tenable.rb index 9b66a67e..6cebf5a3 100644 --- a/cookbooks/datadog/recipes/tenable.rb +++ b/cookbooks/datadog/recipes/tenable.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Tenable diff --git a/cookbooks/datadog/recipes/tls.rb b/cookbooks/datadog/recipes/tls.rb index 28635ea1..2e8245b7 100644 --- a/cookbooks/datadog/recipes/tls.rb +++ b/cookbooks/datadog/recipes/tls.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor TLS diff --git a/cookbooks/datadog/recipes/tokumx.rb b/cookbooks/datadog/recipes/tokumx.rb index d9841afa..264db6f9 100644 --- a/cookbooks/datadog/recipes/tokumx.rb +++ b/cookbooks/datadog/recipes/tokumx.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor tokumx diff --git a/cookbooks/datadog/recipes/tomcat.rb b/cookbooks/datadog/recipes/tomcat.rb index f7b39516..4898cfdf 100644 --- a/cookbooks/datadog/recipes/tomcat.rb +++ b/cookbooks/datadog/recipes/tomcat.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor tomcat diff --git a/cookbooks/datadog/recipes/twistlock.rb b/cookbooks/datadog/recipes/twistlock.rb index 5e9c2076..1f6bfd6e 100644 --- a/cookbooks/datadog/recipes/twistlock.rb +++ b/cookbooks/datadog/recipes/twistlock.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Twistlock diff --git a/cookbooks/datadog/recipes/varnish.rb b/cookbooks/datadog/recipes/varnish.rb index 062f37b3..78a698c4 100644 --- a/cookbooks/datadog/recipes/varnish.rb +++ b/cookbooks/datadog/recipes/varnish.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Varnish diff --git a/cookbooks/datadog/recipes/vault.rb b/cookbooks/datadog/recipes/vault.rb index f54792f6..57dbd158 100644 --- a/cookbooks/datadog/recipes/vault.rb +++ b/cookbooks/datadog/recipes/vault.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor vault diff --git a/cookbooks/datadog/recipes/vertica.rb b/cookbooks/datadog/recipes/vertica.rb index 061bd45a..51b0cf3f 100644 --- a/cookbooks/datadog/recipes/vertica.rb +++ b/cookbooks/datadog/recipes/vertica.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Vertica diff --git a/cookbooks/datadog/recipes/vsphere.rb b/cookbooks/datadog/recipes/vsphere.rb index 727da6ea..b71f73f6 100644 --- a/cookbooks/datadog/recipes/vsphere.rb +++ b/cookbooks/datadog/recipes/vsphere.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor vSphere diff --git a/cookbooks/datadog/recipes/weblogic.rb b/cookbooks/datadog/recipes/weblogic.rb new file mode 100644 index 00000000..4ea153f7 --- /dev/null +++ b/cookbooks/datadog/recipes/weblogic.rb @@ -0,0 +1,44 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +include_recipe '::dd-agent' + +# Monitor weblogic +# +# Assuming you have 2 instances "test" and "prod", +# one with and one without authentication +# you need to set up the following attributes +# node.datadog.weblogic.instances = [ +# { +# :host => "localhost", +# :port => "9090", +# :name => "prod", +# :username => "username", +# :password => "secret" +# }, +# { +# :host => "localhost", +# :port => "9091", +# :name => "test" +# } +# ] + +datadog_monitor 'weblogic' do + init_config node['datadog']['weblogic']['init_config'] + instances node['datadog']['weblogic']['instances'] + logs node['datadog']['weblogic']['logs'] + use_integration_template true + action :add + notifies :restart, 'service[datadog-agent]' if node['datadog']['agent_start'] +end diff --git a/cookbooks/datadog/recipes/win32_event_log.rb b/cookbooks/datadog/recipes/win32_event_log.rb index f67719a6..846c935f 100644 --- a/cookbooks/datadog/recipes/win32_event_log.rb +++ b/cookbooks/datadog/recipes/win32_event_log.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor the Windows Event Log diff --git a/cookbooks/datadog/recipes/windows_service.rb b/cookbooks/datadog/recipes/windows_service.rb index 085e3f13..ad9e9a71 100644 --- a/cookbooks/datadog/recipes/windows_service.rb +++ b/cookbooks/datadog/recipes/windows_service.rb @@ -2,6 +2,19 @@ # Cookbook:: datadog # Recipe:: windows_service # +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # Example windows_service.yaml file: # diff --git a/cookbooks/datadog/recipes/wmi_check.rb b/cookbooks/datadog/recipes/wmi_check.rb index c9d9ac4a..64dfd582 100644 --- a/cookbooks/datadog/recipes/wmi_check.rb +++ b/cookbooks/datadog/recipes/wmi_check.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # see example configuration file here: diff --git a/cookbooks/datadog/recipes/yarn.rb b/cookbooks/datadog/recipes/yarn.rb index 49c67b49..2161d8c3 100644 --- a/cookbooks/datadog/recipes/yarn.rb +++ b/cookbooks/datadog/recipes/yarn.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + include_recipe '::dd-agent' # Monitor Yarn diff --git a/cookbooks/datadog/recipes/zookeeper.rb b/cookbooks/datadog/recipes/zookeeper.rb index 8516cdfb..637e32e5 100644 --- a/cookbooks/datadog/recipes/zookeeper.rb +++ b/cookbooks/datadog/recipes/zookeeper.rb @@ -2,6 +2,19 @@ # Cookbook:: datadog # Recipe:: zookeeper # +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. include_recipe '::dd-agent' diff --git a/cookbooks/datadog/resources/integration.rb b/cookbooks/datadog/resources/integration.rb index 25b16d04..6747c8cf 100644 --- a/cookbooks/datadog/resources/integration.rb +++ b/cookbooks/datadog/resources/integration.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Install/remove a Datadog integration # This resource basically wraps the datadog-agent integration command to be able # to install and remove integrations from a Chef recipe. diff --git a/cookbooks/datadog/resources/monitor.rb b/cookbooks/datadog/resources/monitor.rb index 244580c3..2c930126 100644 --- a/cookbooks/datadog/resources/monitor.rb +++ b/cookbooks/datadog/resources/monitor.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + # Configure a service via its yaml file # enable unified mode on specific Chef versions. @@ -19,6 +33,7 @@ property :instances, Array, required: false, default: [] property :version, [Integer, nil], required: false, default: nil property :use_integration_template, [TrueClass, FalseClass], required: false, default: false +property :is_jmx, [TrueClass, FalseClass], required: false, default: false property :logs, [Array, nil], required: false, default: [] action :add do @@ -60,8 +75,14 @@ source "#{new_resource.name}.yaml.erb" end + init_config = new_resource.init_config + if new_resource.is_jmx + init_config ||= {} + init_config = init_config.merge({ 'is_jmx' => true, 'collect_default_metrics' => true }) + end + variables( - init_config: new_resource.init_config, + init_config: init_config, instances: new_resource.instances, version: new_resource.version, logs: new_resource.logs diff --git a/cookbooks/datadog/spec/dd-agent_spec.rb b/cookbooks/datadog/spec/dd-agent_spec.rb index 6d0d97a2..ecea6113 100644 --- a/cookbooks/datadog/spec/dd-agent_spec.rb +++ b/cookbooks/datadog/spec/dd-agent_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'spec_helper' require 'digest' @@ -134,6 +148,36 @@ def set_env_var(name, value) it_behaves_like 'rhellions dnf no version set' end + context 'on AlmaLinux distro', if: min_chef_version('17.0.69') do + cached(:chef_run) do + ChefSpec::SoloRunner.new( + :platform => 'almalinux', + :version => '8' + ) do |node| + node.normal['datadog'] = { 'api_key' => 'somethingnotnil' } + node.normal['languages'] = { 'python' => { 'version' => '2.7.9' } } + end.converge described_recipe + end + + it_behaves_like 'repo recipe' + it_behaves_like 'rhellions dnf no version set' + end + + context 'on Rocky Linux distro', if: min_chef_version('17.1.35') do + cached(:chef_run) do + ChefSpec::SoloRunner.new( + :platform => 'rocky', + :version => '8' + ) do |node| + node.normal['datadog'] = { 'api_key' => 'somethingnotnil' } + node.normal['languages'] = { 'python' => { 'version' => '2.7.9' } } + end.converge described_recipe + end + + it_behaves_like 'repo recipe' + it_behaves_like 'rhellions dnf no version set' + end + context 'on Windows' do cached(:chef_run) do set_env_var('ProgramData', 'C:\ProgramData') @@ -1416,7 +1460,11 @@ def set_env_var(name, value) end.converge described_recipe end it 'installs the full version' do - expect(chef_run).to install_dnf_package('datadog-agent').with_version('6.16.0-1') + if Chef::Datadog.chef_version_ge? 14 + expect(chef_run).to install_dnf_package('datadog-agent').with_version('1:6.16.0-1') + else + expect(chef_run).to install_dnf_package('datadog-agent').with_version('6.16.0-1') + end end end end diff --git a/cookbooks/datadog/spec/dd-handler_spec.rb b/cookbooks/datadog/spec/dd-handler_spec.rb index 23738894..70367641 100644 --- a/cookbooks/datadog/spec/dd-handler_spec.rb +++ b/cookbooks/datadog/spec/dd-handler_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'spec_helper' shared_examples 'a chef-handler-datadog installer' do |version| diff --git a/cookbooks/datadog/spec/default_spec.rb b/cookbooks/datadog/spec/default_spec.rb index f1148650..73dbeab0 100644 --- a/cookbooks/datadog/spec/default_spec.rb +++ b/cookbooks/datadog/spec/default_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'spec_helper' describe 'datadog::default' do diff --git a/cookbooks/datadog/spec/integrations/activemq_spec.rb b/cookbooks/datadog/spec/integrations/activemq_spec.rb index 22acdfbc..3fb4d5c8 100644 --- a/cookbooks/datadog/spec/integrations/activemq_spec.rb +++ b/cookbooks/datadog/spec/integrations/activemq_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::activemq' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/cassandra_spec.rb b/cookbooks/datadog/spec/integrations/cassandra_spec.rb index c5c5e38b..b9ec78af 100644 --- a/cookbooks/datadog/spec/integrations/cassandra_spec.rb +++ b/cookbooks/datadog/spec/integrations/cassandra_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::cassandra' do context 'version 1 (default)' do expected_yaml = <<-EOF diff --git a/cookbooks/datadog/spec/integrations/couchbase_spec.rb b/cookbooks/datadog/spec/integrations/couchbase_spec.rb index 880dc136..505d1d79 100644 --- a/cookbooks/datadog/spec/integrations/couchbase_spec.rb +++ b/cookbooks/datadog/spec/integrations/couchbase_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::couchbase' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/directory_spec.rb b/cookbooks/datadog/spec/integrations/directory_spec.rb index dc7af6ba..105ff1ba 100644 --- a/cookbooks/datadog/spec/integrations/directory_spec.rb +++ b/cookbooks/datadog/spec/integrations/directory_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::directory' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/disk_spec.rb b/cookbooks/datadog/spec/integrations/disk_spec.rb index a532020c..c508f76e 100644 --- a/cookbooks/datadog/spec/integrations/disk_spec.rb +++ b/cookbooks/datadog/spec/integrations/disk_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::disk' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/dns_check_spec.rb b/cookbooks/datadog/spec/integrations/dns_check_spec.rb index a4ad4295..01e0c4f4 100644 --- a/cookbooks/datadog/spec/integrations/dns_check_spec.rb +++ b/cookbooks/datadog/spec/integrations/dns_check_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::dns_check' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/docker_daemon_spec.rb b/cookbooks/datadog/spec/integrations/docker_daemon_spec.rb index aaeeb4a4..a4c21218 100644 --- a/cookbooks/datadog/spec/integrations/docker_daemon_spec.rb +++ b/cookbooks/datadog/spec/integrations/docker_daemon_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::docker_daemon' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/elasticsearch_spec.rb b/cookbooks/datadog/spec/integrations/elasticsearch_spec.rb index bb554741..e88af43b 100644 --- a/cookbooks/datadog/spec/integrations/elasticsearch_spec.rb +++ b/cookbooks/datadog/spec/integrations/elasticsearch_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::elasticsearch' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/etcd_spec.rb b/cookbooks/datadog/spec/integrations/etcd_spec.rb index 7f50f937..7ccef1b6 100644 --- a/cookbooks/datadog/spec/integrations/etcd_spec.rb +++ b/cookbooks/datadog/spec/integrations/etcd_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::etcd' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/gearmand_spec.rb b/cookbooks/datadog/spec/integrations/gearmand_spec.rb new file mode 100644 index 00000000..1e0c2654 --- /dev/null +++ b/cookbooks/datadog/spec/integrations/gearmand_spec.rb @@ -0,0 +1,96 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +describe 'datadog::gearmand' do + expected_yaml = <<-EOF + logs: + + instances: + - server: 127.0.0.1 + port: 4730 + tasks: + - TASK_1 + - TASK_2 + tags: + - : + - : + service: + min_collection_interval: 60 + empty_default_hostname: true + metric_patterns: + include: + - + exclude: + - + + init_config: + # No init_config details needed + EOF + + cached(:chef_run) do + ChefSpec::SoloRunner.new( + platform: 'ubuntu', + version: '16.04', + step_into: ['datadog_monitor'] + ) do |node| + node.automatic['languages'] = { 'python' => { 'version' => '2.7.2' } } + node.normal['datadog'] = { + api_key: 'someapikey', + gearmand: { + instances: [ + { + server: '127.0.0.1', + port: '4730', + tasks: [ + 'TASK_1', + 'TASK_2', + ], + tags: [ + ':', + ':' + ], + service: '', + # Defaults to 15 if not set + min_collection_interval: 60, + # Defaults to false if not set + empty_default_hostname: true, + metric_patterns: { + include: [ + '' + ], + exclude: [ + '' + ] + } + } + ] + } + } + end.converge(described_recipe) + end + + subject { chef_run } + + it_behaves_like 'datadog-agent' + + it { is_expected.to include_recipe('datadog::dd-agent') } + + it { is_expected.to add_datadog_monitor('gearmand') } + + it 'renders expected YAML config file' do + expect(chef_run).to(render_file('/etc/datadog-agent/conf.d/gearmand.d/conf.yaml').with_content { |content| + expect(YAML.safe_load(content).to_json).to be_json_eql(YAML.safe_load(expected_yaml).to_json) + }) + end +end diff --git a/cookbooks/datadog/spec/integrations/go-metro_spec.rb b/cookbooks/datadog/spec/integrations/go-metro_spec.rb index b98c9823..ae4278b4 100644 --- a/cookbooks/datadog/spec/integrations/go-metro_spec.rb +++ b/cookbooks/datadog/spec/integrations/go-metro_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::go-metro' do context 'with default init_config and libcap package on RHEL7' do expected_yaml = <<-EOF diff --git a/cookbooks/datadog/spec/integrations/go_expvar_spec.rb b/cookbooks/datadog/spec/integrations/go_expvar_spec.rb index 7669f12f..5177269d 100644 --- a/cookbooks/datadog/spec/integrations/go_expvar_spec.rb +++ b/cookbooks/datadog/spec/integrations/go_expvar_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::go_expvar' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/gunicorn_spec.rb b/cookbooks/datadog/spec/integrations/gunicorn_spec.rb index 00901523..3a3890be 100644 --- a/cookbooks/datadog/spec/integrations/gunicorn_spec.rb +++ b/cookbooks/datadog/spec/integrations/gunicorn_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::gunicorn' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/hive_spec.rb b/cookbooks/datadog/spec/integrations/hive_spec.rb new file mode 100644 index 00000000..4693d522 --- /dev/null +++ b/cookbooks/datadog/spec/integrations/hive_spec.rb @@ -0,0 +1,57 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +describe 'datadog::hive' do + expected_yaml = <<-EOF + logs: ~ + init_config: + is_jmx: true + collect_default_metrics: true + instances: + - host: localhost + EOF + + cached(:chef_run) do + ChefSpec::SoloRunner.new( + platform: 'ubuntu', + version: '16.04', + step_into: ['datadog_monitor'] + ) do |node| + node.normal['datadog'] = { + api_key: 'someapikey', + hive: { + instances: [ + { + host: 'localhost', + } + ] + } + } + end.converge(described_recipe) + end + + subject { chef_run } + + it_behaves_like 'datadog-agent' + + it { is_expected.to include_recipe('datadog::dd-agent') } + + it { is_expected.to add_datadog_monitor('hive') } + + it 'renders expected YAML config file' do + expect(chef_run).to(render_file('/etc/datadog-agent/conf.d/hive.d/conf.yaml').with_content { |content| + expect(YAML.safe_load(content).to_json).to be_json_eql(YAML.safe_load(expected_yaml).to_json) + }) + end +end diff --git a/cookbooks/datadog/spec/integrations/iis_spec.rb b/cookbooks/datadog/spec/integrations/iis_spec.rb index 7b77d74e..51a4dbcf 100644 --- a/cookbooks/datadog/spec/integrations/iis_spec.rb +++ b/cookbooks/datadog/spec/integrations/iis_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::iis' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/integration_spec.rb b/cookbooks/datadog/spec/integrations/integration_spec.rb index 3b223135..6f4bd768 100644 --- a/cookbooks/datadog/spec/integrations/integration_spec.rb +++ b/cookbooks/datadog/spec/integrations/integration_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'chefspec' require_relative '../../libraries/test_helpers' diff --git a/cookbooks/datadog/spec/integrations/integrations_spec.rb b/cookbooks/datadog/spec/integrations/integrations_spec.rb index d01c882e..9b83e04d 100644 --- a/cookbooks/datadog/spec/integrations/integrations_spec.rb +++ b/cookbooks/datadog/spec/integrations/integrations_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::integrations' do expected_yaml = <<-EOF instances: diff --git a/cookbooks/datadog/spec/integrations/jmx_spec.rb b/cookbooks/datadog/spec/integrations/jmx_spec.rb index 61a71a31..3bff6718 100644 --- a/cookbooks/datadog/spec/integrations/jmx_spec.rb +++ b/cookbooks/datadog/spec/integrations/jmx_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::jmx' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/kafka_consumer_spec.rb b/cookbooks/datadog/spec/integrations/kafka_consumer_spec.rb new file mode 100644 index 00000000..9e87d2c3 --- /dev/null +++ b/cookbooks/datadog/spec/integrations/kafka_consumer_spec.rb @@ -0,0 +1,77 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +describe 'datadog::kafka_consumer' do + expected_yaml = <<-EOF + logs: + + instances: + - kafka_connect_str: localhost:19092 + consumer_groups: + my_consumer: + my_topic: [0, 1, 4, 12] + monitor_unlisted_consumer_groups: false + zk_connect_str: localhost:2181 + zk_prefix: /0.8 + kafka_consumer_offsets: true + + init_config: + # The Kafka Consumer check does not require any init_config + EOF + + cached(:chef_run) do + ChefSpec::SoloRunner.new( + platform: 'ubuntu', + version: '16.04', + step_into: ['datadog_monitor'] + ) do |node| + node.automatic['languages'] = { python: { version: '2.7.2' } } + + node.normal['datadog'] = { + api_key: 'someapikey', + kafka_consumer: { + instances: [ + { + kafka_connect_str: 'localhost:19092', + consumer_groups: { + my_consumer: { + my_topic: [0, 1, 4, 12] + } + }, + monitor_unlisted_consumer_groups: false, + zk_connect_str: 'localhost:2181', + password: 'localhost:2181', + zk_prefix: '/0.8', + kafka_consumer_offsets: true + } + ] + } + } + end.converge(described_recipe) + end + + subject { chef_run } + + it_behaves_like 'datadog-agent' + + it { is_expected.to include_recipe('datadog::dd-agent') } + + it { is_expected.to add_datadog_monitor('kafka_consumer') } + + it 'renders expected YAML config file' do + expect(chef_run).to(render_file('/etc/datadog-agent/conf.d/kafka_consumer.d/conf.yaml').with_content { |content| + expect(YAML.safe_load(content).to_json).to be_json_eql(YAML.safe_load(expected_yaml).to_json) + }) + end +end diff --git a/cookbooks/datadog/spec/integrations/kafka_spec.rb b/cookbooks/datadog/spec/integrations/kafka_spec.rb index c65e1333..49990996 100644 --- a/cookbooks/datadog/spec/integrations/kafka_spec.rb +++ b/cookbooks/datadog/spec/integrations/kafka_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::kafka' do context 'version 1 (default)' do expected_yaml = <<-EOF diff --git a/cookbooks/datadog/spec/integrations/kubernetes_spec.rb b/cookbooks/datadog/spec/integrations/kubernetes_spec.rb index 3cdcb14b..59e839ac 100644 --- a/cookbooks/datadog/spec/integrations/kubernetes_spec.rb +++ b/cookbooks/datadog/spec/integrations/kubernetes_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::kubernetes' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/mesos_master_spec.rb b/cookbooks/datadog/spec/integrations/mesos_master_spec.rb index 18b72f29..6106b48e 100644 --- a/cookbooks/datadog/spec/integrations/mesos_master_spec.rb +++ b/cookbooks/datadog/spec/integrations/mesos_master_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::mesos_master' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/mesos_slave_spec.rb b/cookbooks/datadog/spec/integrations/mesos_slave_spec.rb index a86098fd..bc04fb15 100644 --- a/cookbooks/datadog/spec/integrations/mesos_slave_spec.rb +++ b/cookbooks/datadog/spec/integrations/mesos_slave_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::mesos_slave' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/mongo_spec.rb b/cookbooks/datadog/spec/integrations/mongo_spec.rb index ff2ffb26..e86b72fd 100644 --- a/cookbooks/datadog/spec/integrations/mongo_spec.rb +++ b/cookbooks/datadog/spec/integrations/mongo_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::mongo' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/nginx_spec.rb b/cookbooks/datadog/spec/integrations/nginx_spec.rb index 3c09907b..e4fd6a7a 100644 --- a/cookbooks/datadog/spec/integrations/nginx_spec.rb +++ b/cookbooks/datadog/spec/integrations/nginx_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::nginx' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/php_fpm_spec.rb b/cookbooks/datadog/spec/integrations/php_fpm_spec.rb index 07456994..3064b317 100644 --- a/cookbooks/datadog/spec/integrations/php_fpm_spec.rb +++ b/cookbooks/datadog/spec/integrations/php_fpm_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::php_fpm' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/postfix_spec.rb b/cookbooks/datadog/spec/integrations/postfix_spec.rb index 4578a426..fdf918f4 100644 --- a/cookbooks/datadog/spec/integrations/postfix_spec.rb +++ b/cookbooks/datadog/spec/integrations/postfix_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::postfix' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/postgres_spec.rb b/cookbooks/datadog/spec/integrations/postgres_spec.rb index c9d981df..bf55b51b 100644 --- a/cookbooks/datadog/spec/integrations/postgres_spec.rb +++ b/cookbooks/datadog/spec/integrations/postgres_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::postgres' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/rabbitmq_spec.rb b/cookbooks/datadog/spec/integrations/rabbitmq_spec.rb index d1d82ccc..04f2d7d6 100644 --- a/cookbooks/datadog/spec/integrations/rabbitmq_spec.rb +++ b/cookbooks/datadog/spec/integrations/rabbitmq_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::rabbitmq' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/redis_spec.rb b/cookbooks/datadog/spec/integrations/redis_spec.rb index 3800767e..402d8d94 100644 --- a/cookbooks/datadog/spec/integrations/redis_spec.rb +++ b/cookbooks/datadog/spec/integrations/redis_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::redisdb' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/snmp_spec.rb b/cookbooks/datadog/spec/integrations/snmp_spec.rb index 16439b79..bcba89e2 100644 --- a/cookbooks/datadog/spec/integrations/snmp_spec.rb +++ b/cookbooks/datadog/spec/integrations/snmp_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::snmp' do context 'config snmp v1 - v2' do expected_yaml = <<-EOF diff --git a/cookbooks/datadog/spec/integrations/solr_spec.rb b/cookbooks/datadog/spec/integrations/solr_spec.rb index 0918ec03..4dfa6a1f 100644 --- a/cookbooks/datadog/spec/integrations/solr_spec.rb +++ b/cookbooks/datadog/spec/integrations/solr_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::solr' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/sqlserver_spec.rb b/cookbooks/datadog/spec/integrations/sqlserver_spec.rb index 7432583c..8ea6b255 100644 --- a/cookbooks/datadog/spec/integrations/sqlserver_spec.rb +++ b/cookbooks/datadog/spec/integrations/sqlserver_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::sqlserver' do context 'config 1' do expected_yaml = <<-EOF diff --git a/cookbooks/datadog/spec/integrations/system_core_spec.rb b/cookbooks/datadog/spec/integrations/system_core_spec.rb index b6a89b28..b3e69c60 100644 --- a/cookbooks/datadog/spec/integrations/system_core_spec.rb +++ b/cookbooks/datadog/spec/integrations/system_core_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::system_core' do expected_yaml = <<-EOF # Generated by Chef, local modifications will be overwritten diff --git a/cookbooks/datadog/spec/integrations/system_swap_spec.rb b/cookbooks/datadog/spec/integrations/system_swap_spec.rb index b5a548bf..9c2113a7 100644 --- a/cookbooks/datadog/spec/integrations/system_swap_spec.rb +++ b/cookbooks/datadog/spec/integrations/system_swap_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::system_swap' do expected_yaml = <<-EOF # Generated by Chef, local modifications will be overwritten diff --git a/cookbooks/datadog/spec/integrations/systemd_spec.rb b/cookbooks/datadog/spec/integrations/systemd_spec.rb index a4d9f65c..e8a646d4 100644 --- a/cookbooks/datadog/spec/integrations/systemd_spec.rb +++ b/cookbooks/datadog/spec/integrations/systemd_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::systemd' do expected_yaml = <<-EOF init_config: ~ @@ -15,6 +29,9 @@ mysocket.socket: exited: critical running: ok + mytimer.timer: + exited: critical + running: ok tags: - 'mykey1:myvalue1' - 'mykey2:myvalue2' @@ -22,6 +39,7 @@ - myservice1.service - myservice2.service - mysocket.socket + - mytimer.timer logs: ~ EOF @@ -40,7 +58,8 @@ unit_names: [ 'myservice1.service', 'myservice2.service', - 'mysocket.socket' + 'mysocket.socket', + 'mytimer.timer' ], substate_status_mapping: [ services: [ @@ -61,6 +80,12 @@ running: 'ok', exited: 'critical' } + ], + timers: [ + mytimer: { + running: 'ok', + exited: 'critical' + } ] ], tags: [ diff --git a/cookbooks/datadog/spec/integrations/tokumx_spec.rb b/cookbooks/datadog/spec/integrations/tokumx_spec.rb index 3dd032f0..48f0d4e3 100644 --- a/cookbooks/datadog/spec/integrations/tokumx_spec.rb +++ b/cookbooks/datadog/spec/integrations/tokumx_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::tokumx' do expected_yaml = <<-EOF logs: ~ diff --git a/cookbooks/datadog/spec/integrations/win32_event_log_spec.rb b/cookbooks/datadog/spec/integrations/win32_event_log_spec.rb index de11706c..420298f1 100644 --- a/cookbooks/datadog/spec/integrations/win32_event_log_spec.rb +++ b/cookbooks/datadog/spec/integrations/win32_event_log_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::win32_event_log' do expected_yaml = <<-EOF init_config: diff --git a/cookbooks/datadog/spec/integrations/windows_service_spec.rb b/cookbooks/datadog/spec/integrations/windows_service_spec.rb index 08220bda..9a4a00b4 100644 --- a/cookbooks/datadog/spec/integrations/windows_service_spec.rb +++ b/cookbooks/datadog/spec/integrations/windows_service_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::windows_service' do expected_yaml = <<-EOF instances: diff --git a/cookbooks/datadog/spec/integrations/wmi_check_spec.rb b/cookbooks/datadog/spec/integrations/wmi_check_spec.rb index 0204352f..dd7328c0 100644 --- a/cookbooks/datadog/spec/integrations/wmi_check_spec.rb +++ b/cookbooks/datadog/spec/integrations/wmi_check_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + describe 'datadog::wmi_check' do context 'config wmi_check' do expected_yaml = <<-EOF diff --git a/cookbooks/datadog/spec/recipe_helpers_spec.rb b/cookbooks/datadog/spec/recipe_helpers_spec.rb index 98c8eee0..9b530c1b 100644 --- a/cookbooks/datadog/spec/recipe_helpers_spec.rb +++ b/cookbooks/datadog/spec/recipe_helpers_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'spec_helper' require_relative '../libraries/recipe_helpers' @@ -37,15 +51,13 @@ context 'when the agent is installed' do before do allow(Chef::Datadog::WindowsInstallHelpers) - .to receive(:agent_status) - .and_return(agent_status_string) + .to receive(:agent_get_version) + .and_return(agent_version_string) end - let(:agent_status_string) do + let(:agent_version_string) do %( -..... -Agent (v6.20.0) -.... +Agent 6.20.0 - Commit: 3c29612 - Serialization version: v5.0.22 - Go version: go1.17.11 ) end @@ -70,11 +82,9 @@ end context 'when the current agent version is a nightly' do - let(:agent_status) do + let(:agent_get_version) do %( -..... -Agent (v6.20.0-devel+git.38.cd7f989) -.... +Agent 6.20.0-devel - Meta: git.38.cd7f989 - Commit: cd7f98964 - Serialization version: v5.0.22 - Go version: go1.17.11 ) end diff --git a/cookbooks/datadog/spec/remove-dd-agent_spec.rb b/cookbooks/datadog/spec/remove-dd-agent_spec.rb new file mode 100644 index 00000000..462821f7 --- /dev/null +++ b/cookbooks/datadog/spec/remove-dd-agent_spec.rb @@ -0,0 +1,65 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +# Importing apt_sources_list_file variable from recipe_helpers.rb +apt_sources_list_file = Chef::Datadog.apt_sources_list_file + +describe 'datadog::remove-dd-agent' do + context 'when on Ubuntu' do + let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'ubuntu', version: '20.04').converge(described_recipe) } + + it 'purges the datadog-agent package' do + expect(chef_run).to purge_package('datadog-agent') + end + + it 'removes apt_sources_list_file and purges the datadog-signing-keys package' do + expect(chef_run).to purge_apt_package('datadog-signing-keys') + expect(chef_run).to delete_file(apt_sources_list_file) + end + end + + context 'when on Amazon Linux' do + let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'amazon', version: '2').converge(described_recipe) } + + it 'purges the datadog-agent package' do + expect(chef_run).to purge_package('datadog-agent') + end + + it 'removes the datadog yum repository' do + expect(chef_run).to remove_yum_repository('datadog') + end + end + + context 'when on Suse' do + let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'suse', version: '12.5').converge(described_recipe) } + + it 'purges the datadog-agent package' do + expect(chef_run).to purge_package('datadog-agent') + end + + it 'removes the datadog zypper repository' do + expect(chef_run).to remove_zypper_repository('datadog') + end + end + + context 'when on Windows' do + let(:chef_run) { ChefSpec::SoloRunner.new(platform: 'windows', version: '2016').converge(described_recipe) } + + it 'removes the Datadog Agent package' do + expect(chef_run).to remove_package('Datadog Agent') + end + end +end diff --git a/cookbooks/datadog/spec/repository_spec.rb b/cookbooks/datadog/spec/repository_spec.rb index e67a1592..b13f68ca 100644 --- a/cookbooks/datadog/spec/repository_spec.rb +++ b/cookbooks/datadog/spec/repository_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + shared_examples 'old debianoid' do it 'properly creates both keyring files and imports all keys' do expect(chef_run).to create_file_if_missing('/usr/share/keyrings/datadog-archive-keyring.gpg') @@ -11,6 +25,8 @@ # see https://github.com/chefspec/chefspec/issues/541 expect(chef_run.remote_file('remote_file_DATADOG_APT_KEY_CURRENT.public')).to notify( 'execute[import apt datadog key DATADOG_APT_KEY_CURRENT.public]').to(:run).immediately + expect(chef_run.remote_file('remote_file_5F1E256061D813B125E156E8E6266D4AC0962C7D')).to notify( + 'execute[import apt datadog key 5F1E256061D813B125E156E8E6266D4AC0962C7D]').to(:run).immediately expect(chef_run.remote_file('remote_file_D75CEA17048B9ACBF186794B32637D44F14F620E')).to notify( 'execute[import apt datadog key D75CEA17048B9ACBF186794B32637D44F14F620E]').to(:run).immediately expect(chef_run.remote_file('remote_file_A2923DFF56EDA6E76E55E492D3A80E30382E94DE')).to notify( @@ -28,6 +44,8 @@ expect(chef_run.remote_file('remote_file_DATADOG_APT_KEY_CURRENT.public')).to notify( 'execute[import apt datadog key DATADOG_APT_KEY_CURRENT.public]').to(:run).immediately + expect(chef_run.remote_file('remote_file_5F1E256061D813B125E156E8E6266D4AC0962C7D')).to notify( + 'execute[import apt datadog key 5F1E256061D813B125E156E8E6266D4AC0962C7D]').to(:run).immediately expect(chef_run.remote_file('remote_file_D75CEA17048B9ACBF186794B32637D44F14F620E')).to notify( 'execute[import apt datadog key D75CEA17048B9ACBF186794B32637D44F14F620E]').to(:run).immediately expect(chef_run.remote_file('remote_file_A2923DFF56EDA6E76E55E492D3A80E30382E94DE')).to notify( @@ -35,6 +53,50 @@ end end +def import_gpg_keys(key_list, install_gnupg = true) + key_list.each do |key| + unless key.eql? 'current' + set_yum_repo_and_gnupg(key, install_gnupg) + end + + it "downloads the #{key} RPM key" do + expect(chef_run).to create_remote_file("remote_file_DATADOG_RPM_KEY_#{key.upcase}.public").with(path: ::File.join(Chef::Config[:file_cache_path], "DATADOG_RPM_KEY_#{key.upcase}.public")) + end + + it "notifies the GPG key install if a new one is downloaded #{key.upcase}" do + keyfile_r = chef_run.remote_file("remote_file_DATADOG_RPM_KEY_#{key.upcase}.public") + expect(keyfile_r).to notify("execute[rpm-import datadog key #{key}]") + .to(:run).immediately + end + + if key.eql? 'current' + it 'execute[rpm-import datadog key *] by default CURRENT' do + keyfile_exec_r = chef_run.execute('rpm-import datadog key current') + expect(keyfile_exec_r).to do_nothing + end + else + it "doesn\'t execute[rpm-import datadog key *] by default #{key.upcase}" do + keyfile_exec_r = chef_run.execute("rpm-import datadog key #{key}") + expect(keyfile_exec_r).to do_nothing + end + end + end +end + +def set_yum_repo_and_gnupg(key, install_gnupg) + it "sets the yumrepo_gpgkey_new attribute #{key}" do + expect(chef_run.node['datadog']["yumrepo_gpgkey_new_#{key}"]).to match( + /DATADOG_RPM_KEY_#{key.upcase}.public/ + ) + end + + if install_gnupg + it "installs gnupg #{key.upcase}" do + expect(chef_run).to install_package('gnupg') if chef_run.node['packages']['gnupg2'].nil? + end + end +end + describe 'datadog::repository' do context 'on debianoids' do cached(:chef_run) do @@ -57,13 +119,13 @@ expect(chef_run).to remove_apt_repository('datadog-beta') end - it 'removes the datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE repo' do - expect(chef_run).to remove_apt_repository('datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE') - end - it 'removes the datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E repo' do expect(chef_run).to remove_apt_repository('datadog_apt_D75CEA17048B9ACBF186794B32637D44F14F620E') end + + it 'removes the datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE repo' do + expect(chef_run).to remove_apt_repository('datadog_apt_A2923DFF56EDA6E76E55E492D3A80E30382E94DE') + end end context 'debian < 9' do @@ -120,80 +182,24 @@ end.converge(described_recipe) end + # Key B01082D3 (from 2023-04-20 to 2028-04-18) + # Key FD4BF915 (from 2020-09-08 to 2024-09-07) # Key E09422B3 - it 'sets the yumrepo_gpgkey_new attribute E09422B3' do - expect(chef_run.node['datadog']['yumrepo_gpgkey_new_e09422b3']).to match( - /DATADOG_RPM_KEY_E09422B3.public/ - ) - end - - it 'installs gnupg E09422B3' do - epect(chef_run).to install_package('gnupg') if chef_run.node['packages']['gnupg2'].nil? - end - - it 'downloads the current RPM key' do - expect(chef_run).to create_remote_file('remote_file_DATADOG_RPM_KEY_CURRENT.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY_CURRENT.public')) - end - - it 'notifies the GPG key install if a new one is downloaded CURRENT' do - keyfile_r = chef_run.remote_file('remote_file_DATADOG_RPM_KEY_CURRENT.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key current]') - .to(:run).immediately - end - - it 'execute[rpm-import datadog key *] by default CURRENT' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key current') - expect(keyfile_exec_r).to do_nothing - end - - it 'downloads the new RPM key E09422B3' do - expect(chef_run).to create_remote_file('remote_file_DATADOG_RPM_KEY_E09422B3.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY_E09422B3.public')) - end - - it 'notifies the GPG key install if a new one is downloaded E09422B3' do - keyfile_r = chef_run.remote_file('remote_file_DATADOG_RPM_KEY_E09422B3.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key e09422b3]') - .to(:run).immediately - end - - it 'doesn\'t execute[rpm-import datadog key *] by default E09422B3' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key e09422b3') - expect(keyfile_exec_r).to do_nothing - end - - # Key FD4BF915 (2020-09-08) - it 'sets the yumrepo_gpgkey_new attribute fd4bf915' do - expect(chef_run.node['datadog']['yumrepo_gpgkey_new_fd4bf915']).to match( - /DATADOG_RPM_KEY_FD4BF915.public/ - ) - end - - it 'installs fd4bf915' do - expect(chef_run).to install_package('gnupg') if chef_run.node['packages']['gnupg2'].nil? - end - - it 'downloads the new RPM key fd4bf915' do - expect(chef_run).to create_remote_file('remote_file_DATADOG_RPM_KEY_FD4BF915.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY_FD4BF915.public')) - end - - it 'notifies the GPG key install if a new one is downloaded fd4bf915' do - keyfile_r = chef_run.remote_file('remote_file_DATADOG_RPM_KEY_FD4BF915.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key fd4bf915]') - .to(:run).immediately - end - - it 'doesn\'t execute[rpm-import datadog key *] by default fd4bf915' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key fd4bf915') - expect(keyfile_exec_r).to do_nothing - end + import_gpg_keys([ + 'current', + 'b01082d3', + 'fd4bf915', + 'e09422b3' + ]) # prefer HTTPS on boxes that support TLS1.2 - it 'sets up a yum repo E09422B3 and FD4BF915' do + it 'sets up a yum repo E09422B3, FD4BF915 and B01082D3' do expect(chef_run).to create_yum_repository('datadog').with( gpgkey: [ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public', - 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public', 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', ] ).with(repo_gpgcheck: true) end @@ -208,66 +214,23 @@ end.converge(described_recipe) end + # Key B01082D3 (from 2023-04-20 to 2028-04-18) + # Key FD4BF915 (from 2020-09-08 to 2024-09-07) # Key E09422B3 - it 'sets the yumrepo_gpgkey_new attribute E09422B3' do - expect(chef_run.node['datadog']['yumrepo_gpgkey_new_e09422b3']).to match( - /DATADOG_RPM_KEY_E09422B3.public/ - ) - end - - it 'installs gnupg E09422B3' do - expect(chef_run).to install_package('gnupg') if chef_run.node['packages']['gnupg2'].nil? - end - - it 'downloads the new RPM key E09422B3' do - expect(chef_run).to create_remote_file('remote_file_DATADOG_RPM_KEY_E09422B3.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY_E09422B3.public')) - end - - it 'notifies the GPG key install if a new one is downloaded E09422B3' do - keyfile_r = chef_run.remote_file('remote_file_DATADOG_RPM_KEY_E09422B3.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key e09422b3]') - .to(:run).immediately - end - - it 'doesn\'t execute[rpm-import datadog key *] by default E09422B3' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key e09422b3') - expect(keyfile_exec_r).to do_nothing - end - - # Key FD4BF915 (2020-09-08) - it 'sets the yumrepo_gpgkey_new attribute fd4bf915' do - expect(chef_run.node['datadog']['yumrepo_gpgkey_new_fd4bf915']).to match( - /DATADOG_RPM_KEY_FD4BF915.public/ - ) - end - - it 'installs gnupg fd4bf915' do - expect(chef_run).to install_package('gnupg') if chef_run.node['packages']['gnupg2'].nil? - end - - it 'downloads the new RPM key fd4bf915' do - expect(chef_run).to create_remote_file('remote_file_DATADOG_RPM_KEY_FD4BF915.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY_FD4BF915.public')) - end - - it 'notifies the GPG key install if a new one is downloaded fd4bf915' do - keyfile_r = chef_run.remote_file('remote_file_DATADOG_RPM_KEY_FD4BF915.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key fd4bf915]') - .to(:run).immediately - end - - it 'doesn\'t execute[rpm-import datadog key *] by default fd4bf915' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key fd4bf915') - expect(keyfile_exec_r).to do_nothing - end + import_gpg_keys([ + 'b01082d3', + 'fd4bf915', + 'e09422b3' + ]) # prefer HTTPS on boxes that support TLS1.2 it 'sets up a yum repo' do expect(chef_run).to create_yum_repository('datadog').with( gpgkey: [ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public', - 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public', 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public', - 'https://keys.datadoghq.com/DATADOG_RPM_KEY.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', ] ).with(repo_gpgcheck: true) end @@ -282,57 +245,14 @@ end.converge(described_recipe) end + # Key B01082D3 (from 2023-04-20 to 2028-04-18) + # Key FD4BF915 (from 2020-09-08 to 2024-09-07) # Key E09422B3 - it 'sets the yumrepo_gpgkey_new attribute E09422B3' do - expect(chef_run.node['datadog']['yumrepo_gpgkey_new_e09422b3']).to match( - /DATADOG_RPM_KEY_E09422B3.public/ - ) - end - - it 'installs gnupg' do - expect(chef_run).to install_package('gnupg') if chef_run.node['packages']['gnupg2'].nil? - end - - it 'downloads the new RPM key E09422B3' do - expect(chef_run).to create_remote_file('remote_file_DATADOG_RPM_KEY_E09422B3.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY_E09422B3.public')) - end - - it 'notifies the GPG key install if a new one is downloaded E09422B3' do - keyfile_r = chef_run.remote_file('remote_file_DATADOG_RPM_KEY_E09422B3.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key e09422b3]') - .to(:run).immediately - end - - it 'doesn\'t execute[rpm-import datadog key *] by default E09422B3' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key e09422b3') - expect(keyfile_exec_r).to do_nothing - end - - # Key FD4BF915 (2020-09-08) - it 'sets the yumrepo_gpgkey_new attribute fd4bf915' do - expect(chef_run.node['datadog']['yumrepo_gpgkey_new_fd4bf915']).to match( - /DATADOG_RPM_KEY_FD4BF915.public/ - ) - end - - it 'installs gnupg' do - expect(chef_run).to install_package('gnupg') if chef_run.node['packages']['gnupg2'].nil? - end - - it 'downloads the new RPM key fd4bf915' do - expect(chef_run).to create_remote_file('remote_file_DATADOG_RPM_KEY_FD4BF915.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY_FD4BF915.public')) - end - - it 'notifies the GPG key install if a new one is downloaded fd4bf915' do - keyfile_r = chef_run.remote_file('remote_file_DATADOG_RPM_KEY_FD4BF915.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key fd4bf915]') - .to(:run).immediately - end - - it 'doesn\'t execute[rpm-import datadog key *] by default fd4bf915' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key fd4bf915') - expect(keyfile_exec_r).to do_nothing - end + import_gpg_keys([ + 'b01082d3', + 'fd4bf915', + 'e09422b3' + ]) # RHEL5 has to use insecure HTTP due to lack of support for TLS1.2 # https://github.com/DataDog/chef-datadog/blob/v2.8.1/attributes/default.rb#L85-L91 @@ -340,9 +260,9 @@ expect(chef_run).to create_yum_repository('datadog').with( gpgkey: [ 'http://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public', - 'http://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', + 'http://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public', 'http://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public', - 'http://keys.datadoghq.com/DATADOG_RPM_KEY.public', + 'http://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', ] ).with(repo_gpgcheck: false) end @@ -362,9 +282,9 @@ expect(chef_run).to create_yum_repository('datadog').with( gpgkey: [ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public', - 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public', 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public', - 'https://keys.datadoghq.com/DATADOG_RPM_KEY.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', ] ).with(repo_gpgcheck: false) end @@ -384,9 +304,53 @@ expect(chef_run).to create_yum_repository('datadog').with( gpgkey: [ 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', + ] + ).with(repo_gpgcheck: true) + end + end + + context 'almalinux 8.5, agent 6', if: min_chef_version('17.0.69') do + cached(:chef_run) do + ChefSpec::SoloRunner.new( + platform: 'almalinux', version: '8' + ) do |node| + node.normal['datadog'] = { 'agent_major_version' => '6' } + node.automatic['platform_version'] = '8.5' + end.converge(described_recipe) + end + + it 'sets up the yum repo' do + expect(chef_run).to create_yum_repository('datadog').with( + gpgkey: [ + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public', 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', + ] + ).with(repo_gpgcheck: true) + end + end + + context 'rocky 8.5, agent 6', if: min_chef_version('17.1.35') do + cached(:chef_run) do + ChefSpec::SoloRunner.new( + platform: 'rocky', version: '8' + ) do |node| + node.normal['datadog'] = { 'agent_major_version' => '6' } + node.automatic['platform_version'] = '8.5' + end.converge(described_recipe) + end + + it 'sets up the yum repo' do + expect(chef_run).to create_yum_repository('datadog').with( + gpgkey: [ + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_CURRENT.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_B01082D3.public', 'https://keys.datadoghq.com/DATADOG_RPM_KEY_FD4BF915.public', - 'https://keys.datadoghq.com/DATADOG_RPM_KEY.public', + 'https://keys.datadoghq.com/DATADOG_RPM_KEY_E09422B3.public', ] ).with(repo_gpgcheck: true) end @@ -407,63 +371,15 @@ end.converge(described_recipe) end - # Key E09422B3 - it 'sets the yumrepo_gpgkey_new attribute E09422B3' do - expect(chef_run.node['datadog']['yumrepo_gpgkey_new_e09422b3']).to match( - /DATADOG_RPM_KEY_E09422B3.public/ - ) - end - - it 'downloads the new RPM key E09422B3' do - expect(chef_run).to create_remote_file('remote_file_DATADOG_RPM_KEY_E09422B3.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY_E09422B3.public')) - end - - it 'notifies the GPG key install if a new one is downloaded E09422B3' do - keyfile_r = chef_run.remote_file('remote_file_DATADOG_RPM_KEY_E09422B3.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key e09422b3]') - .to(:run).immediately - end - - it 'doesn\'t execute[rpm-import datadog key *] by default E09422B3' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key e09422b3') - expect(keyfile_exec_r).to do_nothing - end - - # Key FD4BF915 (2020-09-08) - it 'sets the yumrepo_gpgkey_new attribute fd4bf915' do - expect(chef_run.node['datadog']['yumrepo_gpgkey_new_fd4bf915']).to match( - /DATADOG_RPM_KEY_FD4BF915.public/ - ) - end - - it 'downloads the new RPM key fd4bf915' do - expect(chef_run).to create_remote_file('remote_file_DATADOG_RPM_KEY_FD4BF915.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY_FD4BF915.public')) - end + import_gpg_keys([ + 'b01082d3', + 'fd4bf915', + 'e09422b3' + ], false) - it 'notifies the GPG key install if a new one is downloaded fd4bf915' do - keyfile_r = chef_run.remote_file('remote_file_DATADOG_RPM_KEY_FD4BF915.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key fd4bf915]') - .to(:run).immediately - end - - it 'doesn\'t execute[rpm-import datadog key *] by default fd4bf915' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key fd4bf915') - expect(keyfile_exec_r).to do_nothing - end - - it 'downloads the old RPM key 4172a230' do - expect(chef_run).to create_remote_file('DATADOG_RPM_KEY.public').with(path: ::File.join(Chef::Config[:file_cache_path], 'DATADOG_RPM_KEY.public')) - end - - it 'notifies the GPG key install if the old key is downloaded 4172a230' do - keyfile_r = chef_run.remote_file('DATADOG_RPM_KEY.public') - expect(keyfile_r).to notify('execute[rpm-import datadog key 4172a230]') - .to(:run).immediately - end - - it 'doesn\'t execute[rpm-import datadog key *] by default 4172a230' do - keyfile_exec_r = chef_run.execute('rpm-import datadog key 4172a230') - expect(keyfile_exec_r).to do_nothing + it 'deletes the old RPM GPG key 4172a230 if it exists' do + expect(chef_run).to run_execute('rpm-remove old gpg key 4172a230-55dd14f6') + .with(command: 'rpm --erase gpg-pubkey-4172a230-55dd14f6') end it 'sets up a yum repo' do diff --git a/cookbooks/datadog/spec/security-agent_spec.rb b/cookbooks/datadog/spec/security-agent_spec.rb new file mode 100644 index 00000000..5bc3199f --- /dev/null +++ b/cookbooks/datadog/spec/security-agent_spec.rb @@ -0,0 +1,72 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +describe 'datadog::security-agent' do + context 'with CWS enabled' do + cached(:solo) do + ChefSpec::SoloRunner.new( + platform: 'ubuntu', + version: '16.04' + ) do |node| + node.name 'chef-nodename' # expected to be used as the hostname in `datadog.yaml` + node.normal['datadog'] = { + 'api_key' => 'somethingnotnil', + 'agent_major_version' => 6, + 'security_agent' => { + 'cws' => { + 'enabled' => true, + } + }, + 'extra_config' => { + 'security_agent' => { + 'runtime_security_config' => { + 'activity_dump' => { + 'enabled' => true, + } + } + } + } + } + end + end + + cached(:chef_run) do + solo.converge(described_recipe) do + solo.resource_collection.insert( + Chef::Resource::Service.new('datadog-agent', solo.run_context)) + end + end + + it 'security-agent.yaml is created' do + expect(chef_run).to create_template('/etc/datadog-agent/security-agent.yaml') + end + + it 'security-agent.yaml contains expected YAML configuration' do + expected_yaml = <<-EOF + compliance_config: + enabled: false + runtime_security_config: + enabled: true + activity_dump: + enabled: true + EOF + + expect(chef_run).to(render_file('/etc/datadog-agent/security-agent.yaml').with_content { |content| + expect(YAML.safe_load(content).to_json).to be_json_eql(YAML.safe_load(expected_yaml).to_json) + }) + end + end +end diff --git a/cookbooks/datadog/spec/shared_examples.rb b/cookbooks/datadog/spec/shared_examples.rb index 4bcf2827..7d7a9aff 100644 --- a/cookbooks/datadog/spec/shared_examples.rb +++ b/cookbooks/datadog/spec/shared_examples.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + shared_examples_for 'datadog-agent service' do it 'enables the datadog-agent service' do expect(chef_run).to enable_service 'datadog-agent' diff --git a/cookbooks/datadog/spec/spec_helper.rb b/cookbooks/datadog/spec/spec_helper.rb index 8e4d4d6a..3fa6c269 100644 --- a/cookbooks/datadog/spec/spec_helper.rb +++ b/cookbooks/datadog/spec/spec_helper.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'chefspec' require 'chefspec/berkshelf' require 'coveralls' @@ -8,6 +22,10 @@ require 'shared_examples' +def min_chef_version(version) + Gem.loaded_specs['chef'].version > Gem::Version.new(version) +end + RSpec.configure do |config| # Use color not only in STDOUT but also in pagers and files config.tty = true @@ -28,9 +46,10 @@ # recipes/repository.rb stub_command('rpm -q gpg-pubkey-current').and_return(false) - stub_command('rpm -q gpg-pubkey-e09422b3').and_return(false) + stub_command('rpm -q gpg-pubkey-b01082d3').and_return(false) stub_command('rpm -q gpg-pubkey-fd4bf915').and_return(false) - stub_command('rpm -q gpg-pubkey-4172a230').and_return(false) + stub_command('rpm -q gpg-pubkey-e09422b3').and_return(false) + stub_command('rpm -q gpg-pubkey-4172a230-55dd14f6').and_return(true) stub_command('apt-key adv --list-public-keys --with-fingerprint --with-colons | grep 382E94DE | grep pub').and_return(false) end diff --git a/cookbooks/datadog/spec/system-probe_spec.rb b/cookbooks/datadog/spec/system-probe_spec.rb index 973db889..e393967c 100644 --- a/cookbooks/datadog/spec/system-probe_spec.rb +++ b/cookbooks/datadog/spec/system-probe_spec.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'spec_helper' describe 'datadog::system-probe' do @@ -32,6 +46,55 @@ end end + context 'with service_monitoring_enabled set to true' do + cached(:solo) do + ChefSpec::SoloRunner.new( + platform: 'ubuntu', + version: '16.04' + ) do |node| + node.name 'chef-nodename' # expected to be used as the hostname in `datadog.yaml` + node.normal['datadog'] = { + 'api_key' => 'somethingnotnil', + 'agent_major_version' => 6, + 'system_probe' => { + 'debug_port' => 123, + 'bpf_debug' => true, + 'sysprobe_socket' => '/test/ing.sock', + 'service_monitoring_enabled' => true, + } + } + end + end + + cached(:chef_run) do + solo.converge(described_recipe) do + solo.resource_collection.insert( + Chef::Resource::Service.new('datadog-agent', solo.run_context)) + end + end + + it 'is created with enabled service_monitoring_enabled' do + expect(chef_run).to create_template('/etc/datadog-agent/system-probe.yaml') + end + + it 'contains expected YAML configuration' do + expected_yaml = <<-EOF + service_monitoring_config: + enabled: true + system_probe_config: + bpf_debug: true + debug_port: 123 + enable_conntrack: false + enabled: false + sysprobe_socket: "/test/ing.sock" + EOF + + expect(chef_run).to(render_file('/etc/datadog-agent/system-probe.yaml').with_content { |content| + expect(YAML.safe_load(content).to_json).to be_json_eql(YAML.safe_load(expected_yaml).to_json) + }) + end + end + context 'with network_enabled set to true' do cached(:solo) do ChefSpec::SoloRunner.new( diff --git a/cookbooks/datadog/tasks/config_specification.rb b/cookbooks/datadog/tasks/config_specification.rb index a73dc0ae..fea6c28d 100644 --- a/cookbooks/datadog/tasks/config_specification.rb +++ b/cookbooks/datadog/tasks/config_specification.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'inflecto' require 'virtus' require 'active_support/core_ext' diff --git a/cookbooks/datadog/tasks/config_specification/models.rb b/cookbooks/datadog/tasks/config_specification/models.rb index cf636215..2412c843 100644 --- a/cookbooks/datadog/tasks/config_specification/models.rb +++ b/cookbooks/datadog/tasks/config_specification/models.rb @@ -1,3 +1,16 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. module ConfigSpecification class Specification diff --git a/cookbooks/datadog/tasks/config_specification/monitor_serializer.rb b/cookbooks/datadog/tasks/config_specification/monitor_serializer.rb index 6d1f9d6d..d3fcb367 100644 --- a/cookbooks/datadog/tasks/config_specification/monitor_serializer.rb +++ b/cookbooks/datadog/tasks/config_specification/monitor_serializer.rb @@ -1,3 +1,16 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. module ConfigSpecification class MonitorSerializer diff --git a/cookbooks/datadog/tasks/config_specification/overrider.rb b/cookbooks/datadog/tasks/config_specification/overrider.rb index b2b27360..5cecc3f5 100644 --- a/cookbooks/datadog/tasks/config_specification/overrider.rb +++ b/cookbooks/datadog/tasks/config_specification/overrider.rb @@ -1,3 +1,16 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. module ConfigSpecification # Overriding values using the syntax from specification files diff --git a/cookbooks/datadog/tasks/config_specification/parameters_serializer.rb b/cookbooks/datadog/tasks/config_specification/parameters_serializer.rb index c8838726..3b521ccf 100644 --- a/cookbooks/datadog/tasks/config_specification/parameters_serializer.rb +++ b/cookbooks/datadog/tasks/config_specification/parameters_serializer.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + module ConfigSpecification class ParametersSerializer def initialize(specification, integration_name) diff --git a/cookbooks/datadog/tasks/config_specification/template_cache.rb b/cookbooks/datadog/tasks/config_specification/template_cache.rb index 41c9a150..d3f2beb2 100644 --- a/cookbooks/datadog/tasks/config_specification/template_cache.rb +++ b/cookbooks/datadog/tasks/config_specification/template_cache.rb @@ -1,3 +1,16 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. module ConfigSpecification # Bookeeping expanded templates diff --git a/cookbooks/datadog/tasks/config_specification/yaml_expander.rb b/cookbooks/datadog/tasks/config_specification/yaml_expander.rb index 97ff0353..35402133 100644 --- a/cookbooks/datadog/tasks/config_specification/yaml_expander.rb +++ b/cookbooks/datadog/tasks/config_specification/yaml_expander.rb @@ -1,3 +1,16 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. # rubocop:disable Lint/AssignmentInCondition module ConfigSpecification diff --git a/cookbooks/datadog/tasks/create_integration_monitor.rake b/cookbooks/datadog/tasks/create_integration_monitor.rake index 06cfba98..57fa6a84 100644 --- a/cookbooks/datadog/tasks/create_integration_monitor.rake +++ b/cookbooks/datadog/tasks/create_integration_monitor.rake @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'rake' require 'pathname' diff --git a/cookbooks/datadog/tasks/release.rake b/cookbooks/datadog/tasks/release.rake index cec2dcba..b46aba1b 100644 --- a/cookbooks/datadog/tasks/release.rake +++ b/cookbooks/datadog/tasks/release.rake @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + require 'rake' require 'chef' require 'chef/cookbook_uploader' diff --git a/cookbooks/datadog/templates/default/custom_log_collection.yaml.erb b/cookbooks/datadog/templates/default/custom_log_collection.yaml.erb new file mode 100644 index 00000000..4596766e --- /dev/null +++ b/cookbooks/datadog/templates/default/custom_log_collection.yaml.erb @@ -0,0 +1 @@ +<%= JSON.parse(({'logs' => @logs }).to_json).to_yaml -%> diff --git a/cookbooks/datadog/templates/default/datadog.yaml.erb b/cookbooks/datadog/templates/default/datadog.yaml.erb index b20e891a..a8f8bfc2 100644 --- a/cookbooks/datadog/templates/default/datadog.yaml.erb +++ b/cookbooks/datadog/templates/default/datadog.yaml.erb @@ -94,6 +94,7 @@ agent_config = @extra_config.merge({ log_level: node['datadog']['log_level'], cmd_port: node['datadog']['cmd_port'], GUI_port: node['datadog']['gui_port'], + inventories_configuration_enabled: node['datadog']['inventories_configuration_enabled'], # log agent options logs_enabled: node['datadog']['enable_logs_agent'], diff --git a/cookbooks/datadog/templates/default/gearmand.yaml.erb b/cookbooks/datadog/templates/default/gearmand.yaml.erb new file mode 100644 index 00000000..b1a1fa4d --- /dev/null +++ b/cookbooks/datadog/templates/default/gearmand.yaml.erb @@ -0,0 +1,62 @@ +<%= JSON.parse(({'logs' => @logs }).to_json).to_yaml -%> + +instances: +<% @instances.each do |i| %> + <% if i['server'] -%> + <% ip = i['server'] %> + <% else %> + <% ip = '127.0.0.1' %> + <% end -%> +- server: <%= ip %> + <% if i['port'] -%> + <% port = i['port'] %> + <% else %> + <% port = '4730' %> + <% end -%> + port: <%= port %> + <% if i['tasks'] %> + tasks: + <% i['tasks'].each do |task| -%> + - <%= task %> + <% end %> + <% end %> + <% if i['tags'] %> + tags: + <% i['tags'].each do |tag| -%> + - <%= tag %> + <% end %> + <% end %> + <% if i['service'] %> + service: <%= i['service'] %> + <% end %> + <% if i['min_collection_interval'] %> + <% seconds = i['min_collection_interval'] %> + <% else %> + <% seconds = 15 %> + <% end %> + min_collection_interval: <%= seconds %> + <% if i['empty_default_hostname'] %> + <% boolean = i['empty_default_hostname'] %> + <% else %> + <% boolean = false %> + <% end %> + empty_default_hostname: <%= boolean %> + <% if i['metric_patterns'] %> + metric_patterns: + <% if i['metric_patterns'].include?('include') %> + include: + <% i['metric_patterns']['include'].each do |regex| %> + - <%= regex %> + <% end %> + <% end %> + <% if i['metric_patterns'].include?('exclude') %> + exclude: + <% i['metric_patterns']['exclude'].each do |regex| %> + - <%= regex %> + <% end %> + <% end %> + <% end %> +<% end -%> + +init_config: +# No init_config details needed diff --git a/cookbooks/datadog/templates/default/kafka_consumer.yaml.erb b/cookbooks/datadog/templates/default/kafka_consumer.yaml.erb index 68c6d23b..5076e999 100644 --- a/cookbooks/datadog/templates/default/kafka_consumer.yaml.erb +++ b/cookbooks/datadog/templates/default/kafka_consumer.yaml.erb @@ -3,21 +3,26 @@ instances: <% @instances.each do |i| -%> - kafka_connect_str: <%= i['kafka_connect_str'] %> + <% if i['consumer_groups'] -%> + consumer_groups: <%= i['name'] %> + <% i["consumer_groups"].each do |consumer, t| -%> + <%= consumer %>: + <% t.each do |topic, l| -%> + <%= topic %>: <%= l %> + <% end -%> + <% end -%> + <% end -%> + <% if i.key?('monitor_unlisted_consumer_groups') -%> + monitor_unlisted_consumer_groups: <%= if i['monitor_unlisted_consumer_groups'] == true && !i['consumer_groups']; true; else false; end %> + <% end -%> zk_connect_str: <%= i['zk_connect_str'] %> <% if i['zk_prefix'] -%> zk_prefix: <%= i['zk_prefix'] %> <% end -%> - <% if i['consumer_groups'] -%> - consumer_groups: <%= i['name'] %> - <% i["consumer_groups"].each do |consumer, t| -%> - <%= consumer %>: - <% t.each do |topic, l| -%> - <%= topic %>: <%= l %> - <% end -%> - <% end -%> + <% if i.key?('kafka_consumer_offsets') && i['kafka_consumer_offsets'] == true-%> + kafka_consumer_offsets: true <% end -%> <% end -%> init_config: # The Kafka Consumer check does not require any init_config - diff --git a/cookbooks/datadog/templates/default/security-agent.yaml.erb b/cookbooks/datadog/templates/default/security-agent.yaml.erb new file mode 100644 index 00000000..dafb4379 --- /dev/null +++ b/cookbooks/datadog/templates/default/security-agent.yaml.erb @@ -0,0 +1,13 @@ +<% +## Populate system_probe_config ## +security_agent_config = { + runtime_security_config: { + enabled: @runtime_security_enabled, + }.merge(@runtime_security_extra_config), + compliance_config: { + enabled: @compliance_enabled, + }.merge(@compliance_extra_config), +} +-%> + +<%= JSON.parse(security_agent_config.to_json).to_yaml %> \ No newline at end of file diff --git a/cookbooks/datadog/templates/default/ssh_check.yaml.erb b/cookbooks/datadog/templates/default/ssh_check.yaml.erb index daf37dbc..ceb50d57 100644 --- a/cookbooks/datadog/templates/default/ssh_check.yaml.erb +++ b/cookbooks/datadog/templates/default/ssh_check.yaml.erb @@ -5,7 +5,7 @@ instances: - host: <%= i['host'] %> username: <%= i['username'] %> <% - keys = %w(password port sftp_check private_key_file add_missing_keys tags) + keys = %w(password port sftp_check private_key_file add_missing_keys min_collection_interval tags) keys.each do |key| if i.key?(key) -%> diff --git a/cookbooks/datadog/templates/default/system_probe.yaml.erb b/cookbooks/datadog/templates/default/system_probe.yaml.erb index 801c8363..50312cb5 100644 --- a/cookbooks/datadog/templates/default/system_probe.yaml.erb +++ b/cookbooks/datadog/templates/default/system_probe.yaml.erb @@ -7,9 +7,15 @@ system_probe_config = { debug_port: @debug_port, bpf_debug: @bpf_debug, enable_conntrack: @enable_conntrack, - }.merge(@extra_config), + }.merge(@system_probe_extra_config), } +if @runtime_security_enabled + system_probe_config['runtime_security_config'] = { + enabled: @runtime_security_enabled + }.merge(@runtime_security_extra_config) +end + # We let the Agent default value take effect if user didn't explicitly # specify something else than nil for 'network_enabled' if !node['datadog']['system_probe']['network_enabled'].nil? @@ -17,6 +23,11 @@ if !node['datadog']['system_probe']['network_enabled'].nil? 'enabled': node['datadog']['system_probe']['network_enabled'], } end +if !node['datadog']['system_probe']['service_monitoring_enabled'].nil? + system_probe_config['service_monitoring_config'] = { + 'enabled': node['datadog']['system_probe']['service_monitoring_enabled'], + } +end -%> # Generated by Chef, local modifications will be overwritten diff --git a/cookbooks/datadog/templates/default/systemd.yaml.erb b/cookbooks/datadog/templates/default/systemd.yaml.erb index a9b20d2e..4814eab7 100644 --- a/cookbooks/datadog/templates/default/systemd.yaml.erb +++ b/cookbooks/datadog/templates/default/systemd.yaml.erb @@ -1,4 +1,4 @@ -<%= JSON.parse(({'logs' => @logs }).to_json).to_yaml %> +<%= JSON.parse(({'logs' => @logs }).to_json).to_yaml -%> instances: <% @instances.each do |i| -%> @@ -9,22 +9,14 @@ instances: <% if i.key?('substate_status_mapping') -%> substate_status_mapping: <% i['substate_status_mapping'].each do |s| -%> - <% if s.key?('services') -%> - <% s['services'].each do |k| -%> - <% k.keys.each do |j| -%> - <%= j %>.service: - <% k[j].each do |l,v| %> - <%= l %>: <%= v %> - <% end -%> - <% end -%> - <% end -%> - <% end -%> - <% if s.key?('sockets') -%> - <% s['sockets'].each do |k| -%> - <% k.keys.each do |j| -%> - <%= j %>.socket: - <% k[j].each do |l,v| %> + <% %w(targets services sockets devices mounts automounts swaps paths timers snapshots slices scopes busnames).each do |unit_type| -%> + <% if s.key?(unit_type)-%> + <% s[unit_type].each do |k| -%> + <% k.keys.each do |j| -%> + <%= j %>.<%= unit_type.chomp('s') %>: + <% k[j].each do |l,v| %> <%= l %>: <%= v %> + <% end -%> <% end -%> <% end -%> <% end -%> diff --git a/cookbooks/datadog/test/cookbooks/test/recipes/dd_integration_resource.rb b/cookbooks/datadog/test/cookbooks/test/recipes/dd_integration_resource.rb index 98c82087..5c5561a0 100644 --- a/cookbooks/datadog/test/cookbooks/test/recipes/dd_integration_resource.rb +++ b/cookbooks/datadog/test/cookbooks/test/recipes/dd_integration_resource.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + datadog_integration 'datadog-aerospike' do action :remove notifies :restart, 'service[datadog-agent]' diff --git a/cookbooks/datadog/test/cookbooks/test/recipes/monitor_add.rb b/cookbooks/datadog/test/cookbooks/test/recipes/monitor_add.rb index 03a0a0d3..7f6e3d15 100644 --- a/cookbooks/datadog/test/cookbooks/test/recipes/monitor_add.rb +++ b/cookbooks/datadog/test/cookbooks/test/recipes/monitor_add.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + datadog_monitor 'potato' do action :add end diff --git a/cookbooks/datadog/test/cookbooks/test/recipes/monitor_remove.rb b/cookbooks/datadog/test/cookbooks/test/recipes/monitor_remove.rb index 7c99e398..8ad5b8d7 100644 --- a/cookbooks/datadog/test/cookbooks/test/recipes/monitor_remove.rb +++ b/cookbooks/datadog/test/cookbooks/test/recipes/monitor_remove.rb @@ -1,3 +1,17 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + datadog_monitor 'potato' do action :remove end diff --git a/cookbooks/datadog/test/integration/datadog_apache/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_apache/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_apache/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_apache/serverspec_datadog/apache_spec.rb b/cookbooks/datadog/test/integration/datadog_apache/serverspec_datadog/apache_spec.rb new file mode 100644 index 00000000..f989c4e1 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_apache/serverspec_datadog/apache_spec.rb @@ -0,0 +1,46 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/apache.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'apache_status_url' => 'http://mysite.com/server-status?auto', + 'apache_user' => 'someusername', + 'apache_password' => 'sekret', + 'tags' => ['kitchen', 'sink'] + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_cacti/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_cacti/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_cacti/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_cacti/serverspec_datadog/cacti_spec.rb b/cookbooks/datadog/test/integration/datadog_cacti/serverspec_datadog/cacti_spec.rb new file mode 100644 index 00000000..7b8d2a90 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_cacti/serverspec_datadog/cacti_spec.rb @@ -0,0 +1,48 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/cacti.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + field_names: ['ifIndex', 'dskDevice', 'ifName'], + mysql_host: 'localhost', + mysql_password: 'mysql_read_only_password', + mysql_user: 'mysql_read_only', + rrd_path: '/path/to/cacti/rra', + rrd_whitelist: '/path/to/rrd_whitelist.txt' + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_cassandra/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_cassandra/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_cassandra/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_cassandra/serverspec_datadog/cassandra_spec.rb b/cookbooks/datadog/test/integration/datadog_cassandra/serverspec_datadog/cassandra_spec.rb new file mode 100644 index 00000000..ffeceb17 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_cassandra/serverspec_datadog/cassandra_spec.rb @@ -0,0 +1,112 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/cassandra.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + host: 'localhost', + port: 7199, + user: 'someuser', + password: 'somepass', + process_name_regex: '.*cassandra.*', + cassandra_aliasing: true + } + ], + 'logs' => nil, + 'init_config' => { + conf: [ + { + include: { + domain: 'org.apache.cassandra.db', + attribute: %w[ + BloomFilterDiskSpaceUsed + BloomFilterFalsePositives + BloomFilterFalseRatio + Capacity + CompletedTasks + CompressionRatio + ExceptionCount + Hits + KeyCacheRecentHitRate + LiveDiskSpaceUsed + LiveSSTableCount + Load + MaxRowSize + MeanRowSize + MemtableColumnsCount + MemtableDataSize + MemtableSwitchCount + MinRowSize + PendingTasks + ReadCount + RecentHitRate + RecentRangeLatencyMicros + RecentReadLatencyMicros + RecentWriteLatencyMicros + Requests + RowCacheRecentHitRate + Size + TotalDiskSpaceUsed + TotalReadLatencyMicros + TotalWriteLatencyMicros + UpdateInterval + WriteCount + ] + }, + exclude: { + keyspace: 'system' + } + }, + { + include: { + domain: 'org.apache.cassandra.internal', + attribute: [ + 'ActiveCount', + 'CompletedTasks', + 'CurrentlyBlockedTasks', + 'TotalBlockedTasks' + ] + } + }, + { + include: { + domain: 'org.apache.cassandra.net', + attribute: [ + 'TotalTimeouts' + ] + } + } + ] + } + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_cassandra_greater_22/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_cassandra_greater_22/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_cassandra_greater_22/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_cassandra_greater_22/serverspec_datadog/cassandra_spec.rb b/cookbooks/datadog/test/integration/datadog_cassandra_greater_22/serverspec_datadog/cassandra_spec.rb new file mode 100644 index 00000000..a0667756 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_cassandra_greater_22/serverspec_datadog/cassandra_spec.rb @@ -0,0 +1,169 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/cassandra.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + host: 'localhost', + port: 7199, + user: 'someuser', + password: 'somepass', + process_name_regex: '.*cassandra.*', + cassandra_aliasing: true + } + ], + 'logs' => nil, + 'init_config' => { + conf: [ + { + include: { + domain: 'org.apache.cassandra.metrics', + type: 'ClientRequest', + scope: [ + 'Read', + 'Write' + ], + name: [ + 'Latency', + 'Timeouts', + 'Unavailables' + ], + attribute: [ + 'Count', + 'OneMinuteRate' + ] + } + }, + { + include: { + domain: 'org.apache.cassandra.metrics', + type: 'ClientRequest', + scope: [ + 'Read', + 'Write' + ], + name: [ + 'TotalLatency' + ] + } + }, + { + include: { + domain: 'org.apache.cassandra.metrics', + type: 'Storage', + name: [ + 'Load', + 'Exceptions' + ] + } + }, + { + include: { + domain: 'org.apache.cassandra.metrics', + type: 'ColumnFamily', + name: %w[ + TotalDiskSpaceUsed + BloomFilterDiskSpaceUsed + BloomFilterFalsePositives + BloomFilterFalseRatio + CompressionRatio + LiveDiskSpaceUsed + LiveSSTableCount + MaxRowSize + MeanRowSize + MemtableColumnsCount + MemtableLiveDataSize + MemtableSwitchCount + MinRowSize + ] + }, + exclude: { + keyspace: [ + 'system', + 'system_auth', + 'system_distributed', + 'system_traces' + ] + } + }, + { + include: { + domain: 'org.apache.cassandra.metrics', + type: 'Cache', + name: [ + 'Capacity', + 'Size' + ], + attribute: [ + 'Value' + ] + } + }, + { + include: { + domain: 'org.apache.cassandra.metrics', + type: 'Cache', + name: [ + 'Hits', + 'Requests' + ], + attribute: [ + 'Count' + ] + } + }, + { + include: { + domain: 'org.apache.cassandra.metrics', + type: 'ThreadPools', + path: 'request', + name: [ + 'ActiveTasks', + 'CompletedTasks', + 'PendingTasks', + 'CurrentlyBlockedTasks' + ] + } + }, + { + include: { + domain: 'org.apache.cassandra.db', + attribute: [ + 'UpdateInterval' + ] + } + } + ] + } + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_consul/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_consul/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_consul/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_consul/serverspec_datadog/consul_spec.rb b/cookbooks/datadog/test/integration/datadog_consul/serverspec_datadog/consul_spec.rb new file mode 100644 index 00000000..c0603fb6 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_consul/serverspec_datadog/consul_spec.rb @@ -0,0 +1,53 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' +require 'json_spec' +require 'serverspec' +require 'yaml' + +set :backend, :exec +set :path, '/sbin:/usr/local/sbin:$PATH' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/consul.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'url' => 'http://localhost:8500', + 'new_leader_checks' => false, + 'catalog_checks' => false, + 'service_whitelist' => 'consul', + 'tags' => ['_default'] + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_couchdb/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_couchdb/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_couchdb/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_couchdb/serverspec_datadog/couchdb_spec.rb b/cookbooks/datadog/test/integration/datadog_couchdb/serverspec_datadog/couchdb_spec.rb new file mode 100644 index 00000000..a1109c60 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_couchdb/serverspec_datadog/couchdb_spec.rb @@ -0,0 +1,45 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/couch.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + password: 'somepass', + server: 'http://localhost:5984', + user: 'someuser' + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_docker/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_docker/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_docker/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_docker/serverspec_datadog/docker_spec.rb b/cookbooks/datadog/test/integration/datadog_docker/serverspec_datadog/docker_spec.rb new file mode 100644 index 00000000..5594d765 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_docker/serverspec_datadog/docker_spec.rb @@ -0,0 +1,63 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/docker.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + instances: [ + { + url: 'unix://var/run/docker.sock', + tag_by_command: false, + new_tag_names: false, + tags: [ + 'toto', + 'tata' + ], + include: [ + 'docker_image:ubuntu', + 'docker_image:debian' + ], + exclude: [ + '.*' + ], + collect_events: true, + collect_container_size: false, + collect_all_metrics: false, + collect_images_stats: false + } + ], + 'logs' => nil, + init_config: { + docker_root: '/', + socket_timeout: 10 + } + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_elasticsearch/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_elasticsearch/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_elasticsearch/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_elasticsearch/serverspec_datadog/elasticsearch_spec.rb b/cookbooks/datadog/test/integration/datadog_elasticsearch/serverspec_datadog/elasticsearch_spec.rb new file mode 100644 index 00000000..c3a921aa --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_elasticsearch/serverspec_datadog/elasticsearch_spec.rb @@ -0,0 +1,50 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/elastic.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'url' => 'http://localhost:9200', + 'username' => 'someuser', + 'password' => 'somepass', + 'is_external' => false, + 'pshard_stats' => true, + 'index_stats' => true, + 'shard_level_metrics' => true, + 'tags' => ['kitchen', 'sink'] + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_etcd/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_etcd/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_etcd/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_etcd/serverspec_datadog/etcd_spec.rb b/cookbooks/datadog/test/integration/datadog_etcd/serverspec_datadog/etcd_spec.rb new file mode 100644 index 00000000..7b3aebaf --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_etcd/serverspec_datadog/etcd_spec.rb @@ -0,0 +1,54 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' +require 'json_spec' +require 'serverspec' +require 'yaml' + +set :backend, :exec +set :path, '/sbin:/usr/local/sbin:$PATH' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/etcd.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'url' => 'http://localhost:2379', + 'timeout' => 5, + 'ssl_keyfile' => '/etc/etcd/ssl.key', + 'ssl_certfile' => '/etc/etcd/ssl.crt', + 'ssl_cert_validation' => true, + 'ssl_ca_certs' => '/etc/etcd/ca-certs.crt' + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_fluentd/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_fluentd/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_fluentd/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_fluentd/serverspec_datadog/fluentd_spec.rb b/cookbooks/datadog/test/integration/datadog_fluentd/serverspec_datadog/fluentd_spec.rb new file mode 100644 index 00000000..214c7a43 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_fluentd/serverspec_datadog/fluentd_spec.rb @@ -0,0 +1,45 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/fluentd.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'monitor_agent_url' => 'http://localhost.com:24220/api/plugins.json', + 'plugin_ids' => ['api', 'plugin'], + 'tags' => ['kitchen', 'sink'] + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_gearmand/serverspec_datadog/gearmand_spec.rb b/cookbooks/datadog/test/integration/datadog_gearmand/serverspec_datadog/gearmand_spec.rb new file mode 100644 index 00000000..0de3a189 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_gearmand/serverspec_datadog/gearmand_spec.rb @@ -0,0 +1,65 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/gearmand.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'server' => '127.0.0.1', + 'port' => '4730', + 'tasks' => [ + 'TASK_1', + 'TASK_2', + ], + 'tags' => [ + ':', + ':' + ], + 'service' => '', + # Defaults to 15 if not set + 'min_collection_interval' => 60, + # Defaults to false if not set + 'empty_default_hostname' => true, + 'metric_patterns' => { + 'include' => [ + '' + ], + 'exclude' => [ + '' + ] + } + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_haproxy/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_haproxy/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_haproxy/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_haproxy/serverspec_datadog/haproxy_spec.rb b/cookbooks/datadog/test/integration/datadog_haproxy/serverspec_datadog/haproxy_spec.rb new file mode 100644 index 00000000..a4bbb4b7 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_haproxy/serverspec_datadog/haproxy_spec.rb @@ -0,0 +1,48 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/haproxy.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'collect_aggregates_only' => true, + 'collect_status_metrics' => true, + 'password' => 'sekret', + 'status_check' => false, + 'url' => 'http://localhost:22002/status', + 'username' => 'admin' + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_http_check/serverspec_datadog/http_check_spec.rb b/cookbooks/datadog/test/integration/datadog_http_check/serverspec_datadog/http_check_spec.rb new file mode 100644 index 00000000..42ee0a22 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_http_check/serverspec_datadog/http_check_spec.rb @@ -0,0 +1,48 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/http_check.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'name' => 'test', + 'url' => 'http://localhost/' + }, + { + 'name' => 'test2', + 'url' => 'http://localhost/' + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_integrations/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_integrations/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_integrations/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_integrations/serverspec_datadog/integrations_spec.rb b/cookbooks/datadog/test/integration/datadog_integrations/serverspec_datadog/integrations_spec.rb new file mode 100644 index 00000000..3fedc21a --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_integrations/serverspec_datadog/integrations_spec.rb @@ -0,0 +1,47 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/twemproxy.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + instances: [ + { + url: 'http://localhost:22222' + } + ], + 'logs' => nil, + init_config: {} + } + + expect(generated.to_json).to be_json_eql expected.to_json + end + + describe package('dd-check-twemproxy') do + it { should be_installed.with_version('0.1.0-1') } + end +end diff --git a/cookbooks/datadog/test/integration/datadog_jmx/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_jmx/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_jmx/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_jmx/serverspec_datadog/dd-agent-jmx_spec.rb b/cookbooks/datadog/test/integration/datadog_jmx/serverspec_datadog/dd-agent-jmx_spec.rb new file mode 100644 index 00000000..5956725c --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_jmx/serverspec_datadog/dd-agent-jmx_spec.rb @@ -0,0 +1,71 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +JMX_CONFIG = File.join(@agent_config_dir, 'conf.d/jmx.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(JMX_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(JMX_CONFIG) + + EXPECTED = { + 'logs' => nil, + 'init_config' => nil, + 'instances' => [ + { + 'conf' => [ + { + 'include' => { + 'domain' => 'my_domain', + 'bean' => ['my_bean', 'my_second_bean'], + 'attribute' => { + 'attribute1' => { 'metric_type' => 'counter', 'alias' => 'jmx.my_metric_name' }, + 'attribute2' => { 'metric_type' => 'gauge', 'alias' => 'jmx.my2ndattribute' } + } + } + }, + { + 'include' => { 'domain' => '2nd_domain' }, + 'exclude' => { 'bean' => ['excluded_bean'] } + }, + { + 'include' => { 'domain_regex' => 'regex_on_domain' }, + 'exclude' => { 'bean_regex' => ['regex_on_excluded_bean'] } + } + ], + 'host' => 'localhost', + 'name' => 'jmx_instance', + 'password' => 'somepass', + 'port' => 7199, + 'tags' => { + 'env' => 'stage', + 'newTag' => 'test' + }, + 'user' => 'someuser' + } + ] + }.freeze + + expect(generated.to_json).to be_json_eql EXPECTED.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_kafka/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_kafka/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_kafka/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_kafka/serverspec_datadog/kafka_spec.rb b/cookbooks/datadog/test/integration/datadog_kafka/serverspec_datadog/kafka_spec.rb new file mode 100644 index 00000000..16b10026 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_kafka/serverspec_datadog/kafka_spec.rb @@ -0,0 +1,255 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/kafka.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + instances: [ + { + host: 'localhost', + java_bin_path: '/path/to/java', + name: 'my_kafka', + password: 'password', + port: 9999, + trust_store_password: 'password', + trust_store_path: '/path/to/trustStore.jks', + user: 'username' + } + ], + 'logs' => nil, + init_config: { + is_jmx: true, + collect_default_metrics: true, + conf: [ + { + include: { + domain: '"kafka.server"', + bean: '"kafka.server":type="BrokerTopicMetrics",name="AllTopicsBytesOutPerSec"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.net.bytes_out' + } + } + } + }, + { + include: { + domain: '"kafka.server"', + bean: '"kafka.server":type="BrokerTopicMetrics",name="AllTopicsBytesInPerSec"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.net.bytes_in' + } + } + } + }, + { + include: { + domain: '"kafka.server"', + bean: '"kafka.server":type="BrokerTopicMetrics",name="AllTopicsMessagesInPerSec"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.messages_in' + } + } + } + }, + { + include: { + domain: '"kafka.server"', + bean: '"kafka.server":type="BrokerTopicMetrics",name="AllTopicsFailedFetchRequestsPerSec"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.request.fetch.failed' + } + } + } + }, + { + include: { + domain: '"kafka.server"', + bean: '"kafka.server":type="BrokerTopicMetrics",name="AllTopicsFailedProduceRequestsPerSec"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.request.produce.failed' + } + } + } + }, + { + include: { + domain: '"kafka.network"', + bean: '"kafka.network":type="RequestMetrics",name="Produce-TotalTimeMs"', + attribute: { + Mean: { + metric_type: 'gauge', + alias: 'kafka.request.produce.time.avg' + }, + '99thPercentile' => { + metric_type: 'gauge', + alias: 'kafka.request.produce.time.99percentile' + } + } + } + }, + { + include: { + domain: '"kafka.network"', + bean: '"kafka.network":type="RequestMetrics",name="Fetch-TotalTimeMs"', + attribute: { + Mean: { + metric_type: 'gauge', + alias: 'kafka.request.fetch.time.avg' + }, + '99thPercentile' => { + metric_type: 'gauge', + alias: 'kafka.request.fetch.time.99percentile' + } + } + } + }, + { + include: { + domain: '"kafka.network"', + bean: '"kafka.network":type="RequestMetrics",name="UpdateMetadata-TotalTimeMs"', + attribute: { + Mean: { + metric_type: 'gauge', + alias: 'kafka.request.update_metadata.time.avg' + }, + '99thPercentile' => { + metric_type: 'gauge', + alias: 'kafka.request.update_metadata.time.99percentile' + } + } + } + }, + { + include: { + domain: '"kafka.network"', + bean: '"kafka.network":type="RequestMetrics",name="Metadata-TotalTimeMs"', + attribute: { + Mean: { + metric_type: 'gauge', + alias: 'kafka.request.metadata.time.avg' + }, + '99thPercentile' => { + metric_type: 'gauge', + alias: 'kafka.request.metadata.time.99percentile' + } + } + } + }, + { + include: { + domain: '"kafka.network"', + bean: '"kafka.network":type="RequestMetrics",name="Offsets-TotalTimeMs"', + attribute: { + Mean: { + metric_type: 'gauge', + alias: 'kafka.request.offsets.time.avg' + }, + '99thPercentile' => { + metric_type: 'gauge', + alias: 'kafka.request.offsets.time.99percentile' + } + } + } + }, + { + include: { + domain: '"kafka.server"', + bean: '"kafka.server":type="ReplicaManager",name="ISRShrinksPerSec"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.replication.isr_shrinks' + } + } + } + }, + { + include: { + domain: '"kafka.server"', + bean: '"kafka.server":type="ReplicaManager",name="ISRExpandsPerSec"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.replication.isr_expands' + } + } + } + }, + { + include: { + domain: '"kafka.server"', + bean: '"kafka.server":type="ControllerStats",name="LeaderElectionRateAndTimeMs"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.replication.leader_elections' + } + } + } + }, + { + include: { + domain: '"kafka.server"', + bean: '"kafka.server":type="ControllerStats",name="UncleanLeaderElectionsPerSec"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.replication.unclean_leader_elections' + } + } + } + }, + { + include: { + domain: '"kafka.log"', + bean: '"kafka.log":type="LogFlushStats",name="LogFlushRateAndTimeMs"', + attribute: { + MeanRate: { + metric_type: 'gauge', + alias: 'kafka.log.flush_rate' + } + } + } + } + ] + } + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_kafka_consumer/serverspec_datadog/kafka_consumer_spec.rb b/cookbooks/datadog/test/integration/datadog_kafka_consumer/serverspec_datadog/kafka_consumer_spec.rb new file mode 100644 index 00000000..753f06c8 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_kafka_consumer/serverspec_datadog/kafka_consumer_spec.rb @@ -0,0 +1,51 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/kafka_consumer.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + :kafka_connect_str => 'localhost:19092', + :consumer_groups => { + :my_consumer => { + :my_topic => [0, 1, 4, 12] + } + }, + :monitor_unlisted_consumer_groups => false, + :zk_connect_str => 'localhost:2181', + :zk_prefix => '/0.8', + :kafka_consumer_offsets => true + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_mesos_master/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_mesos_master/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_mesos_master/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_mesos_master/serverspec_datadog/mesos_spec.rb b/cookbooks/datadog/test/integration/datadog_mesos_master/serverspec_datadog/mesos_spec.rb new file mode 100644 index 00000000..d6d8f671 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_mesos_master/serverspec_datadog/mesos_spec.rb @@ -0,0 +1,47 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/mesos_master.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + instances: [ + { + url: 'localhost:5050', + timeout: 8, + tags: ['master', 'tata'] + } + ], + 'logs' => nil, + init_config: { + default_timeout: 10 + } + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_mesos_slave/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_mesos_slave/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_mesos_slave/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_mesos_slave/serverspec_datadog/mesos_spec.rb b/cookbooks/datadog/test/integration/datadog_mesos_slave/serverspec_datadog/mesos_spec.rb new file mode 100644 index 00000000..72ed6395 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_mesos_slave/serverspec_datadog/mesos_spec.rb @@ -0,0 +1,47 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/mesos_slave.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + instances: [ + { + url: 'localhost:5050', + timeout: 8, + tags: ['slave', 'tata'] + } + ], + 'logs' => nil, + init_config: { + default_timeout: 10 + } + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_mongo/serverspec_datadog/mongo_spec.rb b/cookbooks/datadog/test/integration/datadog_mongo/serverspec_datadog/mongo_spec.rb new file mode 100644 index 00000000..bf0bf29b --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_mongo/serverspec_datadog/mongo_spec.rb @@ -0,0 +1,46 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/mongo.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'hosts' => 'localhost:27017', + 'username' => 'someuser', + 'password' => 'somepassword', + 'timeout' => 30 + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_mysql/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_mysql/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_mysql/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_mysql/serverspec_datadog/mysql_spec.rb b/cookbooks/datadog/test/integration/datadog_mysql/serverspec_datadog/mysql_spec.rb new file mode 100644 index 00000000..2e422c81 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_mysql/serverspec_datadog/mysql_spec.rb @@ -0,0 +1,71 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' +require 'json_spec' +require 'serverspec' +require 'yaml' + +set :backend, :exec +set :path, '/sbin:/usr/local/sbin:$PATH' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/mysql.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'server' => '1.1.1.1', + 'port' => 3307, + 'user' => 'my_username', + 'pass' => 'my_password', + 'sock' => '/path/to/mysql.sock', + 'tags' => ['prod', 'my_app'], + 'options' => { + 'replication' => 0 + }, + 'queries' => [ + { + 'type' => 'gauge', + 'field' => 'users_count', + 'metric' => 'my_app.my_users.count', + 'query' => 'SELECT COUNT(1) AS users_count FROM users' + }, + { + 'type' => 'gauge', + 'field' => 'max_query_time', + 'metric' => 'mysql.performance.max_query_time', + 'query' => "SELECT IFNULL(MAX(TIME), 0) AS max_query_time FROM INFORMATION_SCHEMA.PROCESSLIST WHERE COMMAND != 'Sleep'" + } + ] + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_ntp/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_ntp/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_ntp/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_ntp/serverspec_datadog/ntp_spec.rb b/cookbooks/datadog/test/integration/datadog_ntp/serverspec_datadog/ntp_spec.rb new file mode 100644 index 00000000..8cf4e846 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_ntp/serverspec_datadog/ntp_spec.rb @@ -0,0 +1,47 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/ntp.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'offset_threshold' => 600, + 'host' => 'europe.pool.ntp.org', + 'port' => 9999, + 'version' => 4, + 'timeout' => 10 + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_pgbouncer/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_pgbouncer/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_pgbouncer/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_pgbouncer/serverspec_datadog/pgbouncer_spec.rb b/cookbooks/datadog/test/integration/datadog_pgbouncer/serverspec_datadog/pgbouncer_spec.rb new file mode 100644 index 00000000..9b66e062 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_pgbouncer/serverspec_datadog/pgbouncer_spec.rb @@ -0,0 +1,53 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' +require 'json_spec' +require 'serverspec' +require 'yaml' + +set :backend, :exec +set :path, '/sbin:/usr/local/sbin:$PATH' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/pgbouncer.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + instances: [ + { + host: 'localhost', + port: 6432, + username: 'john', + password: 'doe', + tags: ['toto', 'tata'] + } + ], + 'logs' => nil, + init_config: nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_postfix/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_postfix/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_postfix/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_postfix/serverspec_datadog/postfix_spec.rb b/cookbooks/datadog/test/integration/datadog_postfix/serverspec_datadog/postfix_spec.rb new file mode 100644 index 00000000..8ba9b529 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_postfix/serverspec_datadog/postfix_spec.rb @@ -0,0 +1,56 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' +require 'json_spec' +require 'serverspec' +require 'yaml' + +set :backend, :exec +set :path, '/sbin:/usr/local/sbin:$PATH' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/postfix.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'directory' => '/var/spool/postfix', + 'queues' => ['incoming', 'active', 'deferred'], + 'tags' => ['prod', 'postfix_core'] + }, + { + 'directory' => '/var/spool/postfix', + 'queues' => ['bounce'], + 'tags' => ['test'] + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_process/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_process/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_process/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_process/serverspec_datadog/dd-agent-process_spec.rb b/cookbooks/datadog/test/integration/datadog_process/serverspec_datadog/dd-agent-process_spec.rb new file mode 100644 index 00000000..e796e38d --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_process/serverspec_datadog/dd-agent-process_spec.rb @@ -0,0 +1,47 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +PROCESS_CONFIG = File.join(@agent_config_dir, 'conf.d/process.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(PROCESS_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(PROCESS_CONFIG) + + expected = { + 'instances' => [ + { + 'name' => 'pidname', + 'exact_match' => false, + 'ignore_denied_access' => true, + 'tags' => ['env:test', 'appname:somename'], + 'search_string' => ['somepid', 'pidname'] + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_rabbitmq/serverspec_datadog/rabbitmq_spec.rb b/cookbooks/datadog/test/integration/datadog_rabbitmq/serverspec_datadog/rabbitmq_spec.rb new file mode 100644 index 00000000..e050061e --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_rabbitmq/serverspec_datadog/rabbitmq_spec.rb @@ -0,0 +1,56 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/rabbitmq.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'rabbitmq_api_url' => 'http://localhost:15672/api/', + 'rabbitmq_user' => 'someuser', + 'rabbitmq_pass' => 'somepassword', + 'ssl_verify' => true, + 'tag_families' => false, + 'max_detailed_exchanges' => 300, + 'max_detailed_queues' => 300, + 'tags' => ['tag1', 'tag2'], + 'nodes' => ['node1', 'node2'], + 'nodes_regexes' => ['node3.*', 'node4.*'], + 'vhosts' => ['vhost1', 'vhost2'], + 'queues' => ['queue1', 'queue2'], + 'queues_regexes' => ['queue3.*', 'queue4.*'], + 'timeout' => 30 + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_ssh_check/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_ssh_check/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_ssh_check/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_ssh_check/serverspec_datadog/ssh_check_spec.rb b/cookbooks/datadog/test/integration/datadog_ssh_check/serverspec_datadog/ssh_check_spec.rb new file mode 100644 index 00000000..64f8b757 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_ssh_check/serverspec_datadog/ssh_check_spec.rb @@ -0,0 +1,63 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' +require 'json_spec' +require 'serverspec' +require 'yaml' + +set :backend, :exec +set :path, '/sbin:/usr/local/sbin:$PATH' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/ssh_check.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'host' => 'localhost', + 'username' => 'root', + 'password' => 'password', + 'add_missing_keys' => false, + 'tags' => ['tag1', 'tag2'], + 'min_collection_interval' => 300 + }, + { + 'host' => 'sftp_server.example.com', + 'username' => 'test', + 'port' => 2323, + 'sftp_check' => true, + 'private_key_file' => '/path/to/key', + 'tags' => ['tag1', 'tag3'], + 'min_collection_interval' => 300 + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_supervisord/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_supervisord/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_supervisord/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_supervisord/serverspec_datadog/supervisord_spec.rb b/cookbooks/datadog/test/integration/datadog_supervisord/serverspec_datadog/supervisord_spec.rb new file mode 100644 index 00000000..6d52a3d0 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_supervisord/serverspec_datadog/supervisord_spec.rb @@ -0,0 +1,61 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' +require 'json_spec' +require 'serverspec' +require 'yaml' + +set :backend, :exec +set :path, '/sbin:/usr/local/sbin:$PATH' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/supervisord.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + instances: [ + { + name: 'server0', + socket: 'unix:///var/run/default-supervisor.sock' + }, + { + name: 'server1', + host: 'localhost', + port: 9001, + user: 'user', + pass: 'pass', + proc_names: [ + 'apache2', + 'webapp' + ] + } + ], + 'logs' => nil, + init_config: nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_systemd/serverspec_datadog/systemd_spec.rb b/cookbooks/datadog/test/integration/datadog_systemd/serverspec_datadog/systemd_spec.rb new file mode 100644 index 00000000..101fe6aa --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_systemd/serverspec_datadog/systemd_spec.rb @@ -0,0 +1,48 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/systemd.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'unit_names' => [ + 'myservice1.service', + 'myservice2.service', + 'mysocket.socket', + 'mytimer.timer' + ] + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_tcp_check/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/datadog_tcp_check/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_tcp_check/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/datadog_tcp_check/serverspec_datadog/tcp_check_spec.rb b/cookbooks/datadog/test/integration/datadog_tcp_check/serverspec_datadog/tcp_check_spec.rb new file mode 100644 index 00000000..148929af --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_tcp_check/serverspec_datadog/tcp_check_spec.rb @@ -0,0 +1,50 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/tcp_check.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'name' => 'test', + 'host' => 'localhost', + 'port' => 1234 + }, + { + 'name' => 'test2', + 'host' => 'localhost', + 'port' => 5678 + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/datadog_vault/serverspec_datadog/vault_spec.rb b/cookbooks/datadog/test/integration/datadog_vault/serverspec_datadog/vault_spec.rb new file mode 100644 index 00000000..fde4f4b2 --- /dev/null +++ b/cookbooks/datadog/test/integration/datadog_vault/serverspec_datadog/vault_spec.rb @@ -0,0 +1,54 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' +require 'json_spec' +require 'serverspec' +require 'yaml' + +set :backend, :exec +set :path, '/sbin:/usr/local/sbin:$PATH' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/vault.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + 'instances' => [ + { + 'api_url' => 'http://localhost:8200/v1', + 'detect_leader' => false, + 'skip_proxy' => false, + 'ssl_verify' => true, + 'tags' => ['_default'], + 'timeout' => 20 + } + ], + 'logs' => nil, + 'init_config' => nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler/serverspec_datadog/dd-agent_spec.rb b/cookbooks/datadog/test/integration/dd-agent-handler/serverspec_datadog/dd-agent_spec.rb new file mode 100644 index 00000000..2f06ef29 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler/serverspec_datadog/dd-agent_spec.rb @@ -0,0 +1,53 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +describe package(@agent_package_name) do + it { should be_installed } +end + +describe service(@agent_service_name) do + it { should be_running } +end + +describe command('/opt/datadog-agent/bin/agent/agent status | grep -v "Instance ID"'), :if => os[:family] != 'windows' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain '[OK]' } + its(:stdout) { should_not contain 'ERROR' } +end + +# The new APT keys are imported +describe command('apt-key list'), :if => ['debian', 'ubuntu'].include?(os[:family]) do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'C0962C7D' } + its(:stdout) { should contain 'F14F620E' } + its(:stdout) { should contain '382E94DE' } +end + +# The new RPM keys are imported +describe command('rpm -q gpg-pubkey-b01082d3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-b01082d3' } +end + +describe command('rpm -q gpg-pubkey-fd4bf915'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-fd4bf915' } +end + +describe command('rpm -q gpg-pubkey-e09422b3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-e09422b3' } +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler5/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/dd-agent-handler5/serverspec_datadog/Gemfile new file mode 100644 index 00000000..2e440b8a --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler5/serverspec_datadog/Gemfile @@ -0,0 +1,14 @@ +source 'https://rubygems.org' + +chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') + +if RUBY_VERSION < '2.6' + gem 'net-ssh', '~> 6.1.0' + gem 'public_suffix', '~> 4.0.0' +end + +gem 'json_spec', '~> 1.1.0' + +if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' + gem 'train-core', '~> 3.9.0' +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler5/serverspec_datadog/dd-agent_spec.rb b/cookbooks/datadog/test/integration/dd-agent-handler5/serverspec_datadog/dd-agent_spec.rb new file mode 100644 index 00000000..19e60940 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler5/serverspec_datadog/dd-agent_spec.rb @@ -0,0 +1,55 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +describe package(@agent_package_name) do + it { should be_installed } +end + +describe service(@agent_service_name) do + it { should be_running } +end + +# On Linux kernel >= 5.5, Agent 5 disk check fails because of old psutil version, which doesn't have fix +# https://github.com/giampaolo/psutil/commit/2e0952e939d6ab517449314876d8d3488ba5b98b +describe command('/etc/init.d/datadog-agent info | grep -v "API Key is invalid" | grep -v "not sure how to interpret line"'), :if => os[:family] != 'windows' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'OK' } + its(:stdout) { should_not contain 'ERROR' } +end + +# The new APT keys are imported +describe command('apt-key list'), :if => ['debian', 'ubuntu'].include?(os[:family]) do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'C0962C7D' } + its(:stdout) { should contain 'F14F620E' } + its(:stdout) { should contain '382E94DE' } +end + +# The new RPM keys are imported +describe command('rpm -q gpg-pubkey-b01082d3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-b01082d3' } +end + +describe command('rpm -q gpg-pubkey-fd4bf915'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-fd4bf915' } +end + +describe command('rpm -q gpg-pubkey-e09422b3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-e09422b3' } +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler5/serverspec_datadog/dd-handler_spec.rb b/cookbooks/datadog/test/integration/dd-agent-handler5/serverspec_datadog/dd-handler_spec.rb new file mode 100644 index 00000000..9ccbaf12 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler5/serverspec_datadog/dd-handler_spec.rb @@ -0,0 +1,20 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +# the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec +describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do + it { should be_installed.by('gem') } +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler6/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/dd-agent-handler6/serverspec_datadog/Gemfile new file mode 100644 index 00000000..2e440b8a --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler6/serverspec_datadog/Gemfile @@ -0,0 +1,14 @@ +source 'https://rubygems.org' + +chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') + +if RUBY_VERSION < '2.6' + gem 'net-ssh', '~> 6.1.0' + gem 'public_suffix', '~> 4.0.0' +end + +gem 'json_spec', '~> 1.1.0' + +if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' + gem 'train-core', '~> 3.9.0' +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler6/serverspec_datadog/dd-agent_spec.rb b/cookbooks/datadog/test/integration/dd-agent-handler6/serverspec_datadog/dd-agent_spec.rb new file mode 100644 index 00000000..2f06ef29 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler6/serverspec_datadog/dd-agent_spec.rb @@ -0,0 +1,53 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +describe package(@agent_package_name) do + it { should be_installed } +end + +describe service(@agent_service_name) do + it { should be_running } +end + +describe command('/opt/datadog-agent/bin/agent/agent status | grep -v "Instance ID"'), :if => os[:family] != 'windows' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain '[OK]' } + its(:stdout) { should_not contain 'ERROR' } +end + +# The new APT keys are imported +describe command('apt-key list'), :if => ['debian', 'ubuntu'].include?(os[:family]) do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'C0962C7D' } + its(:stdout) { should contain 'F14F620E' } + its(:stdout) { should contain '382E94DE' } +end + +# The new RPM keys are imported +describe command('rpm -q gpg-pubkey-b01082d3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-b01082d3' } +end + +describe command('rpm -q gpg-pubkey-fd4bf915'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-fd4bf915' } +end + +describe command('rpm -q gpg-pubkey-e09422b3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-e09422b3' } +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler6/serverspec_datadog/dd-handler_spec.rb b/cookbooks/datadog/test/integration/dd-agent-handler6/serverspec_datadog/dd-handler_spec.rb new file mode 100644 index 00000000..9ccbaf12 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler6/serverspec_datadog/dd-handler_spec.rb @@ -0,0 +1,20 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +# the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec +describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do + it { should be_installed.by('gem') } +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler7/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/dd-agent-handler7/serverspec_datadog/Gemfile new file mode 100644 index 00000000..2e440b8a --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler7/serverspec_datadog/Gemfile @@ -0,0 +1,14 @@ +source 'https://rubygems.org' + +chef_version = ENV.fetch('CHEF_VERSION', '14.10.9') + +if RUBY_VERSION < '2.6' + gem 'net-ssh', '~> 6.1.0' + gem 'public_suffix', '~> 4.0.0' +end + +gem 'json_spec', '~> 1.1.0' + +if Gem::Version.new(chef_version) > Gem::Version.new('16.0.0') && RUBY_VERSION < '2.7' + gem 'train-core', '~> 3.9.0' +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler7/serverspec_datadog/dd-agent_spec.rb b/cookbooks/datadog/test/integration/dd-agent-handler7/serverspec_datadog/dd-agent_spec.rb new file mode 100644 index 00000000..2f06ef29 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler7/serverspec_datadog/dd-agent_spec.rb @@ -0,0 +1,53 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +describe package(@agent_package_name) do + it { should be_installed } +end + +describe service(@agent_service_name) do + it { should be_running } +end + +describe command('/opt/datadog-agent/bin/agent/agent status | grep -v "Instance ID"'), :if => os[:family] != 'windows' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain '[OK]' } + its(:stdout) { should_not contain 'ERROR' } +end + +# The new APT keys are imported +describe command('apt-key list'), :if => ['debian', 'ubuntu'].include?(os[:family]) do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'C0962C7D' } + its(:stdout) { should contain 'F14F620E' } + its(:stdout) { should contain '382E94DE' } +end + +# The new RPM keys are imported +describe command('rpm -q gpg-pubkey-b01082d3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-b01082d3' } +end + +describe command('rpm -q gpg-pubkey-fd4bf915'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-fd4bf915' } +end + +describe command('rpm -q gpg-pubkey-e09422b3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-e09422b3' } +end diff --git a/cookbooks/datadog/test/integration/dd-agent-handler7/serverspec_datadog/dd-handler_spec.rb b/cookbooks/datadog/test/integration/dd-agent-handler7/serverspec_datadog/dd-handler_spec.rb new file mode 100644 index 00000000..9ccbaf12 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-handler7/serverspec_datadog/dd-handler_spec.rb @@ -0,0 +1,20 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +# the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec +describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do + it { should be_installed.by('gem') } +end diff --git a/cookbooks/datadog/test/integration/dd-agent-iot/serverspec_datadog/dd-agent_spec.rb b/cookbooks/datadog/test/integration/dd-agent-iot/serverspec_datadog/dd-agent_spec.rb new file mode 100644 index 00000000..ad56fcee --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-iot/serverspec_datadog/dd-agent_spec.rb @@ -0,0 +1,55 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +@agent_package_name = 'datadog-iot-agent' + +describe package(@agent_package_name) do + it { should be_installed } +end + +describe service(@agent_service_name) do + it { should be_running } +end + +describe command('/opt/datadog-agent/bin/agent/agent status | grep -v "Instance ID"'), :if => os[:family] != 'windows' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain '[OK]' } + its(:stdout) { should_not contain 'ERROR' } +end + +# The new APT keys are imported +describe command('apt-key list'), :if => ['debian', 'ubuntu'].include?(os[:family]) do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'C0962C7D' } + its(:stdout) { should contain 'F14F620E' } + its(:stdout) { should contain '382E94DE' } +end + +# The new RPM keys are imported +describe command('rpm -q gpg-pubkey-b01082d3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-b01082d3' } +end + +describe command('rpm -q gpg-pubkey-fd4bf915'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-fd4bf915' } +end + +describe command('rpm -q gpg-pubkey-e09422b3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-e09422b3' } +end diff --git a/cookbooks/datadog/test/integration/dd-agent-iot/serverspec_datadog/install_info_spec.rb b/cookbooks/datadog/test/integration/dd-agent-iot/serverspec_datadog/install_info_spec.rb new file mode 100644 index 00000000..3b915aef --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent-iot/serverspec_datadog/install_info_spec.rb @@ -0,0 +1,39 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +@agent_package_name = 'datadog-iot-agent' + +describe 'Install infos' do + let(:install_info_path) do + if os == :windows + "#{ENV['ProgramData']}\\Datadog\\install_info" + else + '/etc/datadog-agent/install_info' + end + end + + let(:install_info) do + YAML.load_file(install_info_path) + end + + it 'adds an install_info' do + expect(install_info['install_method']).to match( + 'tool_version' => /chef-\d+\.\d+\.\d+/, + 'tool' => 'chef', + 'installer_version' => /^datadog_cookbook-\d+\.\d+\.\d+$/ + ) + end +end diff --git a/cookbooks/datadog/test/integration/dd-agent/serverspec_datadog/dd-agent_spec.rb b/cookbooks/datadog/test/integration/dd-agent/serverspec_datadog/dd-agent_spec.rb new file mode 100644 index 00000000..2f06ef29 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent/serverspec_datadog/dd-agent_spec.rb @@ -0,0 +1,53 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +describe package(@agent_package_name) do + it { should be_installed } +end + +describe service(@agent_service_name) do + it { should be_running } +end + +describe command('/opt/datadog-agent/bin/agent/agent status | grep -v "Instance ID"'), :if => os[:family] != 'windows' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain '[OK]' } + its(:stdout) { should_not contain 'ERROR' } +end + +# The new APT keys are imported +describe command('apt-key list'), :if => ['debian', 'ubuntu'].include?(os[:family]) do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'C0962C7D' } + its(:stdout) { should contain 'F14F620E' } + its(:stdout) { should contain '382E94DE' } +end + +# The new RPM keys are imported +describe command('rpm -q gpg-pubkey-b01082d3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-b01082d3' } +end + +describe command('rpm -q gpg-pubkey-fd4bf915'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-fd4bf915' } +end + +describe command('rpm -q gpg-pubkey-e09422b3'), :if => os[:family] == 'redhat' do + its(:exit_status) { should eq 0 } + its(:stdout) { should contain 'gpg-pubkey-e09422b3' } +end diff --git a/cookbooks/datadog/test/integration/dd-agent/serverspec_datadog/install_info_spec.rb b/cookbooks/datadog/test/integration/dd-agent/serverspec_datadog/install_info_spec.rb new file mode 100644 index 00000000..a277adb0 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-agent/serverspec_datadog/install_info_spec.rb @@ -0,0 +1,37 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +describe 'Install infos' do + let(:install_info_path) do + if os == :windows + "#{ENV['ProgramData']}\\Datadog\\install_info" + else + '/etc/datadog-agent/install_info' + end + end + + let(:install_info) do + YAML.load_file(install_info_path) + end + + it 'adds an install_info' do + expect(install_info['install_method']).to match( + 'tool_version' => /chef-\d+\.\d+\.\d+/, + 'tool' => 'chef', + 'installer_version' => /^datadog_cookbook-\d+\.\d+\.\d+$/ + ) + end +end diff --git a/cookbooks/datadog/test/integration/dd-handler/serverspec_datadog/dd-handler_spec.rb b/cookbooks/datadog/test/integration/dd-handler/serverspec_datadog/dd-handler_spec.rb new file mode 100644 index 00000000..9ccbaf12 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd-handler/serverspec_datadog/dd-handler_spec.rb @@ -0,0 +1,20 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +require 'spec_helper' + +# the be_installed.by('gem') check is not implemented for Windows as of v2.24 of Serverspec +describe package('chef-handler-datadog'), :if => os[:family] != 'windows' do + it { should be_installed.by('gem') } +end diff --git a/cookbooks/datadog/test/integration/dd_integration_resource/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/dd_integration_resource/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/dd_integration_resource/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/dd_integration_resource/serverspec_datadog/resource_integration_spec.rb b/cookbooks/datadog/test/integration/dd_integration_resource/serverspec_datadog/resource_integration_spec.rb new file mode 100644 index 00000000..671e7dea --- /dev/null +++ b/cookbooks/datadog/test/integration/dd_integration_resource/serverspec_datadog/resource_integration_spec.rb @@ -0,0 +1,29 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'serverspec' + +set :backend, :exec +set :path, '/sbin:/usr/local/sbin:$PATH' + +describe service('datadog-agent') do + it { should be_running } +end + +# Checks that it's installed properly and with the good version +describe command('/opt/datadog-agent/bin/agent/agent integration show datadog-aerospike') do + its(:stdout) { should match /Package datadog-aerospike:\nInstalled version:/ } +end diff --git a/cookbooks/datadog/test/integration/helpers/serverspec_datadog/Gemfile b/cookbooks/datadog/test/integration/helpers/serverspec_datadog/Gemfile new file mode 100644 index 00000000..96cef5d3 --- /dev/null +++ b/cookbooks/datadog/test/integration/helpers/serverspec_datadog/Gemfile @@ -0,0 +1,3 @@ +source 'https://rubygems.org' + +gem 'json_spec', '~> 1.1.0' diff --git a/cookbooks/datadog/test/integration/helpers/serverspec_datadog/spec_helper.rb b/cookbooks/datadog/test/integration/helpers/serverspec_datadog/spec_helper.rb new file mode 100644 index 00000000..26ccdf73 --- /dev/null +++ b/cookbooks/datadog/test/integration/helpers/serverspec_datadog/spec_helper.rb @@ -0,0 +1,37 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Shared helper for all serverspec tests +require 'json_spec' +require 'serverspec' +require 'yaml' + +# manually determine if the platform is Windows or not +# Serverspec as of v2.24 cannot detect the OS family of Windows target hosts +# For reference see https://github.com/serverspec/serverspec/blob/master/WINDOWS_SUPPORT.md +if ENV['OS'] == 'Windows_NT' + set :backend, :cmd + # On Windows, set the target host's OS explicitly + set :os, :family => 'windows' + @agent_package_name = 'Datadog Agent' + @agent_service_name = 'DatadogAgent' + @agent_config_dir = "#{ENV['ProgramData']}/Datadog" +else + set :backend, :exec + @agent_package_name = 'datadog-agent' + @agent_service_name = 'datadog-agent' + @agent_config_dir = '/etc/datadog-agent' +end + +set :path, '/sbin:/usr/local/sbin:$PATH' unless os[:family] == 'windows' diff --git a/cookbooks/datadog/test/integration/helpers/serverspec_datadog/spec_template.rb b/cookbooks/datadog/test/integration/helpers/serverspec_datadog/spec_template.rb new file mode 100644 index 00000000..0aa1afff --- /dev/null +++ b/cookbooks/datadog/test/integration/helpers/serverspec_datadog/spec_template.rb @@ -0,0 +1,43 @@ +# Copyright:: 2011-Present, Datadog +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +# Encoding: utf-8 + +require 'spec_helper' + +AGENT_CONFIG = File.join(@agent_config_dir, 'conf.d/REPLACEME.d/conf.yaml') + +describe service(@agent_service_name) do + it { should be_running } +end + +describe file(AGENT_CONFIG) do + it { should be_a_file } + + it 'is valid yaml matching input values' do + generated = YAML.load_file(AGENT_CONFIG) + + expected = { + instances: [ + { + config_param: 'value', + tags: ['kitchen', 'sink'] + } + ], + init_config: nil + } + + expect(generated.to_json).to be_json_eql expected.to_json + end +end