查看es集群健康状态
curl -XGET 'http://localhost:9200/_cluster/health?pretty'
{
"cluster_name" : "hotel-elk-log",
"status" : "green", #集群状态:green,yellow,red
"timed_out" : false,
"number_of_nodes" : 3, #集群中node节点数
"number_of_data_nodes" : 2, #集群中data节点数
"active_primary_shards" : 186,
"active_shards" : 372,
"relocating_shards" : 0, #迁移分片到新的node
"initializing_shards" : 0, #初始化分片
"unassigned_shards" : 0, #
"delayed_unassigned_shards" : 0,
"number_of_pending_tasks" : 0,
"number_of_in_flight_fetch" : 0
}shell 脚本
#!/bin/bash
case $1 in
cluster_name)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\" '/cluster_name/ {print $4}' ;;
status)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\" 'NR==3 {print $4}' ;;
timed_out)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\, 'NR==4 {print $1}' |awk -F: '{print $2}' ;;
number_nodes)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\, 'NR==5 {print $1}' |awk -F: '{print $2}' ;;
data_nodes)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\, 'NR==6 {print $1}' |awk -F: '{print $2}' ;;
active_primary_shards)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\, 'NR==7 {print $1}' |awk -F: '{print $2}' ;;
active_shards)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\, 'NR==8 {print $1}' |awk -F: '{print $2}' ;;
relocating_shards)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\, 'NR==9 {print $1}' |awk -F: '{print $2}' ;;
initializing_shards)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\, 'NR==10 {print $1}' |awk -F: '{print $2}' ;;
unassigned_shards)
curl -s -XGET 'http://localhost:9200/_cluster/health?pretty' |awk -F\, 'NR==11 {print $1}' |awk -F: '{print $2}' ;;
*)
echo "Usage: $0 { cluster_name | status | timed_out | number_nodes | data_nodes | active_primary_shards | active_shards | relocating_shards | initializing_shards | unassigned_shards}" ;;
esaczabbix_agentd.conf
UnsafeUserParameters=1
UserParameter=cluster_name,/usr/local/zabbix/es_status.sh cluster_name
UserParameter=status,/usr/local/zabbix/es_status.sh status
UserParameter=timed_out,/usr/local/zabbix/es_status.sh timed_out
UserParameter=number_nodes,/usr/local/zabbix/es_status.sh number_nodes
UserParameter=data_nodes,/usr/local/zabbix/es_status.sh data_nodes
UserParameter=active_primary_shards,/usr/local/zabbix/es_status.sh active_primary_shards
UserParameter=active_shards,/usr/local/zabbix/es_status.sh active_shards
UserParameter=relocating_shards,/usr/local/zabbix/es_status.sh relocating_shards
UserParameter=initializing_shards,/usr/local/zabbix/es_status.sh initializing_shards
UserParameter=unassigned_shards,/usr/local/zabbix/es_status.sh unassigned_shardszabbix上添加host,链接到模板
zabbix监控elasticsearch集群
原创
©著作权归作者所有:来自51CTO博客作者766792592的原创作品,如需转载,请与作者联系,否则将追究法律责任
上一篇:nginx整合tomcat
下一篇:我的友情链接
提问和评论都可以,用心的回复会被更多人看到
评论
发布评论
相关文章
-
ES(Elasticsearch)集群配置
ES(Elasticsearch)集群配置
elasticsearch 集群 -
Elasticsearch集群监控指标
本片主要通过两个API讲解Elasticsearch集群监控的指标说明
Elasticsearch -
ZABBIX监控vcenter集群
本文主要介绍使用zabbix对vcenter集群进行监控
数据 触发器 共享内存