ELK stackelasticsearch大数据女娲

[Elasticsearch Monitor] 如何监控Elas

2017-02-13  本文已影响227人  king_wang

上一篇文章如何监控Elasticsearch主要描述了对于Es服务器应该监控哪些指标。本文旨在介绍es api中的各统计指标含义。

Elasticsearch’s RESTful API + JSON

默认情况下,Elasticsearch在9200端口上提供了restful http服务,返回集群,节点,索引状况的JSON结果。主要有五个HTTP REST API可用于监视Elasticsearch:

下面的表格总结了上一篇文章中提到搜索性能,索引性能,内存性能,网络性能对应的ES API。其中有些性能数据是从多个维度描述的,比如搜索性能在节点维度和索引维度都有提供。

Metric category Availability
Search performance metrics Node Stats API, Index Stats API
Indexing performance metrics Node Stats API, Index Stats API
Memory and garbage collection Node Stats API, Cluster Stats API
Network metrics Node Stats API
Cluster health and node availability Cluster Health API
Resource saturation and errors Node Stats API, Index Stats API, Cluster Stats API, Pending Tasks API

(一)Cluster Health API

Cluster Health API提供了描述集群健康状态的JSON对象数据。

API接口:

GET _cluster/health

返回结果JSON:

{
  "cluster_name": "elasticsearch",
  "status": "yellow",
  "timed_out": false,
  "number_of_nodes": 1,
  "number_of_data_nodes": 1,
  "active_primary_shards": 11,
  "active_shards": 11,
  "relocating_shards": 0,
  "initializing_shards": 0,
  "unassigned_shards": 10,
  "delayed_unassigned_shards": 0,
  "number_of_pending_tasks": 0,
  "number_of_in_flight_fetch": 0,
  "task_max_waiting_in_queue_millis": 0,
  "active_shards_percent_as_number": 52.38095238095239
}

(二)Cluster Stats API

Cluster Stats API提供了集群维度的信息。基本上是Node Stats API的数据的总和。虽然没有每个节点的详细信息,但是可以让你快速了解掌握整个集群当前的运行状态。

API接口:

GET _cluster/stats
{
  "_nodes": {
    "total": 1,
    "successful": 1,
    "failed": 0
  },
  "cluster_name": "elasticsearch",
  "timestamp": 1500175210218,
  "status": "yellow",
  "indices": {
    "count": 11,
    "shards": {...},
    "docs": {...},
    "store": {...},
    "fielddata": {...},
    "query_cache": {...},
    "completion": {...},
    "segments": {...}
  },
  "nodes": {
    "count": {...},
    "versions": [...],
    "os": {...},
    "process": {...},
    "jvm": {...},
    "fs": {...},
    "plugins": [...],
    "network_types": {...}
  }
}

对于indices和nodes内部属性的含义会在Node Stats API里介绍

(三)Node Stats API

Node Stats API是一个非常有用的API,用于监控集群每台服务器的状态。它统计了我们想要监控的主要的那些指标,包括了我们上一篇列举的大部分指标。

API接口:

GET _nodes/stats (或者指定node获取 _nodes/node1,node2/stats)
{
  "_nodes": {
    "total": 1,
    "successful": 1,
    "failed": 0
  },
  "cluster_name": "elasticsearch",
  "nodes": {
    "SdRLvOO7RKSiaBW_hmwvZg": {
      "name": "node1",
      "indices": {...},
      "os": {...},
      "process": {...},
      "jvm": {...},
      "thread_pool": {...},
      "fs": {...},
      "transport": {...},
      "http": {...}
    }
    ...
  }
}
上一篇下一篇

猜你喜欢

热点阅读