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:
Open your Git project repository with Reclass model on the cluster level.
In cluster/<cluster_name>/stacklight/client.yml
, add the following
class:
classes:
- system.docker.swarm.stack.monitoring.elasticsearch_exporter
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
Log in to the Salt Master node.
Refresh the Salt pillar:
salt '*' saltutil.refresh_pillar
Add the prometheus-es-exporter
directory structure and configuration:
salt -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus.elasticsearch_exporter
Deploy Prometheus Elasticsearch exporter:
salt -C 'I@docker:swarm and I@prometheus:server' state.sls docker.client
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'
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'
Add Prometheus Elasticsearch exporter to Prometheus targets:
salt -C 'I@docker:swarm and I@prometheus:server' state.sls prometheus.server