Add queries: default and for KPI1
Plus add "host" label for current metrics
Change-Id: Id4acea6ec9ca41a332190cf18f330b94efca791d
Related-bug: PROD-27904 (PROD:27904)
(cherry picked from commit ac2e16db5b6d8d4f27f87e75c43657348c63e115)
diff --git a/prometheus/elasticsearch_exporter/init.yml b/prometheus/elasticsearch_exporter/init.yml
new file mode 100644
index 0000000..c0f5bb5
--- /dev/null
+++ b/prometheus/elasticsearch_exporter/init.yml
@@ -0,0 +1,4 @@
+classes:
+- service.prometheus.elasticsearch_exporter.container
+- system.prometheus.elasticsearch_exporter.queries.default
+
diff --git a/prometheus/elasticsearch_exporter/queries/compute.yml b/prometheus/elasticsearch_exporter/queries/compute.yml
new file mode 100644
index 0000000..66904da
--- /dev/null
+++ b/prometheus/elasticsearch_exporter/queries/compute.yml
@@ -0,0 +1,118 @@
+parameters:
+ prometheus:
+ elasticsearch_exporter:
+ queries:
+ compute_instance:
+ # Produces metrics:
+ # - compute_instance_event_doc_count{event="example"}
+ # - compute_instance_event_sum_other_doc_count
+ # - compute_instance_event_doc_count_error_upper_bound
+ # - compute_instance_event_host_doc_count{host="example01",event="example"}
+ # - compute_instance_event_host_sum_other_doc_count{event="example"}
+ # - compute_instance_event_host_doc_count_error_upper_bound{event="example"}
+ #
+ indices: '<notification-{now/d}>'
+ interval: 600
+ json: |
+ {
+ "size": 0,
+ "query": {
+ "match_all": {}
+ },
+ "aggs": {
+ "event": {
+ "terms": {
+ "field": "event_type.keyword"
+ },
+ "aggs": {
+ "host": {
+ "terms": {
+ "field": "Hostname.keyword"
+ }
+ }
+ }
+ }
+ }
+ }
+
+ compute_instance_create_start:
+ # Produces metrics:
+ # - compute_instance_create_start_host_doc_count{host="example01"}
+ # - compute_instance_create_start_host_event_sum_other_doc_count
+ # - compute_instance_create_start_host_doc_count_error_upper_bound
+ # - compute_instance_create_start_hits
+ # - compute_instance_create_start_took_milliseconds
+ #
+ indices: '<notification-{now/d}>'
+ interval: 60
+ json: |
+ {
+ "size": 0,
+ "query": {
+ "term": {
+ "event_type": "compute.instance.create.start"
+ }
+ },
+ "aggs": {
+ "host": {
+ "terms": {
+ "field": "Hostname.keyword"
+ }
+ }
+ }
+ }
+
+ compute_instance_create_end:
+ # Produces metrics:
+ # - compute_instance_create_end_host_doc_count{host="example01"}
+ # - compute_instance_create_end_host_event_sum_other_doc_count
+ # - compute_instance_create_end_host_doc_count_error_upper_bound
+ # - compute_instance_create_end_hits
+ # - compute_instance_create_end_took_milliseconds
+ #
+ indices: '<notification-{now/d}>'
+ interval: 60
+ json: |
+ {
+ "size": 0,
+ "query": {
+ "term": {
+ "event_type": "compute.instance.create.end"
+ }
+ },
+ "aggs": {
+ "host": {
+ "terms": {
+ "field": "Hostname.keyword"
+ }
+ }
+ }
+ }
+
+ compute_instance_create_error:
+ # Produces metrics:
+ # - compute_instance_create_error_host_doc_count{host="example01"}
+ # - compute_instance_create_error_host_event_sum_other_doc_count
+ # - compute_instance_create_error_host_doc_count_error_upper_bound
+ # - compute_instance_create_error_hits
+ # - compute_instance_create_error_took_milliseconds
+ #
+ indices: '<notification-{now/d}>'
+ interval: 60
+ json: |
+ {
+ "size": 0,
+ "query": {
+ "term": {
+ "event_type": "compute.instance.create.error"
+ }
+ },
+ "aggs": {
+ "host": {
+ "terms": {
+ "field": "Hostname.keyword"
+ }
+ }
+ }
+ }
+
diff --git a/prometheus/elasticsearch_exporter/queries/default.yml b/prometheus/elasticsearch_exporter/queries/default.yml
new file mode 100644
index 0000000..eeb013c
--- /dev/null
+++ b/prometheus/elasticsearch_exporter/queries/default.yml
@@ -0,0 +1,40 @@
+parameters:
+ prometheus:
+ elasticsearch_exporter:
+ queries:
+ default:
+ interval: 600
+ json: {}
+
+ logs:
+ # Produces metrics:
+ # - logs_program_doc_count{program="example"}
+ # - logs_program_sum_other_doc_count
+ # - logs_program_doc_count_error_upper_bound
+ # - logs_program_host_doc_count{host="example01",program="example"}
+ # - logs_program_host_sum_other_doc_count{program="example"}
+ # - logs_program_host_doc_count_error_upper_bound{program="example"}
+ #
+ indices: '<log-{now/d}>'
+ interval: 600
+ json: |
+ {
+ "size": 0,
+ "query": {
+ "match_all": {}
+ },
+ "aggs": {
+ "program": {
+ "terms": {
+ "field": "programname.keyword"
+ },
+ "aggs": {
+ "host": {
+ "terms": {
+ "field": "Hostname.keyword"
+ }
+ }
+ }
+ }
+ }
+ }
diff --git a/prometheus/server/target/dns/elasticsearch_exporter.yml b/prometheus/server/target/dns/elasticsearch_exporter.yml
index 3c331fd..3af4960 100644
--- a/prometheus/server/target/dns/elasticsearch_exporter.yml
+++ b/prometheus/server/target/dns/elasticsearch_exporter.yml
@@ -6,6 +6,7 @@
enabled: true
endpoint:
- name: 'elasticsearch_exporter'
+ scrape_interval: 60s
domain:
- 'tasks.monitoring_elasticsearch_exporter'
type: A