├── .circleci └── config.yml ├── .github ├── CODEOWNERS ├── ISSUE_TEMPLATE.md └── PULL_REQUEST_TEMPLATE.md ├── .gitignore ├── .pylintrc ├── .rubocop.yml ├── CHANGELOG.md ├── CONTRIBUTING.md ├── Gemfile ├── LICENSE ├── README.md ├── Rakefile ├── agent.py ├── aggregator.py ├── appveyor.yml ├── checks ├── __init__.py ├── check_status.py ├── collector.py ├── datadog.py ├── ganglia.py ├── libs │ ├── __init__.py │ ├── thread_pool.py │ └── wmi │ │ ├── __init__.py │ │ ├── counter_type.py │ │ └── sampler.py ├── metric_types.py ├── network_checks.py ├── prometheus_check.py ├── prometheus_mixins.py ├── system │ ├── __init__.py │ ├── unix.py │ └── win32.py ├── winwmi_check.py └── wmi_check.py ├── ci ├── cassandra.rb ├── checks_mock.rb ├── common.rb ├── core_integration.rb ├── default.rb ├── docker_daemon.rb ├── kafka.rb ├── resources │ └── datadog.conf.example ├── skeleton.rb ├── solr.rb ├── system.rb ├── tomcat.rb └── windows.rb ├── conf.d └── jmx.yaml.example ├── config.py ├── daemon.py ├── datadog-cert.pem ├── datadog.conf.example ├── ddagent.py ├── dogstatsd.py ├── dogstream ├── __init__.py ├── cassandra.py ├── common.py └── supervisord_log.py ├── emitter.py ├── graphite.py ├── jmxfetch.py ├── modules.py ├── packaging ├── centos │ ├── datadog-agent.init │ └── setup-supervisor.py ├── datadog-agent.service ├── datadog-agent │ ├── smartos │ │ ├── dd-agent │ │ └── dd-agent.xml │ ├── source │ │ ├── agent │ │ ├── install_agent.sh │ │ ├── setup_agent.sh │ │ └── supervisor.conf │ └── win32 │ │ └── install_files │ │ ├── ca-certificates.crt │ │ ├── datadog_win32.conf │ │ ├── dd_agent_win_256.ico │ │ └── guidata │ │ └── images │ │ ├── agent.png │ │ ├── agent.svg │ │ ├── apply.png │ │ ├── delete.png │ │ ├── edit.png │ │ ├── filesave.png │ │ ├── info.png │ │ ├── not_found.png │ │ ├── restart.png │ │ ├── settings.png │ │ ├── start.png │ │ ├── stop.png │ │ └── txt.png ├── debian │ └── datadog-agent.init ├── desc ├── osx │ ├── app │ │ ├── Agent.icns │ │ └── Info.plist │ ├── com.datadoghq.Agent.plist.example │ ├── datadog-agent │ ├── install.sh │ └── supervisor.conf ├── start_agent.sh ├── supervisor.conf ├── supervisor_32.conf └── suse │ └── datadog-agent.init ├── requirements-opt.txt ├── requirements-test.txt ├── requirements.txt ├── setup.py ├── setup_tk.py ├── supervisord.dev.conf ├── tests ├── README.md ├── __init__.py ├── cassandra │ ├── cassandra.yaml │ ├── cassandra_2.0.17.yaml │ ├── cassandra_2.1.14.yaml │ ├── cassandra_2.2.10.yaml │ ├── jmxremote.password │ └── test_cassandra.py ├── checks │ ├── __init__.py │ ├── common.py │ ├── fixtures │ │ ├── checks │ │ │ ├── consul.py │ │ │ └── disk.py │ │ ├── ganglia │ │ │ └── ganglia.txt │ │ └── wmi │ │ │ ├── win32_ntlogevent │ │ │ ├── win32_perfformatteddata_perfdisk_logicaldisk │ │ │ ├── win32_perfformatteddata_perfproc_process │ │ │ ├── win32_perfformatteddata_perfproc_process_alt │ │ │ ├── win32_perfformatteddata_w3svc_webservice │ │ │ ├── win32_perfformatteddata_w3svc_webservice_2008 │ │ │ ├── win32_perfrawdata_perfos_system_current │ │ │ ├── win32_perfrawdata_perfos_system_previous │ │ │ ├── win32_perfrawdata_perfos_system_unknown │ │ │ ├── win32_process │ │ │ ├── win32_service_down │ │ │ └── win32_service_up │ └── mock │ │ ├── __init__.py │ │ ├── test_ganglia.py │ │ ├── test_java_jmx.py │ │ ├── test_no_profiling.py │ │ └── test_sysstat.py ├── core │ ├── __init__.py │ ├── benchmark_aggregator.py │ ├── fixtures │ │ ├── __init__.py │ │ ├── auto_conf │ │ │ ├── consul.yaml │ │ │ └── disk.yaml │ │ ├── azure │ │ │ └── metadata_instance.json │ │ ├── checks │ │ │ ├── __init__.py │ │ │ ├── invalid_check_1.py │ │ │ ├── invalid_check_2.py │ │ │ ├── invalid_conf.yaml │ │ │ ├── manifest.json │ │ │ ├── valid_check_1.py │ │ │ ├── valid_check_2.py │ │ │ ├── valid_conf.yaml │ │ │ ├── valid_conf_2.yaml │ │ │ └── valid_sub_check.py │ │ ├── config │ │ │ ├── bad.conf │ │ │ ├── invalid.conf │ │ │ ├── multiple_apikeys.conf │ │ │ ├── multiple_endpoints.conf │ │ │ ├── multiple_endpoints_bad.conf │ │ │ └── one_endpoint.conf │ │ ├── flare │ │ │ ├── apikey.conf │ │ │ ├── apikeys.conf │ │ │ ├── auth_token.yaml │ │ │ ├── datadog-agent-1.tar.bz2 │ │ │ ├── password.yaml │ │ │ ├── password_uri.yaml │ │ │ ├── proxy.conf │ │ │ ├── whitespace_apikeys.conf │ │ │ └── whitespace_proxy.conf │ │ ├── kubeutil │ │ │ ├── service_cache_events1.json │ │ │ ├── service_cache_events2.json │ │ │ ├── service_cache_services1.json │ │ │ └── service_cache_services2.json │ │ ├── payloads │ │ │ ├── legacy_payload.json │ │ │ └── sc_payload.json │ │ ├── prometheus │ │ │ ├── ksm.txt │ │ │ ├── metrics.txt │ │ │ └── protobuf.bin │ │ └── target_module.py │ ├── test_aggregator.py │ ├── test_azure.py │ ├── test_bucket_aggregator.py │ ├── test_check_status.py │ ├── test_common.py │ ├── test_config.py │ ├── test_count_type.py │ ├── test_datadog.py │ ├── test_dockerutil.py │ ├── test_dogstatsd.py │ ├── test_ec2.py │ ├── test_ecsutil.py │ ├── test_emitter.py │ ├── test_flare.py │ ├── test_histogram.py │ ├── test_kube_event_retriever.py │ ├── test_kube_pod_service_mapper.py │ ├── test_kubeutil.py │ ├── test_leader_elector.py │ ├── test_mesosutil.py │ ├── test_metadata.py │ ├── test_modules.py │ ├── test_nomadutil.py │ ├── test_orchestrator.py │ ├── test_payload.py │ ├── test_prometheus.py │ ├── test_proxy.py │ ├── test_run_files.py │ ├── test_service_discovery.py │ ├── test_tail.py │ ├── test_timeout.py │ ├── test_transaction.py │ ├── test_utils_logger.py │ ├── test_utils_net.py │ ├── test_utils_process.py │ ├── test_watchdog.py │ ├── test_win32.py │ ├── test_wmi.py │ └── test_wmi_calculator.py ├── kafka │ ├── resources │ │ ├── docker-compose-single-broker.yml │ │ └── kafka.yaml │ └── test_kafka.py ├── solr │ ├── solr.yaml │ └── test_solr.py └── tomcat │ ├── test_tomcat.py │ └── tomcat.yaml ├── tox.ini ├── transaction.py ├── util.py ├── utils ├── __init__.py ├── checkfiles.py ├── cloud_metadata.py ├── configcheck.py ├── containers.py ├── debug.py ├── dockerutil.py ├── flare.py ├── hostname.py ├── http.py ├── jmx.py ├── kubernetes │ ├── __init__.py │ ├── kube_event_retriever.py │ ├── kubeutil.py │ ├── leader_elector.py │ └── pod_service_mapper.py ├── logger.py ├── net.py ├── ntp.py ├── orchestrator │ ├── __init__.py │ ├── baseutil.py │ ├── dockerutilproxy.py │ ├── ecsutil.py │ ├── kubeutilproxy.py │ ├── mesosutil.py │ ├── metadata_collector.py │ └── nomadutil.py ├── pidfile.py ├── pip-allow-failures.sh ├── platform.py ├── process.py ├── profile.py ├── prometheus │ ├── __init__.py │ ├── functions.py │ └── metrics_pb2.py ├── proxy.py ├── sdk.py ├── service_discovery │ ├── __init__.py │ ├── abstract_config_store.py │ ├── abstract_sd_backend.py │ ├── config.py │ ├── config_stores.py │ ├── consul_config_store.py │ ├── etcd_config_store.py │ ├── sd_backend.py │ ├── sd_docker_backend.py │ └── zookeeper_config_store.py ├── shell.py ├── singleton.py ├── subprocess_output.py ├── tailfile.py ├── timeout.py ├── timer.py ├── watchdog.py └── windows_configuration.py └── win32 ├── __init__.py ├── gui.py ├── service.py ├── shell.py └── status.html /.circleci/config.yml: -------------------------------------------------------------------------------- 1 | version: 2.1 2 | 3 | default_environment: &default_environment 4 | CI: circle 5 | NOSE_FILTER: "not windows" 6 | TRAVIS_BUILD_DIR: $HOME/project 7 | INTEGRATIONS_DIR: $HOME/embedded 8 | PIP_CACHE: $HOME/.cache/pip 9 | VOLATILE_DIR: /tmp 10 | INTEGRATIONS_CORE_BRANCH: agent-v5 11 | 12 | default_steps: &default_steps 13 | steps: 14 | - checkout 15 | - run: | 16 | git -C $HOME/integrations-core pull || git clone -b $INTEGRATIONS_CORE_BRANCH --depth 1 https://github.com/DataDog/integrations-core.git $HOME/integrations-core 17 | - run: | 18 | sudo apt-get update 19 | sudo apt install -y libcurl4-openssl-dev libssl-dev 20 | wget https://bootstrap.pypa.io/pip/2.7/get-pip.py 21 | python get-pip.py 22 | pip install --upgrade wheel 23 | cd $HOME/integrations-core/datadog_checks_base && python setup.py bdist_wheel && pip install . && cd - 24 | - run: | 25 | bundle install 26 | - run: | 27 | bundle package 28 | # Needed if no cache exists 29 | - run: | 30 | mkdir -p ${HOME}/embedded 31 | - run: | 32 | bundle exec rake setup_libs 33 | - run: | 34 | export CHECKSD_OVERRIDE=$HOME/project/tests/checks/fixtures/checks 35 | bundle exec rake ci:run 36 | 37 | jobs: 38 | test-default: 39 | machine: true 40 | environment: 41 | TRAVIS_FLAVOR: default 42 | <<: *default_environment 43 | <<: *default_steps 44 | test-cassandra-1: 45 | machine: true 46 | environment: 47 | TRAVIS_FLAVOR: cassandra 48 | FLAVOR_VERSION: 2.0.17 49 | <<: *default_environment 50 | <<: *default_steps 51 | test-cassandra-2: 52 | machine: true 53 | environment: 54 | TRAVIS_FLAVOR: cassandra 55 | FLAVOR_VERSION: 2.1.14 56 | <<: *default_environment 57 | <<: *default_steps 58 | test-cassandra-3: 59 | machine: true 60 | environment: 61 | TRAVIS_FLAVOR: cassandra 62 | FLAVOR_VERSION: 2.2.10 63 | <<: *default_environment 64 | <<: *default_steps 65 | test-checks-mock: 66 | machine: true 67 | environment: 68 | TRAVIS_FLAVOR: checks_mock 69 | <<: *default_environment 70 | <<: *default_steps 71 | test-kafka: 72 | machine: true 73 | environment: 74 | TRAVIS_FLAVOR: kafka 75 | FLAVOR_VERSION: 0.10.1.0-1 76 | <<: *default_environment 77 | <<: *default_steps 78 | test-tomcat: 79 | machine: true 80 | environment: 81 | TRAVIS_FLAVOR: tomcat 82 | <<: *default_environment 83 | <<: *default_steps 84 | test-solr: 85 | machine: true 86 | environment: 87 | TRAVIS_FLAVOR: solr 88 | FLAVOR_VERSION: 6.2 89 | <<: *default_environment 90 | <<: *default_steps 91 | test-core-integration: 92 | machine: true 93 | environment: 94 | TRAVIS_FLAVOR: core_integration 95 | <<: *default_environment 96 | <<: *default_steps 97 | 98 | workflows: 99 | version: 2 100 | agent-tests: 101 | jobs: 102 | - test-default 103 | - test-cassandra-1 104 | - test-cassandra-2 105 | - test-cassandra-3 106 | - test-checks-mock 107 | - test-tomcat 108 | - test-solr 109 | - test-core-integration 110 | -------------------------------------------------------------------------------- /.github/CODEOWNERS: -------------------------------------------------------------------------------- 1 | # See https://help.github.com/articles/about-codeowners/ for syntax 2 | # Rules are matched bottom-to-top, so one team can own subdirectories 3 | # and another the rest of the directory. 4 | 5 | # All file changes should be reviewed by the maintainer team unless 6 | # specified otherwise 7 | * @DataDog/agent-runtimes 8 | -------------------------------------------------------------------------------- /.github/ISSUE_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | 26 | 27 | **Output of the [info page](https://help.datadoghq.com/hc/en-us/articles/203764635-Agent-Status-and-Information) ** 28 | 29 | ``` 30 | (paste your output here) 31 | ``` 32 | 33 | **Additional environment details (Operating System, Cloud provider, etc):** 34 | 35 | 36 | **Steps to reproduce the issue:** 37 | 1. 38 | 2. 39 | 3. 40 | 41 | 42 | **Describe the results you received:** 43 | 44 | 45 | **Describe the results you expected:** 46 | 47 | 48 | **Additional information you deem important (e.g. issue happens only occasionally):** 49 | -------------------------------------------------------------------------------- /.github/PULL_REQUEST_TEMPLATE.md: -------------------------------------------------------------------------------- 1 | *Note: Please remember to review the Datadog [Contribution Guidelines](https://github.com/DataDog/dd-agent/blob/master/CONTRIBUTING.md) 2 | if you have not yet done so.* 3 | 4 | ### What does this PR do? 5 | 6 | A brief description of the change being made with this pull request. 7 | 8 | ### Motivation 9 | 10 | What inspired you to submit this pull request? 11 | 12 | ### Testing Guidelines 13 | 14 | An overview on [testing](https://github.com/DataDog/dd-agent/blob/master/tests/README.md) 15 | is available in our contribution guidelines. 16 | 17 | ### Additional Notes 18 | 19 | Anything else we should know when reviewing? 20 | -------------------------------------------------------------------------------- /.gitignore: -------------------------------------------------------------------------------- 1 | *.zip 2 | Gemfile.lock 3 | *.pyc 4 | *.*~ 5 | build/* 6 | datadog.conf 7 | datadog_agent.egg-info/* 8 | artifacts/* 9 | node_modules/* 10 | .DS_Store 11 | venv/* 12 | vendor/ 13 | *.swp 14 | *.log 15 | !nagios.log 16 | *.pid 17 | *.deb 18 | *.rpm 19 | *.egg-info* 20 | dist/* 21 | *.msi 22 | *.wixobj 23 | *.wixpdb 24 | *.jar 25 | *.exe 26 | nosetests*.xml 27 | stats.dat 28 | conf.d/*.yaml 29 | !conf.d/network.yaml 30 | packaging/build/ 31 | packaging/root/ 32 | Vagrantfile 33 | .vagrant/* 34 | embedded/* 35 | .pip-cache/* 36 | .cache 37 | dump.rdb 38 | tests/core/fixtures/flare/dd* 39 | .python-version 40 | .ropeproject 41 | .bundle 42 | .rbenv* 43 | .idea 44 | tags 45 | 46 | checks.d 47 | conf.d 48 | -------------------------------------------------------------------------------- /.rubocop.yml: -------------------------------------------------------------------------------- 1 | # We allow longer lines in our style 2 | Metrics/LineLength: 3 | Max: 150 4 | 5 | # TODO/FIXME: 6 | # At some point, we might just want to do the changes and get rid of those 7 | 8 | # Offense count: 1 9 | # Configuration parameters: CountComments. 10 | Metrics/ClassLength: 11 | Max: 128 12 | 13 | # Offense count: 2 14 | # Configuration parameters: CountComments. 15 | Metrics/MethodLength: 16 | Max: 17 17 | 18 | # Offense count: 2 19 | Style/Documentation: 20 | Enabled: false 21 | 22 | # Offense count: 1 23 | # Configuration parameters: Methods. 24 | Style/SingleLineBlockParams: 25 | Enabled: false 26 | 27 | Lint/RescueWithoutErrorClass: 28 | Enabled: false 29 | 30 | BlockLength: 31 | Max: 110 32 | 33 | Style/EndOfLine: 34 | Enabled: false 35 | 36 | -------------------------------------------------------------------------------- /Gemfile: -------------------------------------------------------------------------------- 1 | source 'https://rubygems.org' 2 | 3 | gem 'addressable' 4 | gem 'colorize' 5 | gem 'httparty', '~>0.14.0' 6 | gem 'rake' 7 | gem 'rubocop', '~>0.50.0' 8 | 9 | # Upper versions are incompatible with ruby version on Travis (1.9.3) 10 | gem 'public_suffix', '~>1.4.0' 11 | -------------------------------------------------------------------------------- /LICENSE: -------------------------------------------------------------------------------- 1 | Simplified BSD License 2 | 3 | Copyright (c) 2009, Boxed Ice 4 | Copyright (c) 2010-2016, Datadog 5 | All rights reserved. 6 | 7 | Redistribution and use in source and binary forms, with or without 8 | modification, are permitted provided that the following conditions are met: 9 | 10 | * Redistributions of source code must retain the above copyright notice, 11 | this list of conditions and the following disclaimer. 12 | * Redistributions in binary form must reproduce the above copyright notice, 13 | this list of conditions and the following disclaimer in the documentation 14 | and/or other materials provided with the distribution. 15 | * Neither the name of the copyright holder nor the names of its contributors 16 | may be used to endorse or promote products derived from this software 17 | without specific prior written permission. 18 | 19 | THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" 20 | AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE 21 | IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE 22 | DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE 23 | FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL 24 | DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR 25 | SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER 26 | CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 27 | OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE 28 | OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 29 | -------------------------------------------------------------------------------- /README.md: -------------------------------------------------------------------------------- 1 | [![Build Status](https://travis-ci.com/DataDog/dd-agent.svg?branch=master)](https://travis-ci.org/DataDog/dd-agent) 2 | 3 | # Important note 4 | 5 | This repository contains the source code for the Datadog Agent up to and including 6 | major version 5. 7 | Although still supported, no major feature is planned for this release line and we 8 | encourage users and contributors to refer to the new Agent codebase, introduced 9 | with the release of version 6.0.0 and tracked in 10 | [a different git repository](https://github.com/DataDog/datadog-agent). 11 | 12 | ## Changes 13 | 14 | Please refer to the [Change log](https://github.com/DataDog/dd-agent/blob/master/CHANGELOG.md) 15 | for more details about the changes introduced at each release. 16 | 17 | ## How to contribute code 18 | 19 | Before submitting any code, please read our [contributing guidelines](CONTRIBUTING.md). 20 | We'll keep accepting contributions as long as the major version 5 is supported 21 | but please consider submitting new features to the new Agent codebase. 22 | 23 | Please note that the Agent is licensed for simplicity's sake 24 | under a simplified BSD license, as indicated in the `LICENSE` file. 25 | Exceptions are marked with LICENSE-xxx where xxx is the component name. 26 | If you do **not** agree with the licensing terms and wish to contribute code nonetheless, 27 | please email us at before submitting your 28 | pull request. 29 | 30 | ### Setup your environment 31 | 32 | Required: 33 | 34 | * python 2.7 35 | * bundler (to get it: `gem install bundler`) 36 | 37 | ``` 38 | # Clone the repository 39 | git clone git@github.com:DataDog/dd-agent.git 40 | 41 | # Create a virtual environment and install the dependencies: 42 | cd dd-agent 43 | bundle install 44 | rake setup_env 45 | 46 | # Activate the virtual environment 47 | source venv/bin/activate 48 | 49 | # Lint 50 | bundle exec rake lint 51 | 52 | # Run a flavored test 53 | bundle exec rake ci:run[apache] 54 | ``` 55 | 56 | ## Integrations 57 | 58 | All checks have been moved to the [Integrations Core](https://github.com/DataDog/integrations-core) repo. 59 | Please look there to submit related issues, PRs, or review the latest changes. 60 | 61 | ## Tests 62 | 63 | More about how to write tests and run them [here](tests/README.md) 64 | 65 | ## How to configure the Agent 66 | 67 | If you are using packages on linux, the main configuration file lives 68 | in `/etc/dd-agent/datadog.conf`. Per-check configuration files are in 69 | `/etc/dd-agent/conf.d`. We provide an example in the same directory 70 | that you can use as a template. 71 | 72 | ## How to write your own checks 73 | 74 | Writing your own checks is easy using our checks.d interface. Read more about 75 | how to use it on our [Guide to Agent Checks](http://docs.datadoghq.com/guides/agent_checks/). 76 | 77 | ## Contributors 78 | 79 | ```bash 80 | git log --all | grep 'Author' | sort -u 81 | ``` 82 | -------------------------------------------------------------------------------- /appveyor.yml: -------------------------------------------------------------------------------- 1 | version: '{branch}.{build}' 2 | shallow_clone: true 3 | environment: 4 | TRAVIS_BUILD_DIR: c:\projects\dd-agent 5 | INTEGRATIONS_DIR: c:\projects\dd-agent\embedded 6 | CHECKSD_OVERRIDE: c:\projects\dd-agent\tests\checks\fixtures\checks 7 | PIP_CACHE: c:\projects\dd-agent\.cache\pip 8 | VOLATILE_DIR: c:\projects 9 | NOSE_FILTER: not unix and not fixme 10 | PYWIN_PATH: C:\projects\dd-agent\.cache\pywin32-py2.7.exe 11 | SKIP_LINT: true 12 | INTEGRATIONS_CORE_BRANCH: agent-v5 13 | matrix: 14 | - PYTHON: C:\\Python27 15 | PYTHON_VERSION: 2.7.9 16 | PYTHON_ARCH: 32 17 | PYWIN32_URL: https://downloads.sourceforge.net/project/pywin32/pywin32/Build%20219/pywin32-219.win32-py2.7.exe 18 | PYWIN32_INSTALL_DIR: pywin32-219-py2.7-win32.egg 19 | - PYTHON: C:\\Python27-x64 20 | PYTHON_VERSION: 2.7.9 21 | PYTHON_ARCH: 64 22 | PYWIN32_URL: http://sourceforge.net/projects/pywin32/files/pywin32/Build%20219/pywin32-219.win-amd64-py2.7.exe/download 23 | PYWIN32_INSTALL_DIR: pywin32-219-py2.7-win-amd64.egg 24 | cache: 25 | - C:\projects\dd-agent\.cache 26 | - C:\projects\dd-agent\vendor\cache 27 | - C:\projects\dd-agent\embedded 28 | services: 29 | - iis 30 | # - mssql2008r2sp2 # FIXME: re-enable when we can launch multiple mssql instances at once 31 | - mssql2012sp1 32 | # - mssql2014 # FIXME: re-enable when we can launch multiple mssql instances at once 33 | install: 34 | # Use the 64-bit ruby so that all the Powershell classes are accessible when running shell commands from ruby 35 | - set PATH=C:\Ruby22-x64\bin;%PATH% 36 | # If bundler is already install '--conservative' will avoid upgrading gems who already meet the version requirement (and avoid conflicts) 37 | - gem install bundler --conservative --quiet --no-ri --no-rdoc 38 | - bundle install 39 | - bundle package 40 | - git clone -b %INTEGRATIONS_CORE_BRANCH% https://github.com/DataDog/integrations-core.git c:\projects\integrations-core 41 | - if not exist %PIP_CACHE% mkdir %PIP_CACHE% 42 | - ps: If (-Not (Test-Path $env:PYWIN_PATH)) {(new-object net.webclient).DownloadFile("$env:PYWIN32_URL", "$env:PYWIN_PATH")} 43 | - "%PYTHON%/Scripts/easy_install.exe %PYWIN_PATH%" 44 | # Remove the adodbapi module shipped with pywin32: it conflicts with the pip-installed adodbapi 45 | - ps: rm $env:PYTHON/lib/site-packages/$env:PYWIN32_INSTALL_DIR/adodbapi/__init__.py 46 | - ps: rm $env:PYTHON/lib/site-packages/$env:PYWIN32_INSTALL_DIR/adodbapi/__init__.pyc 47 | - ps: (& "$env:PYTHON/Scripts/pip.exe" install wheel) 48 | - cd c:\projects\integrations-core\datadog_checks_base 49 | - ps: (& "$env:PYTHON/python.exe" setup.py bdist_wheel) 50 | - ps: (& "$env:PYTHON/Scripts/pip.exe" install .) 51 | - cd %TRAVIS_BUILD_DIR% 52 | build: off 53 | test_script: 54 | - set PATH=%PYTHON%;%PYTHON%\Scripts;%PATH% 55 | - bundle exec rake ci:run[default] 56 | - bundle exec rake ci:run[core_integration] 57 | - bundle exec rake ci:run[windows] 58 | -------------------------------------------------------------------------------- /checks/ganglia.py: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | # stdlib 6 | from cStringIO import StringIO 7 | import socket 8 | 9 | # project 10 | from checks import Check 11 | 12 | 13 | class Ganglia(Check): 14 | BUFFER = 4096 15 | TIMEOUT = 0.5 16 | PORT = 8651 17 | 18 | def __init__(self, logger): 19 | Check.__init__(self, logger) 20 | self.deprecation_shown = False 21 | 22 | def check(self, agentConfig): 23 | self.logger.debug('Ganglia status: start') 24 | if 'ganglia_host' not in agentConfig or agentConfig['ganglia_host'] == '': 25 | self.logger.debug('ganglia_host configuration not set, skipping ganglia') 26 | return False 27 | 28 | if not self.deprecation_shown: 29 | # Just display the deprecation messsage once 30 | self.logger.warning("The Ganglia integration is deprecated and will " 31 | "be removed in a future version of the Datadog Agent") 32 | self.deprecation_shown = True 33 | 34 | try: 35 | host = agentConfig['ganglia_host'] 36 | port = Ganglia.PORT 37 | try: 38 | port = int(agentConfig.get('ganglia_port', Ganglia.PORT)) 39 | except Exception: 40 | pass 41 | self.logger.debug("Retrieving Ganglia XML from %s:%d" % (host, port)) 42 | 43 | sio = StringIO() 44 | 45 | s = socket.socket(socket.AF_INET, socket.SOCK_STREAM) 46 | s.settimeout(Ganglia.TIMEOUT) 47 | try: 48 | s.connect((host, port)) 49 | while True: 50 | data = s.recv(Ganglia.BUFFER) 51 | if len(data) > 0: 52 | sio.write(data) 53 | else: 54 | break 55 | finally: 56 | if s is not None: 57 | s.close() 58 | 59 | self.logger.debug('Ganglia status: done') 60 | return sio.getvalue() 61 | except Exception: 62 | self.logger.exception("Unable to get ganglia data") 63 | return False 64 | -------------------------------------------------------------------------------- /checks/libs/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/dd-agent/e6d72d38c425bc9135216350ad05a1416bd0d193/checks/libs/__init__.py -------------------------------------------------------------------------------- /checks/libs/wmi/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/dd-agent/e6d72d38c425bc9135216350ad05a1416bd0d193/checks/libs/wmi/__init__.py -------------------------------------------------------------------------------- /checks/libs/wmi/counter_type.py: -------------------------------------------------------------------------------- 1 | from datadog_checks.checks.win.wmi.counter_type import calculator, get_calculator, UndefinedCalculator, get_raw # noqa F401 2 | -------------------------------------------------------------------------------- /checks/metric_types.py: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | class MetricTypes(object): 6 | 7 | GAUGE = 'gauge' 8 | COUNTER = 'counter' 9 | RATE = 'rate' 10 | COUNT = 'count' 11 | -------------------------------------------------------------------------------- /checks/prometheus_check.py: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2018 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | from datadog_checks.checks.prometheus.prometheus_base import PrometheusCheck # noqa F401 6 | -------------------------------------------------------------------------------- /checks/prometheus_mixins.py: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2018 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | from datadog_checks.checks.prometheus.mixins import PrometheusFormat, UnknownFormatError # noqa F401 6 | from datadog_checks.checks.prometheus.mixins import PrometheusScraperMixin as PrometheusScraper # noqa F401 7 | -------------------------------------------------------------------------------- /checks/system/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/dd-agent/e6d72d38c425bc9135216350ad05a1416bd0d193/checks/system/__init__.py -------------------------------------------------------------------------------- /checks/winwmi_check.py: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | # project 6 | from datadog_checks.checks.win.wmi import ( # noqa F401 7 | WinWMICheck, 8 | WMIMetric, 9 | MissingTagBy, 10 | from_time, 11 | to_time, 12 | InvalidWMIQuery, 13 | TagQueryUniquenessFailure 14 | ) 15 | -------------------------------------------------------------------------------- /checks/wmi_check.py: -------------------------------------------------------------------------------- 1 | # provided for backward compatibility. wmi_check.py renamed to winwmi_check.py 2 | # to prevent collision with the actual wmi check; provide the redirect for 3 | # any agent check that uses the base library 4 | # 5 | # this file will be deprecated in Agent6 6 | from checks.winwmi_check import ( # noqa: F401 7 | WMIMetric, 8 | InvalidWMIQuery, 9 | MissingTagBy, 10 | TagQueryUniquenessFailure, 11 | WinWMICheck, 12 | to_time, 13 | from_time, 14 | ) # noqa: F401 15 | -------------------------------------------------------------------------------- /ci/checks_mock.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | require './ci/common' 6 | 7 | namespace :ci do 8 | namespace :checks_mock do |flavor| 9 | task before_install: ['ci:common:before_install'] 10 | 11 | task install: ['ci:common:install'] 12 | 13 | task before_script: ['ci:common:before_script'] 14 | 15 | task script: ['ci:common:script'] do 16 | this_provides = [ 17 | 'checks_mock' 18 | ] 19 | Rake::Task['ci:common:run_tests'].invoke(this_provides) 20 | end 21 | 22 | task before_cache: ['ci:common:before_cache'] 23 | 24 | task cleanup: ['ci:common:cleanup'] 25 | 26 | task :execute do 27 | Rake::Task['ci:common:execute'].invoke(flavor) 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /ci/core_integration.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | require './ci/common' 6 | 7 | namespace :ci do 8 | namespace :core_integration do |flavor| 9 | task before_install: ['ci:common:before_install'] 10 | 11 | task install: ['ci:common:install'] 12 | 13 | task before_script: ['ci:common:before_script'] 14 | 15 | task script: ['ci:common:script'] do 16 | this_provides = [ 17 | 'core_integration' 18 | ] 19 | Rake::Task['ci:common:run_tests'].invoke(this_provides) 20 | end 21 | 22 | task before_cache: ['ci:common:before_cache'] 23 | 24 | task cleanup: ['ci:common:cleanup'] 25 | 26 | task :execute do 27 | Rake::Task['ci:common:execute'].invoke(flavor) 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /ci/default.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | require './ci/common' 6 | 7 | namespace :ci do 8 | namespace :default do |flavor| 9 | task before_install: ['ci:common:before_install'] 10 | 11 | task :coverage do 12 | ci_dir = File.dirname(__FILE__) 13 | checks_dir = File.join(ci_dir, '..', 'checks.d') 14 | tests_checks_dir = File.join(ci_dir, '..', 'tests', 'checks') 15 | mock_dir = File.join(tests_checks_dir, 'mock') 16 | integration_dir = File.join(tests_checks_dir, 'integration') 17 | untested = [] 18 | mocked = [] 19 | perfects = [] 20 | Dir.glob(File.join(checks_dir, '*.py')).each do |check| 21 | check_name = /((\w|_)+).py$/.match(check)[1] 22 | if File.exist?(File.join(integration_dir, "test_#{check_name}.py")) 23 | perfects.push(check_name) 24 | elsif File.exist?(File.join(mock_dir, "test_#{check_name}.py")) 25 | mocked.push(check_name) 26 | else 27 | untested.push(check_name) 28 | end 29 | end 30 | total_checks = (untested + mocked + perfects).length 31 | unless untested.empty? 32 | puts "Untested checks (#{untested.length}/#{total_checks})".red 33 | puts '-----------------------'.red 34 | untested.each { |check_name| puts check_name.red } 35 | puts '' 36 | end 37 | unless mocked.empty? 38 | puts "Mocked tests (#{mocked.length}/#{total_checks})".yellow 39 | puts '--------------------'.yellow 40 | mocked.each { |check_name| puts check_name.yellow } 41 | end 42 | end 43 | 44 | task install: ['ci:common:install'] 45 | 46 | task before_script: ['ci:common:before_script'] 47 | 48 | task lint: ['rubocop'] do 49 | if ENV['SKIP_LINT'] 50 | puts 'Skipping lint'.yellow 51 | else 52 | sh %(echo "PWD IS") 53 | sh %(pwd) 54 | sh %(flake8) 55 | sh %(find . -name '*.py' -not\ 56 | \\( -path '*.cache*' -or -path '*embedded*' -or -path '*venv*' -or -path '*.git*' -or -path \ 57 | '*.ropeproject*' -or -path '*fixtures*' \\) | xargs -n 80 -P 8 pylint --rcfile=./.pylintrc) 58 | end 59 | end 60 | 61 | task script: ['ci:common:script', :coverage, :lint] do 62 | Rake::Task['ci:common:run_tests'].invoke(['default']) 63 | end 64 | 65 | task before_cache: ['ci:common:before_cache'] 66 | 67 | task cleanup: ['ci:common:cleanup'] 68 | 69 | task :execute do 70 | Rake::Task['ci:common:execute'].invoke(flavor) 71 | end 72 | end 73 | end 74 | -------------------------------------------------------------------------------- /ci/docker_daemon.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | require './ci/common' 6 | 7 | namespace :ci do 8 | namespace :docker_daemon do |flavor| 9 | task before_install: ['ci:common:before_install'] 10 | 11 | task install: ['ci:common:install'] 12 | 13 | task before_script: ['ci:common:before_script'] 14 | 15 | task script: ['ci:common:script'] do 16 | this_provides = [ 17 | 'docker_daemon' 18 | ] 19 | Rake::Task['ci:common:run_tests'].invoke(this_provides) 20 | end 21 | 22 | task before_cache: ['ci:common:before_cache'] 23 | 24 | task cleanup: ['ci:common:cleanup'] 25 | 26 | task :execute do 27 | Rake::Task['ci:common:execute'].invoke(flavor) 28 | end 29 | end 30 | end 31 | -------------------------------------------------------------------------------- /ci/kafka.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2018 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | require './ci/common' 5 | 6 | def kafka_version 7 | ENV['FLAVOR_VERSION'] || 'latest' 8 | end 9 | 10 | namespace :ci do 11 | namespace :kafka do |flavor| 12 | task before_install: ['ci:common:before_install'] 13 | 14 | task :install do 15 | Rake::Task['ci:common:install'].invoke('kafka') 16 | sh %(EXTERNAL_PORT=9092 EXTERNAL_JMX_PORT=9999 docker-compose -f \ 17 | #{ENV['TRAVIS_BUILD_DIR']}/tests/kafka/resources/docker-compose-single-broker.yml up -d) 18 | Wait.for 2181 19 | Wait.for 9092 20 | wait_on_docker_logs('resources_kafka_1', 5, '[Kafka Server 1001], started') 21 | wait_on_docker_logs('resources_zookeeper_1', 5, 'NodeExists for /brokers/ids') 22 | sh %(EXTERNAL_PORT=9091 EXTERNAL_JMX_PORT=9998 docker-compose -f \ 23 | #{ENV['TRAVIS_BUILD_DIR']}/tests/kafka/resources/docker-compose-single-broker.yml scale kafka=2) 24 | wait_on_docker_logs('resources_kafka_2', 5, '[Kafka Server 1002], started') 25 | sh %(docker run -d --name kafka_consumer -v /var/run/docker.sock:/var/run/docker.sock -e HOST_IP=172.17.0.1 \ 26 | -e ZK=172.17.0.1:2181 -e JMX_PORT=9999 -p 7777:9999 -i -t wurstmeister/kafka:#{kafka_version} /bin/bash -c \ 27 | '$KAFKA_HOME/bin/kafka-console-consumer.sh --topic=test --zookeeper=$ZK --consumer-property group.id=my_consumer ') 28 | wait_on_docker_logs('resources_kafka_1', 30, 'Created topic "test"') 29 | sh %(docker run -d --name kafka_producer -v /var/run/docker.sock:/var/run/docker.sock -e HOST_IP=172.17.0.1 \ 30 | -e ZK=172.17.0.1:2181 -e JMX_PORT=9999 -p 7778:9999 -i -t wurstmeister/kafka:#{kafka_version} /bin/bash -c \ 31 | '$KAFKA_HOME/bin/kafka-topics.sh --create --topic test --partitions 4 --zookeeper $ZK --replication-factor 2 ; \ 32 | while true; do $KAFKA_HOME/bin/kafka-console-producer.sh --topic=test --broker-list=`broker-list.sh` <<< "boomshakalaka" ; \ 33 | sleep 1 ; done') 34 | end 35 | 36 | task before_script: ['ci:common:before_script'] do 37 | wait_on_docker_logs('kafka_consumer', 25, 'boomshakalaka') 38 | wait_on_docker_logs('resources_zookeeper_1', 90, 'Error Path:/consumers/my_consumer/offsets') 39 | end 40 | 41 | task script: ['ci:common:script'] do 42 | this_provides = [ 43 | 'kafka' 44 | ] 45 | Rake::Task['ci:common:run_tests'].invoke(this_provides) 46 | end 47 | 48 | task before_cache: ['ci:common:before_cache'] 49 | 50 | task cleanup: ['ci:common:cleanup'] do 51 | sh %(docker rm -f kafka_consumer) 52 | sh %(docker rm -f kafka_producer) 53 | sh %(EXTERNAL_PORT=9092 EXTERNAL_JMX_PORT=9999 docker-compose -f \ 54 | #{ENV['TRAVIS_BUILD_DIR']}/tests/kafka/resources/docker-compose-single-broker.yml stop) 55 | sh %(EXTERNAL_PORT=9092 EXTERNAL_JMX_PORT=9999 docker-compose -f \ 56 | #{ENV['TRAVIS_BUILD_DIR']}/tests/kafka/resources/docker-compose-single-broker.yml rm -f) 57 | end 58 | 59 | task :execute do 60 | exception = nil 61 | begin 62 | %w[before_install install before_script].each do |u| 63 | Rake::Task["#{flavor.scope.path}:#{u}"].invoke 64 | end 65 | if !ENV['SKIP_TEST'] 66 | Rake::Task["#{flavor.scope.path}:script"].invoke 67 | else 68 | puts 'Skipping tests'.yellow 69 | end 70 | Rake::Task["#{flavor.scope.path}:before_cache"].invoke 71 | rescue => e 72 | exception = e 73 | puts "Failed task: #{e.class} #{e.message}".red 74 | end 75 | if ENV['SKIP_CLEANUP'] 76 | puts 'Skipping cleanup, disposable environments are great'.yellow 77 | else 78 | puts 'Cleaning up' 79 | Rake::Task["#{flavor.scope.path}:cleanup"].invoke 80 | end 81 | raise exception if exception 82 | end 83 | end 84 | end 85 | -------------------------------------------------------------------------------- /ci/skeleton.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | require './ci/common' 6 | 7 | namespace :ci do 8 | namespace :my_new_flavor do |flavor| 9 | task before_install: ['ci:common:before_install'] 10 | 11 | task install: ['ci:common:install'] 12 | 13 | task before_script: ['ci:common:before_script'] 14 | # If you need to wait on a start of a progran, please use Wait.for, 15 | # see https://github.com/DataDog/dd-agent/pull/1547 16 | 17 | task script: ['ci:common:script'] do 18 | this_provides = [ 19 | 'my_new_flavor' 20 | ] 21 | Rake::Task['ci:common:run_tests'].invoke(this_provides) 22 | end 23 | 24 | task before_cache: ['ci:common:before_cache'] 25 | 26 | task cleanup: ['ci:common:cleanup'] 27 | 28 | task :execute do 29 | Rake::Task['ci:common:execute'].invoke(flavor) 30 | end 31 | end 32 | end 33 | -------------------------------------------------------------------------------- /ci/solr.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2018 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | require './ci/common' 5 | 6 | def solr_version 7 | ENV['FLAVOR_VERSION'] || '6.2' 8 | end 9 | 10 | def solr_rootdir 11 | "#{ENV['INTEGRATIONS_DIR']}/solr_#{solr_version}" 12 | end 13 | 14 | rmi_port = 18_983 15 | container_port = 8983 16 | 17 | container_name = 'dd-test-solr' 18 | 19 | jmx_opts = %(-Dcom.sun.management.jmxremote \ 20 | -Dcom.sun.management.jmxremote.local.only=false \ 21 | -Dcom.sun.management.jmxremote.ssl=false \ 22 | -Dcom.sun.management.jmxremote.authenticate=false \ 23 | -Dcom.sun.management.jmxremote.port=18983 \ 24 | -Dcom.sun.management.jmxremote.rmi.port=18983 \ 25 | -Djava.rmi.server.hostname=localhost) 26 | 27 | namespace :ci do 28 | namespace :solr do |flavor| 29 | task before_install: ['ci:common:before_install'] do 30 | sh %(docker kill #{container_name} 2>/dev/null || true) 31 | sh %(docker rm #{container_name} 2>/dev/null || true) 32 | end 33 | 34 | task :install do 35 | Rake::Task['ci:common:install'].invoke('solr') 36 | docker_image = "solr:#{solr_version}" 37 | sh %(docker run -d -e ENABLE_REMOTE_JMX_OPTS=true -e RMI_PORT=18983 \ 38 | -p #{rmi_port}:#{rmi_port} -p #{container_port}:#{container_port} \ 39 | --name #{container_name} #{docker_image} #{jmx_opts}) 40 | wait_on_docker_logs(container_name, 40, 'Server Started') 41 | sleep 10 42 | sh %(docker exec -it --user=solr #{container_name} bin/solr create_core -c gettingstarted) 43 | sleep 10 44 | end 45 | 46 | task before_script: ['ci:common:before_script'] do 47 | # sh %(docker kill #{container_name} 2>/dev/null || true) 48 | # sh %(docker rm #{container_name} 2>/dev/null || true) 49 | end 50 | 51 | task script: ['ci:common:script'] do 52 | this_provides = [ 53 | 'solr' 54 | ] 55 | Rake::Task['ci:common:run_tests'].invoke(this_provides) 56 | end 57 | 58 | task before_cache: ['ci:common:before_cache'] 59 | 60 | task cleanup: ['ci:common:cleanup'] 61 | # sample cleanup task 62 | # task cleanup: ['ci:common:cleanup'] do 63 | # sh %(docker stop solr) 64 | # sh %(docker rm solr) 65 | # end 66 | 67 | task :execute do 68 | exception = nil 69 | begin 70 | %w[before_install install before_script].each do |u| 71 | Rake::Task["#{flavor.scope.path}:#{u}"].invoke 72 | end 73 | if !ENV['SKIP_TEST'] 74 | Rake::Task["#{flavor.scope.path}:script"].invoke 75 | else 76 | puts 'Skipping tests'.yellow 77 | end 78 | Rake::Task["#{flavor.scope.path}:before_cache"].invoke 79 | rescue => e 80 | exception = e 81 | puts "Failed task: #{e.class} #{e.message}".red 82 | end 83 | if ENV['SKIP_CLEANUP'] 84 | puts 'Skipping cleanup, disposable environments are great'.yellow 85 | else 86 | puts 'Cleaning up' 87 | Rake::Task["#{flavor.scope.path}:cleanup"].invoke 88 | end 89 | raise exception if exception 90 | end 91 | end 92 | end 93 | -------------------------------------------------------------------------------- /ci/system.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | require './ci/common' 6 | 7 | # This is "less" important to change the version 8 | # because it is shipped with the self-contained agent 9 | def sysstat_version 10 | '11.0.1' 11 | end 12 | 13 | def system_rootdir 14 | "#{ENV['INTEGRATIONS_DIR']}/system_#{sysstat_version}" 15 | end 16 | 17 | namespace :ci do 18 | namespace :system do |flavor| 19 | task before_install: ['ci:common:before_install'] 20 | 21 | task install: ['ci:common:install'] do 22 | unless Dir.exist? File.expand_path(system_rootdir) 23 | sh %(curl -s -L\ 24 | -o $VOLATILE_DIR/system-#{sysstat_version}.tar.xz\ 25 | https://s3.amazonaws.com/dd-agent-tarball-mirror/sysstat-11.0.1.tar.xz) 26 | sh %(mkdir -p $VOLATILE_DIR/system) 27 | sh %(mkdir -p #{system_rootdir}) 28 | sh %(mkdir -p #{system_rootdir}/var/log/sa) 29 | sh %(tar Jxf $VOLATILE_DIR/system-#{sysstat_version}.tar.xz\ 30 | -C $VOLATILE_DIR/system --strip-components=1) 31 | sh %(cd $VOLATILE_DIR/system\ 32 | && conf_dir=#{system_rootdir}/etc/sysconfig sa_dir=#{system_rootdir}/var/log/sa\ 33 | ./configure --prefix=#{system_rootdir} --disable-man-group\ 34 | && make\ 35 | && make install) 36 | end 37 | end 38 | 39 | task before_script: ['ci:common:before_script'] do 40 | sh %(mkdir -p $INTEGRATIONS_DIR/bin) 41 | sh %(rm -f $INTEGRATIONS_DIR/bin/mpstat) 42 | sh %(ln -s #{system_rootdir}/bin/mpstat $INTEGRATIONS_DIR/bin/mpstat) 43 | end 44 | 45 | task script: ['ci:common:script'] do 46 | this_provides = [ 47 | 'system' 48 | ] 49 | Rake::Task['ci:common:run_tests'].invoke(this_provides) 50 | end 51 | 52 | task before_cache: ['ci:common:before_cache'] 53 | 54 | task cleanup: ['ci:common:cleanup'] 55 | 56 | task :execute do 57 | Rake::Task['ci:common:execute'].invoke(flavor) 58 | end 59 | end 60 | end 61 | -------------------------------------------------------------------------------- /ci/tomcat.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2018 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | require './ci/common' 5 | 6 | def tomcat_version 7 | ENV['FLAVOR_VERSION'] || 'latest' 8 | end 9 | 10 | def tomcat_rootdir 11 | "#{ENV['INTEGRATIONS_DIR']}/tomcat_#{tomcat_version}" 12 | end 13 | 14 | container_name = 'dd-test-tomcat' 15 | container_port = 8090 16 | java_opts = "-Dcom.sun.management.jmxremote 17 | -Dcom.sun.management.jmxremote.port=#{container_port} 18 | -Dcom.sun.management.jmxremote.rmi.port=#{container_port} 19 | -Dcom.sun.management.jmxremote.authenticate=false 20 | -Dcom.sun.management.jmxremote.ssl=false 21 | -Dcom.sun.management.jmxremote.local.only=false 22 | -Djava.rmi.server.hostname=0.0.0.0" 23 | 24 | namespace :ci do 25 | namespace :tomcat do |flavor| 26 | task before_install: ['ci:common:before_install'] 27 | 28 | task :install do 29 | Rake::Task['ci:common:install'].invoke('tomcat') 30 | sh %(docker run -d -p #{container_port}:8090 --name #{container_name} -e CATALINA_OPTS='#{java_opts}' tomcat:alpine) 31 | end 32 | 33 | task before_script: ['ci:common:before_script'] do 34 | count = 0 35 | logs = `docker logs #{container_name} 2>&1` 36 | puts 'Waiting for Tomcat to come up' 37 | until count == 20 || logs.include?('Server startup in') 38 | sleep_for 2 39 | logs = `docker logs #{container_name} 2>&1` 40 | count += 1 41 | end 42 | if logs.include? 'Server startup in' 43 | puts 'Tomcat is up!' 44 | else 45 | sh %(docker logs #{container_name} 2>&1) 46 | raise 47 | end 48 | end 49 | 50 | task script: ['ci:common:script'] do 51 | this_provides = [ 52 | 'tomcat' 53 | ] 54 | Rake::Task['ci:common:run_tests'].invoke(this_provides) 55 | end 56 | 57 | task before_cache: ['ci:common:before_cache'] 58 | 59 | task cleanup: ['ci:common:cleanup'] do 60 | `docker rm -f #{container_name}` 61 | end 62 | 63 | task :execute do 64 | exception = nil 65 | begin 66 | %w[before_install install before_script].each do |u| 67 | Rake::Task["#{flavor.scope.path}:#{u}"].invoke 68 | end 69 | if !ENV['SKIP_TEST'] 70 | Rake::Task["#{flavor.scope.path}:script"].invoke 71 | else 72 | puts 'Skipping tests'.yellow 73 | end 74 | Rake::Task["#{flavor.scope.path}:before_cache"].invoke 75 | rescue => e 76 | exception = e 77 | puts "Failed task: #{e.class} #{e.message}".red 78 | end 79 | if ENV['SKIP_CLEANUP'] 80 | puts 'Skipping cleanup, disposable environments are great'.yellow 81 | else 82 | puts 'Cleaning up' 83 | Rake::Task["#{flavor.scope.path}:cleanup"].invoke 84 | end 85 | raise exception if exception 86 | end 87 | end 88 | end 89 | -------------------------------------------------------------------------------- /ci/windows.rb: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | require './ci/common' 6 | 7 | namespace :ci do 8 | namespace :windows do |flavor| 9 | task before_install: ['ci:common:before_install'] 10 | 11 | task install: ['ci:common:install'] 12 | 13 | task before_script: ['ci:common:before_script'] do 14 | # Set up an IIS website 15 | site_name = 'Test-Website-1' 16 | site_folder = File.join(ENV['INTEGRATIONS_DIR'], "iis_#{site_name}") 17 | sh %(powershell New-Item -ItemType Directory -Force #{site_folder}) 18 | sh %(powershell Import-Module WebAdministration) 19 | # Create the new website 20 | sh %(powershell New-Website -Name #{site_name} -Port 8080 -PhysicalPath #{site_folder}) 21 | end 22 | 23 | task script: ['ci:common:script'] do 24 | this_provides = [ 25 | 'windows' 26 | ] 27 | Rake::Task['ci:common:run_tests'].invoke(this_provides) 28 | end 29 | 30 | task before_cache: ['ci:common:before_cache'] 31 | 32 | task cleanup: ['ci:common:cleanup'] 33 | 34 | task :execute do 35 | Rake::Task['ci:common:execute'].invoke(flavor) 36 | end 37 | end 38 | end 39 | -------------------------------------------------------------------------------- /conf.d/jmx.yaml.example: -------------------------------------------------------------------------------- 1 | init_config: 2 | # custom_jar_paths: # Optional, allows specifying custom jars that will be added to the classpath of the agent's JVM, 3 | # BREAKING CHANGE NOTICE : The agent currently supports a string if there is only one custom JAR. In future versions, this will be deprecated and MUST be a list in all cases. 4 | # - /path/to/custom/jarfile.jar 5 | # - /path/to/another/custom/jarfile2.jar 6 | # canonical_rate: false # boolean to decide whether to use the canonical definition of rate. 7 | # # Canonical rates will not submit a negative rate value (considered a reset) 8 | # # Defaults to false to avoid breaking backward compatibility 9 | 10 | instances: 11 | # - host: localhost 12 | # port: 7199 13 | # user: username 14 | # password: password 15 | 16 | # # If the agent needs to connect to a non-default JMX URL, specify it here instead of a host and a port 17 | # # If you use this you need to specify a 'name' for the instance, below 18 | # jmx_url: "service:jmx:rmi:///jndi/rmi://myhost.host:9999/custompath" 19 | 20 | # process_name_regex: .*process_name.* # Instead of specifying a host and port or jmx_url, the agent can connect using the attach api. 21 | # # This requires the JDK to be installed and the path to tools.jar to be set below. 22 | # tools_jar_path: /usr/lib/jvm/java-7-openjdk-amd64/lib/tools.jar # To be set when process_name_regex is set 23 | 24 | # name: jmx_instance 25 | # # java_bin_path: /path/to/java # Optional, should be set if the agent cannot find your java executable 26 | # # java_options: "-Xmx200m -Xms50m" # Optional, Java JVM options 27 | # # trust_store_path: /path/to/trustStore.jks # Optional, should be set if ssl is enabled 28 | # # trust_store_password: password 29 | # # refresh_beans: 600 # Optional (in seconds), default is 600 seconds. Sets refresh period for refreshing matching MBeans list. 30 | # # Decreasing this value may result in increased CPU usage. 31 | # tags: 32 | # env: stage 33 | # newTag: test 34 | 35 | # List of metrics to be collected by the integration 36 | # Read http://docs.datadoghq.com/integrations/java/ to learn how to customize it 37 | # conf: 38 | # - include: 39 | # domain: my_domain 40 | # bean: 41 | # - my_bean 42 | # - my_second_bean 43 | # attribute: 44 | # attribute1: 45 | # metric_type: counter 46 | # alias: jmx.my_metric_name 47 | # attribute2: 48 | # metric_type: gauge 49 | # alias: jmx.my2ndattribute 50 | # - include: 51 | # domain: 2nd_domain 52 | # exclude: 53 | # bean: 54 | # - excluded_bean 55 | # - include: 56 | # domain_regex: regex_on_domain 57 | # exclude: 58 | # bean_regex: 59 | # - regex_on_excluded_bean 60 | -------------------------------------------------------------------------------- /datadog-cert.pem: -------------------------------------------------------------------------------- 1 | -----BEGIN CERTIFICATE----- 2 | MIIF3jCCA8agAwIBAgIQAf1tMPyjylGoG7xkDjUDLTANBgkqhkiG9w0BAQwFADCBiDELMAkGA1UE 3 | BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK 4 | ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh 5 | dGlvbiBBdXRob3JpdHkwHhcNMTAwMjAxMDAwMDAwWhcNMzgwMTE4MjM1OTU5WjCBiDELMAkGA1UE 6 | BhMCVVMxEzARBgNVBAgTCk5ldyBKZXJzZXkxFDASBgNVBAcTC0plcnNleSBDaXR5MR4wHAYDVQQK 7 | ExVUaGUgVVNFUlRSVVNUIE5ldHdvcmsxLjAsBgNVBAMTJVVTRVJUcnVzdCBSU0EgQ2VydGlmaWNh 8 | dGlvbiBBdXRob3JpdHkwggIiMA0GCSqGSIb3DQEBAQUAA4ICDwAwggIKAoICAQCAEmUXNg7D2wiz 9 | 0KxXDXbtzSfTTK1Qg2HiqiBNCS1kCdzOiZ/MPans9s/B3PHTsdZ7NygRK0faOca8Ohm0X6a9fZ2j 10 | Y0K2dvKpOyuR+OJv0OwWIJAJPuLodMkYtJHUYmTbf6MG8YgYapAiPLz+E/CHFHv25B+O1ORRxhFn 11 | RghRy4YUVD+8M/5+bJz/Fp0YvVGONaanZshyZ9shZrHUm3gDwFA66Mzw3LyeTP6vBZY1H1dat//O 12 | +T23LLb2VN3I5xI6Ta5MirdcmrS3ID3KfyI0rn47aGYBROcBTkZTmzNg95S+UzeQc0PzMsNT79uq 13 | /nROacdrjGCT3sTHDN/hMq7MkztReJVni+49Vv4M0GkPGw/zJSZrM233bkf6c0Plfg6lZrEpfDKE 14 | Y1WJxA3Bk1QwGROs0303p+tdOmw1XNtB1xLaqUkL39iAigmTYo61Zs8liM2EuLE/pDkP2QKe6xJM 15 | lXzzawWpXhaDzLhn4ugTncxbgtNMs+1b/97lc6wjOy0AvzVVdAlJ2ElYGn+SNuZRkg7zJn0cTRe8 16 | yexDJtC/QV9AqURE9JnnV4eeUB9XVKg+/XRjL7FQZQnmWEIuQxpMtPAlR1n6BB6T1CZGSlCBst6+ 17 | eLf8ZxXhyVeEHg9j1uliutZfVS7qXMYoCAQlObgOK6nyTJccBz8NUvXt7y+CDwIDAQABo0IwQDAd 18 | BgNVHQ4EFgQUU3m/WqorSs9UgOHYm8Cd8rIDZsswDgYDVR0PAQH/BAQDAgEGMA8GA1UdEwEB/wQF 19 | MAMBAf8wDQYJKoZIhvcNAQEMBQADggIBAFzUfA3P9wF9QZllDHPFUp/L+M+ZBn8b2kMVn54CVVeW 20 | FPFSPCeHlCjtHzoBN6J2/FNQwISbxmtOuowhT6KOVWKR82kV2LyI48SqC/3vqOlLVSoGIG1VeCkZ 21 | 7l8wXEskEVX/JJpuXior7gtNn3/3ATiUFJVDBwn7YKnuHKsSjKCaXqeYalltiz8I+8jRRa8YFWSQ 22 | Eg9zKC7F4iRO/Fjs8PRF/iKz6y+O0tlFYQXBl2+odnKPi4w2r78NBc5xjeambx9spnFixdjQg3IM 23 | 8WcRiQycE0xyNN+81XHfqnHd4blsjDwSXWXavVcStkNr/+XeTWYRUc+ZruwXtuhxkYzeSf7dNXGi 24 | FSeUHM9h4ya7b6NnJSFd5t0dCy5oGzuCr+yDZ4XUmFF0sbmZgIn/f3gZXHlKYC6SQK5MNyosycdi 25 | yA5d9zZbyuAlJQG03RoHnHcAP9Dc1ew91Pq7P8yF1m9/qS3fuQL39ZeatTXaw2ewh0qpKJ4jjv9c 26 | J2vhsE/zB+4ALtRZh8tSQZXq9EfX7mRBVXyNWQKV3WKdwrnuWih0hKWbt5DHDAff9Yk2dDLWKMGw 27 | sAvgnEzDHNb842m1R0aBL6KCq9NjRHDEjf8tM7qtj3u1cIiuPhnPQCjY/MiQu12ZIvVS5ljFH4gx 28 | Q+6IHdfGjjxDah2nGN59PRbxYvnKkKj9 29 | -----END CERTIFICATE----- 30 | -------------------------------------------------------------------------------- /dogstream/__init__.py: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/DataDog/dd-agent/e6d72d38c425bc9135216350ad05a1416bd0d193/dogstream/__init__.py -------------------------------------------------------------------------------- /dogstream/cassandra.py: -------------------------------------------------------------------------------- 1 | # (C) Datadog, Inc. 2010-2016 2 | # All rights reserved 3 | # Licensed under Simplified BSD License (see LICENSE) 4 | 5 | from datetime import datetime 6 | import re 7 | 8 | from dogstream import common 9 | 10 | LOG4J_PRIORITY = [ 11 | "TRACE", 12 | "DEBUG", 13 | "INFO", 14 | "WARN", 15 | "ERROR", 16 | "FATAL", 17 | ] 18 | 19 | ALERT_TYPES = { 20 | "FATAL": "error", 21 | "ERROR": "error", 22 | "WARN": "warning", 23 | "INFO": "info", 24 | "DEBUG": "info", 25 | "TRACE": "info", 26 | } 27 | 28 | EVENT_TYPE = "cassandra.compaction" 29 | 30 | THREADS = [ 31 | "CompactionExecutor", 32 | ] 33 | 34 | DATE_FORMAT = '%Y-%m-%d %H:%M:%S,%f' 35 | 36 | # Parse Cassandra default system.log log4j pattern: %5p [%t] %d{ISO8601} %F (line %L) %m%n 37 | LOG_PATTERN = re.compile(r"".join([ 38 | r"\s*(?P%s)\s+" % "|".join("(%s)" % p for p in LOG4J_PRIORITY), 39 | r"(\[CompactionExecutor:\d*\]\s+)?", # optional thread name and number 40 | r"((?P\d{4}-\d{2}-\d{2}\s+\d{2}:\d{2}:\d{2},\d*)|", 41 | r"(?P