prometheus-community / elasticsearch_exporter

Elasticsearch stats exporter for Prometheus
Apache License 2.0
1.93k stars 790 forks source link

Elastic Exporter - Prometheus State Down #361

Closed kevinCodeSavvy closed 4 years ago

kevinCodeSavvy commented 4 years ago

Hi All,

Hoping someone could help me!

I am trying to monitor ELk with elastic-exporter following this git repository: https://github.com/vvanholl/elasticsearch-prometheus-exporter

However, I get this issue where my prometheus console is showing:

image

I can curl the endpoint within the prometheus server itself which works fine as shown:

# curl -v http://x.x.x.x:9200/_prometheus/metrics
* About to connect() to x.x.x.x port 9200 (#0)
*   Trying X.X.X.X...
* Connected to x.x.x.x (x.x.x.x) port 9200 (#0)
> GET /_prometheus/metrics HTTP/1.1
> User-Agent: curl/7.29.0
> Host: x.x.x.x:9200
> Accept: */*
>
* Empty reply from server
* Connection #0 to host X.X.X.X left intact
curl: (52) Empty reply from server

When i put this into my browser: http://10.52.218.20:9200/_prometheus/metrics , the page is not served but when I put this instead https://10.52.218.20:9200/_prometheus/metrics then the page is served. So would this mean that the prometheus endpoint needs to be changed with a https instead of http ?

My promethues.yml file is configured as:

- job_name: 'elasticsearch'
    scrape_interval: 15s
    metrics_path: '/_prometheus/metrics'
    basic_auth:
      username: 'xxxxxx'
      password: 'xxxxxxx'
    static_configs:
      - targets: ['x.x.x.x:9200']

Not sure what the issue is. Help would be much appreciated. Thanks.

kevinCodeSavvy commented 4 years ago

Okay I have made some adjustments to the prometheus.yml file by specifying as shown:

- job_name: 'elasticsearch'
    scrape_interval: 15s
    metrics_path: '/_prometheus/metrics'
    scheme: https
    tls_config:
      ca_file: /etc/certs/ca.crt
      insecure_skip_verify: true
    static_configs:
      - targets: ['x.x.x.x:9200']

Still no joy unfortunately

kevinCodeSavvy commented 4 years ago

Okay I have finally got it to work and hope this helps someone else in the future.

I changed the prometheus.yml file to:

- job_name: 'elasticsearch'
    scrape_interval: 15s
    metrics_path: '/_prometheus/metrics'
    scheme: https
    tls_config:
      insecure_skip_verify: true
   basic_auth:
      username: 'elasticsearch_username'
      password: 'elasticsearch-password'
    static_configs:
      - targets: ['x.x.x.x:9200']