Integrate an Elasticsearch/OpenSearch instance
This topic describes how to connect a self-managed Elasticsearch or OpenSearch cluster to Cloud Monitor 2.0. The integration component uses the aio-exporter Elasticsearch adapter to collect metrics such as cluster health, shards, index read and write operations, JVM/GC, thread pools, and file systems. It supports Elasticsearch 7.x and 8.x (compatible with OpenSearch) and can be deployed in two environments: ACK clusters or on ECS instances within a VPC. After the integration is complete, Cloud Monitor automatically generates Elasticsearch instance entities and a built-in dashboard.
Requirements
Before you connect, ensure that the target instance meets the following requirements. If these requirements are not met, data collection may fail or result in missing metrics.
|
Condition |
Requirement |
|
Version |
Elasticsearch 7.x or 8.x. Compatible with OpenSearch. End-to-end validation was performed on version 7.17. |
|
Deployment type |
Self-managed Elasticsearch or OpenSearch. Cloud-managed instances can also be connected if they meet the account and network requirements. |
|
Monitoring account |
If cluster security is enabled, the account requires the |
|
Connection method |
Access APIs such as |
|
Network connectivity |
In a CS environment, the destination cluster must be accessible from the network of the selected ACK cluster. In an ECS (VPC) environment, the vSwitch CIDR block for the managed agent must have access to the destination ECS instance. |
Prerequisites
-
Managed Service for Prometheus is activated.
-
For CS environments: The target ACK cluster is connected to Cloud Monitor 2.0 and is running. The target Elasticsearch service is accessible from the cluster network.
-
For ECS (VPC) environments: The target Elasticsearch service is hosted on an ECS instance. This ECS instance is accessible from the vSwitch CIDR block of the managed agent.
Billing
-
Billing is based solely on the volume of metric data generated in Billing overview.
Integration methods
Step 1: Prepare a monitoring account (if required)
If your cluster has security verification enabled, create an account with monitoring permission. If security verification is not enabled, skip this step and leave the username and password fields empty.
Use the built-in monitoring_user role, or grant the equivalent cluster:monitor/* permission. This permission is required to read APIs such as _cluster/health and _nodes/stats. Avoid using a superuser account directly.
Step 2: Select the integration environment
This plugin supports two integration environments: CS and ECS (VPC). The integration process differs for each environment. Select the environment based on where your Elasticsearch service is deployed:
CS
-
The Exporter is installed on a specified ACK cluster and reuses the existing data collectors in the cluster to collect metrics.
-
The monitored object is the ACK cluster.
-
Network requirements: The target Elasticsearch service must be accessible from the cluster network. For example, it can be a Service within the cluster or a private VPC endpoint that the cluster can access.
ECS (VPC)
-
The system deploys a fully managed data collector based on the VPC of the ECS instance that hosts your target Elasticsearch service.
-
No processes are installed on the ECS instance.
-
The monitored object is the ECS instance.
-
Network requirements: The vSwitch CIDR block of the managed agent must be able to access the target ECS instance. Security groups and Access Control Lists (ACLs) must be configured to allow this access.
|
Environment |
Exporter deployment location |
Processes on service machine? |
Monitored object |
Network requirements |
|
CS |
A specified ACK cluster |
No. Deployed within the cluster, not on the application pod's host. |
ACK cluster |
Elasticsearch must be accessible from within the cluster network. |
|
ECS (VPC) |
Fully managed data collector deployed by the system based on the VPC |
No. No processes are installed on the ECS instance. |
ECS instance |
The vSwitch CIDR block of the managed agent must be able to access the target ECS instance. |
Step 3: Configure the integration
-
Log on to the Cloud Monitor 2.0 console and select a workspace. In the navigation pane on the left, click Integration Center, and then click Elasticsearch.
-
Select the integration environment (CS or ECS (VPC)), and then select the Monitored Object from the drop-down list.
-
Configure the integration settings. After you complete the configuration, click OK.
Configuration item
Required
Description
Elasticsearch service endpoint
Yes
For a CS environment, enter the in-cluster endpoint. For an ECS (VPC) environment, enter the private or public network endpoint.
Elasticsearch service port
Yes
Default: 9200
Cloud vendor / Deployment source
No
This value is written to the
providerlabel for metrics and is used in entity discovery. For self-hosted deployments, select 'Self-hosted' (self-hosted/elasticsearch).Elasticsearch username
No
Enter a username if Security is enabled. The account requires the
monitoring_userrole or equivalent permissions.Elasticsearch password
No
Leave this empty if security verification is not enabled.
Metric collection interval (seconds)
Yes
Default: 15
Custom tags
No
Additional tags to inject into metrics.
Use public Registry Address
No
Disabled by default. Enable this option if the private image repository is inaccessible.
-
After the integration is successful, you can view the integrated entities and their related observable data in Entity Explorer.
Data usage
Entities
After integration, Cloud Monitor periodically discovers Elasticsearch instances from metric labels, such as elasticsearch_clusterinfo_up, and generates middleware entities.
|
Dimension |
Description |
|
Domain |
middleware |
|
Entity type |
middleware.elasticsearch |
|
Entity filter condition |
|
|
Observed object (bound entity) |
The object is |
Entity fields are derived from collected labels and are not affected by the number of installations.
|
Field |
Description |
|
instance_id |
Instance identity. This field is obtained from the |
|
provider |
Deployment source, such as |
|
port |
HTTP port. |
|
region_id |
Region. |
|
env_type |
Deployment environment type (CS or ECS). |
|
cluster_id |
The ID of the cluster to which the instance belongs. |
You can search for instances using these fields in the Entity Explorer or Middleware Insight applications.
Built-in dashboards
|
Dashboard name |
How to access |
Description |
|
Elasticsearch Overview (Instance Overview) |
The Instance Overview tab on the entity details page. |
A UModel dashboard. Variables are automatically bound based on the instance context. |
|
Elasticsearch Overview |
The Grafana dashboard list. |
A Grafana dashboard. Both Chinese and English versions are available. |
Core metrics
The middleware.metric.elasticsearch entity dataset contains the following 40 metrics. You can use these metrics directly in entity details, dashboards, and alerts.
|
Metric name |
Type |
Unit |
Display name |
Description |
|
elasticsearch_up |
gauge |
- |
Elasticsearch liveness |
Indicates whether the Elasticsearch instance is reachable. A value of 1 means the instance is running, and 0 means it is unavailable. |
|
elasticsearch_cluster_health_status |
gauge |
- |
Cluster health status |
The health status of the cluster, indicated by color (green, yellow, or red). A value of 1 indicates that the corresponding color status is active. |
|
elasticsearch_number_of_nodes |
gauge |
- |
Number of nodes |
The total number of nodes in the cluster. |
|
elasticsearch_number_of_data_nodes |
gauge |
- |
Number of data nodes |
The number of data nodes in the cluster. |
|
elasticsearch_active_primary_shards |
gauge |
- |
Number of active primary shards |
The total number of primary shards for all indexes. |
|
elasticsearch_active_shards |
gauge |
- |
Number of active shards |
The total number of shards, including replicas. |
|
elasticsearch_relocating_shards |
gauge |
- |
Number of relocating shards |
The number of shards that are currently migrating between nodes. |
|
elasticsearch_initializing_shards |
gauge |
- |
Number of initializing shards |
The number of shards that are being initialized (created). |
|
elasticsearch_unassigned_shards |
gauge |
- |
Number of unassigned shards |
The number of shards that exist in the cluster state but cannot be assigned. |
|
elasticsearch_number_of_pending_tasks |
gauge |
- |
Number of pending tasks |
The number of cluster-level changes (pending tasks) that have not been executed. |
|
elasticsearch_indices_docs |
gauge |
- |
Number of documents |
The number of documents on the node. |
|
elasticsearch_store_size_bytes |
gauge |
Bytes |
Index storage size |
The current size in bytes of stored index data. |
|
elasticsearch_segments_count |
gauge |
- |
Number of segments |
The number of index segments on the node. |
|
elasticsearch_segments_memory_bytes |
gauge |
Bytes |
Segment memory |
The current amount of memory in bytes used by segments. |
|
elasticsearch_search_query_rate |
counter |
queries/s |
Search query rate |
The rate of search queries (queries per second). |
|
elasticsearch_search_query_time |
counter |
Seconds |
Search query time |
The per-second increase in the cumulative time spent on search queries (seconds/second). |
|
elasticsearch_search_fetch_rate |
counter |
fetches/s |
Search fetch rate |
The rate of search fetches (fetches per second). |
|
elasticsearch_indexing_index_rate |
counter |
ops/s |
Indexing rate |
The rate of indexing operations (operations per second). |
|
elasticsearch_indexing_index_time |
counter |
Seconds |
Indexing time |
The per-second increase in the cumulative time spent on indexing (seconds/second). |
|
elasticsearch_get_rate |
counter |
ops/s |
Get rate |
The rate of get operations (gets per second). |
|
elasticsearch_flush_rate |
counter |
ops/s |
Flush rate |
The number of flushes per second. |
|
elasticsearch_merges_rate |
counter |
ops/s |
Merge rate |
The rate of segment merges (merges per second). |
|
elasticsearch_refresh_rate |
counter |
ops/s |
Refresh rate |
The rate of index refreshes (refreshes per second). |
|
elasticsearch_translog_operations_rate |
counter |
ops/s |
Translog operation rate |
The rate of translog operations (operations per second). This reflects the write persistence load. |
|
elasticsearch_jvm_memory_used_bytes |
gauge |
Bytes |
JVM memory used |
The current amount of JVM memory used, categorized by area (heap or non-heap). |
|
elasticsearch_jvm_memory_max_bytes |
gauge |
Bytes |
JVM maximum memory |
The maximum amount of JVM memory, categorized by area (heap or non-heap). |
|
elasticsearch_jvm_heap_usage |
gauge |
% |
JVM heap usage |
The JVM heap memory usage (used / maximum). |
|
elasticsearch_jvm_gc_rate |
counter |
ops/s |
JVM GC rate |
The rate of JVM garbage collection (GC) executions, aggregated by collector. |
|
elasticsearch_jvm_gc_time |
counter |
Seconds |
JVM GC time |
The per-second increase in time spent on JVM GC, aggregated by collector (seconds/second). |
|
elasticsearch_os_cpu_percent |
gauge |
% |
OS CPU utilization |
The CPU utilization of the node's operating system. |
|
elasticsearch_process_cpu_percent |
gauge |
% |
Process CPU utilization |
The CPU utilization of the Elasticsearch process. |
|
elasticsearch_os_load1 |
gauge |
- |
System load (1m) |
The 1-minute average system load. |
|
elasticsearch_filesystem_data_available_bytes |
gauge |
Bytes |
File system free space |
The free space in bytes on the data block device. |
|
elasticsearch_filesystem_data_size_bytes |
gauge |
Bytes |
File system total size |
The total size in bytes of the data block device. |
|
elasticsearch_thread_pool_queue |
gauge |
- |
Thread pool queue size |
The number of queued operations, aggregated by thread pool type. |
|
elasticsearch_thread_pool_rejected |
counter |
- |
Thread pool rejections |
The number of rejected operations per second, aggregated by thread pool type. |
|
elasticsearch_breakers_tripped |
counter |
- |
Breakers tripped |
The rate at which circuit breakers are tripped, aggregated by breaker. |
|
elasticsearch_transport_rx_bytes |
counter |
Bytes |
Transport layer RX traffic |
The number of bytes received per second by the transport layer. |
|
elasticsearch_transport_tx_bytes |
counter |
Bytes |
Transport layer TX traffic |
The number of bytes sent per second by the transport layer. |
|
elasticsearch_process_open_files |
gauge |
- |
Number of open files |
The number of open file descriptors on the node. |
In addition to the aggregated MetricSet metrics, the raw metrics (prefixed with elasticsearch_*) collected by the exporter are also written to Prometheus storage. You can query these metrics directly using Prometheus Query Language (PromQL).
Example queries
# Cluster health (typically green=0, yellow=1, red=2; check the actual labels)
elasticsearch_cluster_health_status
# Search QPS
rate(elasticsearch_indices_search_query_total[5m])
# JVM heap usage
elasticsearch_jvm_memory_used_bytes{area="heap"}
/ elasticsearch_jvm_memory_max_bytes{area="heap"} * 100
Alert templates
This integration component does not have built-in alert rules. In the Alert Center, you can configure alerts based on the metrics listed above. For example, you can set an alert to trigger when the elasticsearch_clusterinfo_up liveness metric is not equal to 1, or when connection counts or message accumulation exceeds a threshold.
Storage policies
After you integrate Elasticsearch, Cloud Monitor creates a storage instance to store observable data.
|
Data type |
Default storage location |
Notes |
|
Metrics |
Prometheus instance: RegionShare:{{workspaceName}}:{{regionId}} |
Associated dataset: |
Manage or remove the integration
To modify or cancel the integration, go to the Integration Management page of Integration Center, find the corresponding integration policy, and then click Edit or Delete. When you delete the integration policy, the Exporter and the collection configuration are removed together. Historical metrics that have already been written are retained based on the lifecycle policy of the storage.