intelsdi-x / snap-plugin-collector-elasticsearch

Collects Elasticsearch cluster and nodes statistics
http://snap-telemetry.io/
Apache License 2.0
3 stars 14 forks source link

Support for elasticsearch 5.0 #31

Open nanliu opened 8 years ago

nanliu commented 8 years ago

Snap version (use snapctl -v): 0.17.0

What happened:

The latest elasticsearch update to 5.0 has broken medium/large test. I've pinned all test to version 2.4 per #30.

Steps to reproduce it (as minimally and precisely as possible):

  1. Patch medium test to use elasticsearch 5.0 and new health endpoint:
    
    diff --git a/scripts/medium.sh b/scripts/medium.sh
    index 900506e..61f9d7a 100644
    --- a/scripts/medium.sh
    +++ b/scripts/medium.sh
    @@ -4,7 +4,7 @@ set -e
    set -u
    set -o pipefail

-id=$(docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 elasticsearch:2.4) +id=$(docker run -d --name elasticsearch -p 9200:9200 -p 9300:9300 elasticsearch:5.0) DOCKER_HOST=${DOCKER_HOST-} if [[ -z "${DOCKER_HOST}" ]]; then SNAP_ELASTICSEARCH_HOST="127.0.0.1" @@ -16,7 +16,7 @@ export SNAP_ELASTICSEARCH_HOST _info "Elasticsearch Host: ${SNAP_ELASTICSEARCH_HOST}"

_info "Waiting for elasticsearch docker container" -while ! curl -sG "http://${SNAP_ELASTICSEARCH_HOST}:9200/_status" > /dev/null 2>&1; do +while ! curl -sG "http://${SNAP_ELASTICSEARCH_HOST}:9200/_cluster/health" > /dev/null 2>&1; do sleep 1 echo -n "." done


2. `make test-medium`

bash -c "./scripts/test.sh medium" 2016-10-31 17:06:32 UTC [ info] Elasticsearch Host: 127.0.0.1 2016-10-31 17:06:32 UTC [ info] Waiting for elasticsearch docker container ............... 2016-10-31 17:06:49 UTC [ info] running go_test 2016-10-31 17:06:49 UTC [ info] running test type: medium ? github.com/intelsdi-x/snap-plugin-collector-elasticsearch [no test files] === RUN TestESCollectMetrics

Elasticsearch collector collect metrics ✔✘ collect cluster metrics ✔✔✔✔

Failures:

6 total assertions

--- FAIL: TestESCollectMetrics (0.12s) FAIL coverage: 57.3% of statements exit status 1 FAIL github.com/intelsdi-x/snap-plugin-collector-elasticsearch/elasticsearch 0.139s make: *** [test-medium] Error 1



**Anything else do we need to know** (e.g. issue happens only occasionally):

Large test on jenkins also appears to fail on 5.0:
https://ci.snap-telemetry.io/job/snap-plugin-collector-elasticsearch-large-prb-k8s/5/console
IzabellaRaulin commented 7 years ago

A notification about supported versions of Elasticsearch by this plugin should be included in README.md

maria commented 7 years ago

Hi, is ES 5.X version supported? Because I tried to run the plugin using a 5 version of ES and I am not able to start it. Even if from the codebase it looks like we are ok, it has the same endpoints.

katarzyna-z commented 7 years ago

@maria I've tested this collector with ES 5.3.2, see the rest of details for ES:

$ curl -XGET '127.0.0.1:9200' 
{
  "name" : "3DP_1ih",
  "cluster_name" : "elasticsearch",
  "cluster_uuid" : "dRHyfJmrSxKNppsEMHyYnA",
  "version" : {
    "number" : "5.3.2",
    "build_hash" : "3068195",
    "build_date" : "2017-04-24T16:15:59.481Z",
    "build_snapshot" : false,
    "lucene_version" : "6.4.2"
  },
  "tagline" : "You Know, for Search"
}

and this plugin works for me without problems. I've followed steps described in Examples section.

Could you provide more details about your version of Elasticsearch? Output from curl -XGET '127.0.0.1:9200' would be the best.

maria commented 7 years ago

Hi, I don't have ES 5.2.3, but 51. and I tried to send that to OpenTSDB, that might be the problem why the plugin wasn't able to start. I will try sending data to the file as you did and see if that works. Thank you