Enable Prometheus Elasticsearch exporter

Enable Prometheus Elasticsearch exporterΒΆ

Note

This feature is available starting from the MCP 2019.2.4 maintenance update. Before enabling the feature, follow the steps described in Apply maintenance updates.

Prometheus Elasticsearch exporter queries the Elasticsearch data and exposes it as Prometheus metrics that you can view in the Prometheus web UI. This section describes how to install Prometheus Elasticsearch exporter on an existing MCP cluster. For new clusters starting from the MCP 2019.2.4 maintenance update, Prometheus Elasticsearch exporter is enabled by default.

To enable Prometheus Elasticsearch exporter on an existing MCP cluster:

  1. Open your Git project repository with Reclass model on the cluster level.

  2. In cluster/<cluster_name>/stacklight/client.yml, add the following class:

    classes:
    - system.docker.swarm.stack.monitoring.elasticsearch_exporter
    
  3. In cluster/<cluster_name>/stacklight/server.yml, add the following classes:

    classes:
    - system.prometheus.server.target.dns.elasticsearch_exporter
    - system.prometheus.elasticsearch_exporter
    - system.prometheus.elasticsearch_exporter.queries.compute
    
  4. Log in to the Salt Master node.

  5. Refresh the Salt pillar:

    salt '*' saltutil.refresh_pillar
    
  6. Add the prometheus-es-exporter directory structure and configuration:

    salt -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus.elasticsearch_exporter
    
  7. Deploy Prometheus Elasticsearch exporter:

    salt -C 'I@docker:swarm and I@prometheus:server' state.sls docker.client
    
  8. Verify that the container has been deployed:

    salt -C 'I@docker:swarm:role:master and I@prometheus:server' cmd.run 'docker service ps monitoring_elasticsearch_exporter'
    
  9. Verify that querying of the Elasticsearch cluster does not cause errors:

    salt -C 'I@docker:swarm:role:master and I@prometheus:server' cmd.run 'docker service logs monitoring_elasticsearch_exporter'
    
  10. Add Prometheus Elasticsearch exporter to Prometheus targets:

    salt -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus.server