feat(data): OpenSearch prometheus-exporter sidecar

elasticsearch-exporter v1.7.0 runs as a sidecar, scrapes localhost:9200,
exposes elasticsearch_* metrics on :9114. ServiceMonitor re-enabled.
Alert rules updated to use elasticsearch_* metric names.
Flags: --es.all --es.indices --es.shards --collector.clustersettings
This commit is contained in:
2026-03-25 17:53:59 +00:00
parent 0a322c8a7c
commit 7cb6bb1bd2
5 changed files with 32 additions and 11 deletions

View File

@@ -12,9 +12,10 @@ resources:
- opensearch-service.yaml
- opensearch-pvc.yaml
- barman-vault-secret.yaml
# opensearch-servicemonitor.yaml removed — OpenSearch 3.x has no prometheus-exporter plugin.
# TODO: add opensearch-exporter sidecar for Prometheus metrics.
- opensearch-servicemonitor.yaml
- opensearch-alertrules.yaml
- cnpg-podmonitor.yaml
- openbao-servicemonitor.yaml
- postgres-alertrules.yaml
- openbao-alertrules.yaml
- searxng-deployment.yaml

View File

@@ -10,7 +10,7 @@ spec:
- name: opensearch
rules:
- alert: OpenSearchClusterRed
expr: opensearch_cluster_health_status{color="red"} == 1
expr: elasticsearch_cluster_health_status{color="red"} == 1
for: 2m
labels:
severity: critical
@@ -19,7 +19,7 @@ spec:
description: "OpenSearch cluster {{ $labels.cluster }} health status is red."
- alert: OpenSearchClusterYellow
expr: opensearch_cluster_health_status{color="yellow"} == 1
expr: elasticsearch_cluster_health_status{color="yellow"} == 1
for: 10m
labels:
severity: warning
@@ -28,10 +28,10 @@ spec:
description: "OpenSearch cluster {{ $labels.cluster }} health status is yellow."
- alert: OpenSearchHeapHigh
expr: (opensearch_jvm_mem_heap_used_bytes / opensearch_jvm_mem_heap_max_bytes) > 0.85
expr: (elasticsearch_jvm_memory_used_bytes{area="heap"} / elasticsearch_jvm_memory_max_bytes{area="heap"}) > 0.85
for: 5m
labels:
severity: warning
annotations:
summary: "OpenSearch JVM heap usage is high"
description: "OpenSearch node {{ $labels.node }} in {{ $labels.namespace }} heap usage is above 85%."
description: "OpenSearch node {{ $labels.name }} in {{ $labels.namespace }} heap usage is above 85%."

View File

@@ -24,9 +24,6 @@ spec:
containers:
- name: opensearch
image: opensearchproject/opensearch:3
# OpenSearch 3.x has no maintained prometheus-exporter plugin.
# Metrics come from /_cluster/stats JSON API (scraped by dashboard queries).
# TODO: add opensearch-exporter sidecar for native Prometheus metrics.
ports:
- name: http
containerPort: 9200
@@ -58,6 +55,26 @@ spec:
volumeMounts:
- name: data
mountPath: /usr/share/opensearch/data
# Prometheus metrics exporter — scrapes OpenSearch REST APIs and
# exposes them as elasticsearch_* metrics on :9114/metrics.
- name: exporter
image: quay.io/prometheuscommunity/elasticsearch-exporter:v1.7.0
args:
- --es.uri=http://localhost:9200
- --es.all
- --es.indices
- --es.shards
- --collector.clustersettings
ports:
- name: metrics
containerPort: 9114
protocol: TCP
resources:
requests:
cpu: 5m
memory: 32Mi
limits:
memory: 64Mi
volumes:
- name: data
persistentVolumeClaim:

View File

@@ -17,3 +17,7 @@ spec:
port: 9300
targetPort: 9300
protocol: TCP
- name: metrics
port: 9114
targetPort: 9114
protocol: TCP

View File

@@ -11,6 +11,5 @@ spec:
matchLabels:
app: opensearch
endpoints:
- port: http
- port: metrics
interval: 30s
path: /_prometheus/metrics