Nodes Stats

cluster nodes stats(集群节点统计信息)API 可以获取集群中一个或者多个节点的统计信息。

curl -XGET 'http://localhost:9200/_nodes/stats'
curl -XGET 'http://localhost:9200/_nodes/nodeId1,nodeId2/stats'

第一个命令获取了集群中所有节点的统计信息。

第二个只选择获取了 nodeId1nodeId2 的节点的统计信息。

所有节点选择的选项在这里有更详细的说明。

默认情况下,返回所有的统计信息。您也可以通过组合任何的 **indices**,``**os**,``**process**,``**jvm**,``**transport**,``**http**,``**fs**,breaker和 **thread_pool** 来限制它们。例如 :

选项 描述
indices Indices stats about size, document count, indexing and deletion times, search times, field cache size, merges and flushes
fs File system information, data path, free disk space, read/write stats (see FS information)
http HTTP connection information
jvm JVM stats, memory pool information, garbage collection, buffer pools, number of loaded/unloaded classes
os Operating system stats, load average, mem, swap (see OS statistics)
process Process statistics, memory consumption, cpu usage, open file descriptors (see Process statistics)
thread_pool Statistics about each thread pool, including current size, queue and rejected tasks
transport Transport statistics about sent and received bytes in cluster communication
breaker Statistics about the field data circuit breaker
discovery Statistics about the discovery
ingest Statistics about ingest preprocessing
# return indices and os
curl -XGET 'http://localhost:9200/_nodes/stats/os'
# return just os and process
curl -XGET 'http://localhost:9200/_nodes/stats/os,process'
# specific type endpoint
curl -XGET 'http://localhost:9200/_nodes/stats/process'
curl -XGET 'http://localhost:9200/_nodes/10.0.0.1/stats/process'

所有的统计信息都可以通过 /_nodes/stats/_all 或者 **/_nodes/stats?metric=_all** 来明确的请求。

FS information(文件系统的信息)

可以设置 fs 标记以获取与文件系统有关的统计信息 : 

标记 描述
fs.timestamp Last time the file stores statistics have been refreshed
fs.total.total_in_bytes Total size (in bytes) of all file stores
fs.total.free_in_bytes Total number of unallocated bytes in all file stores
fs.total.available_in_bytes Total number of bytes available to this Java virtual machine on all file stores
fs.data List of all file stores
fs.data.path Path to the file store
fs.data.mount Mount point of the file store (ex: /dev/sda2)
fs.data.type Type of the file store (ex: ext4)
fs.data.total_in_bytes Total size (in bytes) of the file store
fs.data.free_in_bytes Total number of unallocated bytes in the file store
fs.data.available_in_bytes Total number of bytes available to this Java virtual machine on this file store
fs.data.spins (Linux only) Indicates if the file store is backed by spinning storage. null means we could not determine it, truemeans the device possibly spins and false means it does not (ex: solid-state disks).
fs.io_stats.devices (Linux only) Array of disk metrics for each device that is backing an Elasticsearch data path. These disk metrics are probed periodically and averages between the last probe and the current probe are computed.
fs.io_stats.devices.device_name (Linux only) The Linux device name.
fs.io_stats.devices.operations (Linux only) The total number of read and write operations for the device completed since starting Elasticsearch.
fs.io_stats.devices.read_operations (Linux only) The total number of read operations for the device completed since starting Elasticsearch.
fs.io_stats.devices.write_operations (Linux only) The total number of write operations for the device completed since starting Elasticsearch.
fs.io_stats.devices.read_kilobytes (Linux only) The total number of kilobytes read for the device since starting Elasticsearch.
fs.io_stats.devices.write_kilobytes (Linux only) The total number of kilobytes written for the device since starting Elasticsearch.
fs.io_stats.operations (Linux only) The total number of read and write operations across all devices used by Elasticsearch completed since starting Elasticsearch.
fs.io_stats.read_operations (Linux only) The total number of read operations for across all devices used by Elasticsearch completed since starting Elasticsearch.
fs.io_stats.write_operations (Linux only) The total number of write operations across all devices used by Elasticsearch completed since starting Elasticsearch.
fs.io_stats.read_kilobytes (Linux only) The total number of kilobytes read across all devices used by Elasticsearch since starting Elasticsearch.
fs.io_stats.write_kilobytes (Linux only) The total number of kilobytes written across all devices used by Elasticsearch since starting Elasticsearch.

Operating System statistics(操作系统的统计信息)

可以设置 os 标记以获取与操作系统有关的统计信息 : 

标记 描述
os.timestamp Last time the operating system statistics have been refreshed
os.cpu.percent Recent CPU usage for the whole system, or -1 if not supported
os.cpu.load_average.1m One-minute load average on the system (field is not present if one-minute load average is not available)
os.cpu.load_average.5m Five-minute load average on the system (field is not present if five-minute load average is not available)
os.cpu.load_average.15m Fifteen-minute load average on the system (field is not present if fifteen-minute load average is not available)
os.mem.total_in_bytes Total amount of physical memory in bytes
os.mem.free_in_bytes Amount of free physical memory in bytes
os.mem.free_percent Percentage of free memory
os.mem.used_in_bytes Amount of used physical memory in bytes
os.mem.used_percent Percentage of used memory
os.swap.total_in_bytes Total amount of swap space in bytes
os.swap.free_in_bytes Amount of free swap space in bytes
os.swap.used_in_bytes Amount of used swap space in bytes

Process statistics(进程统计信息)

可以设置 process 标记以获取与当前运行中的进程有关的统计信息 : 

标记 描述
process.timestamp Last time the process statistics have been refreshed
process.open_file_descriptors Number of opened file descriptors associated with the current process, or -1 if not supported
process.max_file_descriptors Maximum number of file descriptors allowed on the system, or -1 if not supported
process.cpu.percent CPU usage in percent, or -1 if not known at the time the stats are computed
process.cpu.total_in_millis CPU time (in milliseconds) used by the process on which the Java virtual machine is running, or -1 if not supported
process.mem.total_virtual_in_bytes Size in bytes of virtual memory that is guaranteed to be available to the running process

Field data statistics(字段数据的统计信息)

您可以获取关于在节点级别或者索引级别上的字段数据内存使用情况的信息。

# Node Stats
curl -XGET 'http://localhost:9200/_nodes/stats/indices/?fields=field1,field2&pretty'

# Indices Stat
curl -XGET 'http://localhost:9200/_stats/fielddata/?fields=field1,field2&pretty'

# You can use wildcards for field names
curl -XGET 'http://localhost:9200/_stats/fielddata/?fields=field*&pretty'
curl -XGET 'http://localhost:9200/_nodes/stats/indices/?fields=field*&pretty'

Search groups(搜索组)

您可以获取关于在这个节点上执行搜索的 search groups 的统计信息。

# All groups with all stats
curl -XGET 'http://localhost:9200/_nodes/stats?pretty&groups=_all'

# Some groups from just the indices stats
curl -XGET 'http://localhost:9200/_nodes/stats/indices?pretty&groups=foo,bar'

Ingest statistics(摄取数据的统计信息)

可以设置 ingest 标记以获取与摄取数据有关的统计信息 : 

标记 描述
ingest.total.count The total number of document ingested during the lifetime of this node
ingest.total.time_in_millis The total time spent on ingest preprocessing documents during the lifetime of this node
ingest.total.current The total number of documents currently being ingested.
ingest.total.failed The total number ingest preprocessing operations failed during the lifetime of this node

除了全部的摄取数据统计信息之外,在每一个管道的基础之上也提供了这些统计信息。