ES堆栈监测折线图

在网上看了好多,都是大致的介绍,本博客只记录自己的想法
一、概览4个线图
在这里插入图片描述

1、DSL语句汇总
GET .monitoring-es-*/_search
{
“track_total_hits”: true,
“aggs”: {
“data”: {
“date_histogram”: {
“fixed_interval”: “30s”,
“format”: “yyyy-MM-dd HH:mm:ss”,
“time_zone”: “Asia/Shanghai”,
“field”: “timestamp”
},
“aggs”: {
“indexTotal”: {
“sum”: {
“field”: “indices_stats._all.primaries.indexing.index_total”
}
},
“indexTimeInMillis”: {
“sum”: {
“field”: “indices_stats._all.primaries.indexing.index_time_in_millis”
}
},
“totalPieces”: {
“max”: {
“field”: “indices_stats._all.total.indexing.index_total”
}
},
“mainPieces”: {
“max”: {
“field”: “indices_stats._all.primaries.indexing.index_total”
}
},
“queryTotal”: {
“sum”: {
“field”: “indices_stats._all.total.search.query_total”
}
},
“queryTimeInMillis”: {
“sum”: {
“field”: “indices_stats._all.total.search.query_time_in_millis”
}
},
“queryTotalRate”: {
“max”: {
“field”: “indices_stats._all.total.search.query_total”
}
}
}
}
},
“query”: {
“range”: {
“timestamp”: {
“gte”: “2021-12-28T01:26:35.421Z”,
“lte”: “2021-12-28T02:26:35.421Z”
}
}
}
}
2、各个字段介绍
在这里插入图片描述
1)、索引延迟数据
indices_stats._all.primaries.indexing.index_total 索引文档的平均延迟,即索引文档所用时间除以索引文档的数目。这仅考虑主分片。
(10-4)/ (14-7)
2)、索引速率
indices_stats._all.total.indexing.index_total 为主分片和副本分片索引的文档数目。
(8-1) /30 (持续时间单位/S)
indices_stats._all.primaries.indexing.index_total 为主分片索引的文档数目。
(13-6)/30 (持续时间单位/S)
3)、搜索延迟
indices_stats._all.total.search.query_total 搜索的平均延迟,即执行搜索所用的时间除以提交的搜索数目。这考虑主分片和副本分片。
(11-4)/ (9-2)
4)、搜索速率
indices_stats._all.total.search.query_total 跨主分片和副本分片执行的搜索请求数目。可以对多个分片运行单个搜索!
(12-5) /30 (持续时间单位/S)

3、这个 “fixed_interval”: “30s”,时间聚合适用于6.9以后的版本,之前的更旧版本是interval": “30s”,也是工作中遇到的坑
“date_histogram”: {
“fixed_interval”: “30s”,
“format”: “yyyy-MM-dd HH:mm:ss”,
“time_zone”: “Asia/Shanghai”,
“field”: “timestamp”
}
关于这个时间我大致分析了写了一个简单的工具类,有不对的地方欢迎评论指出好改进:
public static Map<String,Object> checkStackTime(long betweenDay){
//判断是否大于1小时
Map<String, Object> map = new HashMap<>(11);
if (betweenDay<=3600){ //0-1(1个小时以内是30s)
map.put(“unit”,“30s”);
map.put(“second”,30);
}else if (betweenDay>3600 && betweenDay<=14400){ //1-4(大于1小时小于4小时是 1m)
map.put(“unit”,“1m”);
map.put(“second”,60);
}else if (betweenDay>14400 && betweenDay<=28800){ //4-8(大于4小时小于8小时是 5m)
map.put(“unit”,“5m”);
map.put(“second”,300);
}else if (betweenDay>28800 && betweenDay<=129600){ //8-36(大于8小时小于36小时是 10m)
map.put(“unit”,“10m”);
map.put(“second”,600);
}else if (betweenDay> 129600 && betweenDay<=259200){//36-72(大于36小时小于72小时是 30m)
map.put(“unit”,“30m”);
map.put(“second”,1800);
}else { //>72(大于72小时是 1h)
map.put(“unit”,“1h”);
map.put(“second”,3600);
}
return map;
}
后面功能持续更新中!!!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值