Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,17 @@ env:
- TRAVIS_FLAVOR=pgbouncer FLAVOR_VERSION=latest
- TRAVIS_FLAVOR=apache FLAVOR_VERSION=2.4.12
- TRAVIS_FLAVOR=couch FLAVOR_VERSION=1.6.1
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=0.90.13
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=1.0.3
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=1.1.2
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=1.2.4
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=1.3.9
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=1.4.5
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=1.5.2
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=1.6.2
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=1.7.4
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=2.0.2
- TRAVIS_FLAVOR=elastic FLAVOR_VERSION=2.1.1
# END OF TRAVIS MATRIX

before_install:
Expand Down
1 change: 1 addition & 0 deletions circle.yml
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@ test:
- rake ci:run[pgbouncer]
- rake ci:run[apache]
- rake ci:run[couch]
- rake ci:run[elastic]
- bundle exec rake requirements
post:
- if [[ $(docker ps -a -q) ]]; then docker stop $(docker ps -a -q); fi
32 changes: 32 additions & 0 deletions elastic/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# Elastic Integration

## Overview

Get metrics from elastic service in real time to:

* Visualize and monitor elastic states
* Be notified about elastic failovers and events.

## Installation

Install the `dd-check-elastic` package manually or with your favorite configuration manager

## Configuration

Edit the `elastic.yaml` file to point to your server and port, set the masters to monitor

## Validation

When you run `datadog-agent info` you should see something like the following:

Checks
======

elastic
-----------
- instance #0 [OK]
- Collected 39 metrics, 0 events & 7 service checks

## Compatibility

The elastic check is compatible with all major platforms
732 changes: 732 additions & 0 deletions elastic/check.py

Large diffs are not rendered by default.

87 changes: 87 additions & 0 deletions elastic/ci/elastic.rake
Original file line number Diff line number Diff line change
@@ -0,0 +1,87 @@
require 'ci/common'

def elastic_version
ENV['FLAVOR_VERSION'] || '1.3.9'
end

def elastic_rootdir
"#{ENV['INTEGRATIONS_DIR']}/elastic_#{elastic_version}"
end

container_name = 'dd-test-elastic'
container_port1 = 9200
container_port2 = 9300

namespace :ci do
namespace :elastic do |flavor|
task before_install: ['ci:common:before_install'] do
sh %(docker kill #{container_name} 2>/dev/null || true)
sh %(docker rm #{container_name} 2>/dev/null || true)
end

task install: ['ci:common:install'] do
use_venv = in_venv
install_requirements('elastic/requirements.txt',
"--cache-dir #{ENV['PIP_CACHE']}",
"#{ENV['VOLATILE_DIR']}/ci.log", use_venv)
docker_cmd = 'elasticsearch -Des.node.name="batman" '
if ['0.90.13', '1.0.3', '1.1.2', '1.2.4'].any? { |v| v == elastic_version }
docker_image = "datadog/docker-library:elasticsearch_" + elastic_version.split('.')[0..1].join('_')
if elastic_version == '0.90.13'
docker_cmd += " -f"
end
else
docker_image = "elasticsearch:#{elastic_version}"
end
container_ports = "-p #{container_port1}:#{container_port1} -p #{container_port2}:#{container_port2}"
sh %(docker run -d #{container_ports} --name #{container_name} #{docker_image} #{docker_cmd})
if elastic_version[0].to_i < 2
ENV['DD_ELASTIC_LOCAL_HOSTNAME'] = `docker inspect dd-test-elastic | grep Id`[/([0-9a-f\.]{2,})/][0..11]
else
ENV['DD_ELASTIC_LOCAL_HOSTNAME'] = `docker inspect dd-test-elastic | grep IPAddress`[/([0-9\.]+)/]
end
end

task before_script: ['ci:common:before_script'] do
Wait.for 'http://localhost:9200', 20
# Create an index in ES
http = Net::HTTP.new('localhost', 9200)
http.send_request('PUT', '/datadog/')
end

task script: ['ci:common:script'] do
this_provides = [
'elastic'
]
Rake::Task['ci:common:run_tests'].invoke(this_provides)
end

task before_cache: ['ci:common:before_cache']

task cleanup: ['ci:common:cleanup'] do
sh %(docker kill #{container_name} 2>/dev/null || true)
sh %(docker rm #{container_name} 2>/dev/null || true)
end

task :execute do
exception = nil
begin
%w(before_install install before_script).each do |u|
Rake::Task["#{flavor.scope.path}:#{u}"].invoke
end
Rake::Task["#{flavor.scope.path}:script"].invoke
Rake::Task["#{flavor.scope.path}:before_cache"].invoke
rescue => e
exception = e
puts "Failed task: #{e.class} #{e.message}".red
end
if ENV['SKIP_CLEANUP']
puts 'Skipping cleanup, disposable environments are great'.yellow
else
puts 'Cleaning up'
Rake::Task["#{flavor.scope.path}:cleanup"].invoke
end
raise exception if exception
end
end
end
2 changes: 2 additions & 0 deletions elastic/ci/elastic.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
node:
name: batman
43 changes: 43 additions & 0 deletions elastic/conf.yaml.example
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
init_config:

instances:
# The URL where elasticsearch accepts HTTP requests. This will be used to
# fetch statistics from the nodes and information about the cluster health.
#
# If you're using basic authentication with a 3rd party library, for example
# elasticsearch-http-basic, you will need to specify a value for username
# and password for every instance that requires authentication.
#
# If your cluster is hosted externally (i.e., you're not pointing to localhost)
# you will need to set `cluster_stats` to true otherwise the check will only
# submit metrics of the local node.
# DEPRECATION:
# This parameter was also called `is_external` and you can still use it but it
# will be removed in version 6.
#
# If you enable the "pshard_stats" flag, statistics over primary shards
# will be collected by the check and sent to the backend with the
# 'elasticsearch.primary' prefix. It is particularly useful if you want to
# get certain metrics without taking replicas into account. For instance,
# 'elasticsearch.primaries.docs.count` will give you the total number of
# documents in your indexes WITHOUT counting duplicates due to the existence
# of replica shards in your ES cluster

# `pending_task_stats` (defaults to True) specifies whether to collect data exposed
# by the `pending_tasks` cluster endpoint
# Ref: https://www.elastic.co/guide/en/elasticsearch/reference/current/cluster-pending.html
# Some managed ElasticSearch services (e.g. AWS ElasticSearch) do not expose this endpoint.
# Set `pending_task_stats` to false if you use such a service.

- url: http://localhost:9200
# username: username
# password: password
# cluster_stats: false
# pshard_stats: false
# pending_task_stats: true
# ssl_verify: false
# ssl_cert: /path/to/cert.pem
# ssl_key: /path/to/cert.key
# tags:
# - 'tag1:key1'
# - 'tag2:key2'
10 changes: 10 additions & 0 deletions elastic/manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"maintainer": "help@datadoghq.com",
"manifest_version": "0.1.0",
"max_agent_version": "6.0.0",
"min_agent_version": "5.6.3",
"name": "elastic",
"short_description": "elastic description.",
"support": "contrib",
"version": "0.1.0"
}
Loading