athieriot / docker-elastic-metricbeat

Docker image for Elastic Metricbeat
MIT License
24 stars 29 forks source link

How can that work ? #6

Open ebuildy opened 7 years ago

ebuildy commented 7 years ago

Curious to know if this image is working?

curl $ELASTIC_PATH

and after

curl -XPUT "http://$ELASTIC_PATH/

while [ ! "$(curl $ELASTIC_PATH 2> /dev/null)" -a $counter -lt 30  ]; do
      sleep 1
      let counter++
      echo "waiting for Elasticsearch to be up ($counter/30)"
    done

    curl -XPUT "http://$ELASTIC_PATH/_template/metricbeat" -d@/metricbeat/metricbeat.template-es2x.json
athieriot commented 7 years ago

Hi there, Thank you for the heads up.

First of all, this feature is in fact only use in the specific scenario where you set an ELASTICSEARCH_URL. For example in the case you forward Metric beats events to Logstash but still want the Elasticsearch template to be uploaded. So I suspect most people are not using it and, if it's not working, that's probably why it stayed under the radar. On top of it, this part failing doesn't mean the container will stop running. You might not have your template uploaded but the service will start just fine after 30 failed attempts.

However, would you mind expanding your exact issue? I believe that cURL will fallback automatically on HTTP if not scheme is given. That first call being use as a simple ping anyway.

I'll be happy to publish a fix if there is any problem.

Aurélien