ElasticSearch Stats相关的API

Node status
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-nodes-stats.html
Cluster status
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-stats.html
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-state.html
Index status
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/indices-stats.html

ElasticSearch Task相关API

Pending Cluster Tasks
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-pending.html
Task Management API
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/tasks.html
监控Thread Pools
GET _cat/thread_pool?v
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cat-thread-pool.html

GET _nodes/hot_threads
https://www.elastic.co/guide/en/elasticsearch/reference/6.2/cluster-nodes-hot-threads.html
GET _nodes/stats/thread_pool

thread_pool Statistics about each thread pool, including current size, queue and rejected tasks

GET /_nodes/thread_pool

The Index&Query Slow Log

  1. PUT myindex/
  2. {
  3. "settings": {
  4. "index.search.slowlog.threshold": {
  5. "query.warn": "10s",
  6. "query.info": "3s",
  7. "query.debug": "2s",
  8. "query.trace": "0s",
  9. "fetch.warn": "1s",
  10. "fetch.info": "600ms",
  11. "fetch.debug": "400ms",
  12. "fetch.trace": "0s"
  13. }
  14. }
  15. }

支持将分片上,search和fetch阶段的慢查询写入文件
支持为query和fetch分别定义阈值
索引级的动态设置,可以按需设置,或者通过index template统一设定
slow log文件通过log4j2.properties配置

如何创建监控Dashboard

  • 开发Elasticsearch plugin,通过读取相关的监控API,将数据发送到ES,或者TSDB
  • 开发Metricbeats搜集相关指标
  • 使用Kibana或Graffna创建Dashboard
  • 开发Elasticsearch Exporter,通过Prometheus监控Elasticsearch集群