iotdb grafana connector 监控增强

iotdb 监控说明

iotdb 的监控主要包括两种形式,

Prometheus 形式

一种是 iotdb 直接暴露监控数据访问地址,,外部系统,例如 Prometheus 的形式进行,定时拉取监控数据,外部系统采集与存储。

例如: data node 配置完监控,提供如下的数据方法形式:

http://127.0.0.1:9091/metrices

# HELP quantity  
# TYPE quantity gauge
quantity{name="timeSeries",} 500000.0
# HELP file_count  
# TYPE file_count gauge
file_count{name="wal",} 533.0
file_count{name="unseq",} 2.0
file_count{name="seq",} 90.0

iotdb 存储

另外一种是: iotdb 作为时序数据库,存储自己的监控数据:

上面采集的数据,直接存储到 iotdb 里面, 由于 iotdb 不支持类似 Prometheus 的 tag 形式,所以在存储的时候,将上面采集的数据需要做特殊处理;

比如:采集数据为 file_count {name="wal",} 533.0

iotdb 存储形式为:

root.__system.metric.127.0.0.1:6667.file_count.name=wal.value = time 533.0 形式。

通过此种形式,iotdb 的相关的监控数据都会存储到 __system 下。

iotdb 监控数据展示

Prometheus + grafana:

iotdb 通过 http 形式暴露监控数据, Prometheus 采集和存储,然后通过 grafana 进行展示, iotdb 官方提交了相关的 Prometheus + grafana 展示的模板,直接导入就可以使用。

grafana + grafana json plugin + iotdb grafana connector

image.png

iotdb grafana connector 方案说明与完善

grafana 添加 simple json 插件以后,就可以通过如下的配置,添加后端监控数据查询的地址,提交相关的监控服务

image.png

添加监控图表里面,配置此监控查询的参数,就可以展示相关的监控数据。

有关 iotdb grafana connector

iotdb grafana connector 就是官方参考 grafana json 插件的数据格式实现的 iotdb grafana 实现,

一个配置 demo :

root.__system.metric.`127.0.0.1:6667`.jvm_threads_states_threads.`state=blocked`
root.__system.metric.`127.0.0.1:6667`.jvm_threads_states_threads.`state=waiting`
root.__system.metric.`127.0.0.1:6667`.jvm_threads_states_threads.`state=timed-waiting`
root.__system.metric.`127.0.0.1:6667`.jvm_threads_states_threads.`state=terminated`
root.__system.metric.`127.0.0.1:6667`.jvm_threads_states_threads.`state=runnable`
root.__system.metric.`127.0.0.1:6667`.jvm_threads_states_threads.`state=new`

比如,我想把上面 jvm_threads_states_threads 相关的 5 条记录放到一个图里面展示,需要做如下的配置:query 下面多添加几条 target ,就可以展示。

image.png

官方 iotdb grafana connector 不足:

虽然官方做了相关的实现,但是对于一些,动态的监控,存在问题,比如:

root.__system.metric.`127.0.0.1:6667`.iot_consensus.`name=logDispatcher-127.0.0.1:40010`.`region=DataRegion[0]`.`type=currentSyncIndex`

对于 iot_consensus 监控,name=logDispatcher-127.0.0.1:40010.`region=DataRegion [0] 形式的,DataRegion [0] 这种形式的,是动态变化的,随着系统的运行, data region 是动态添加的,我们不可能实时手动添加

需要将 grafana simple json 查询参数可以支持 iotdb * 的形式, 比如: 如下的查询可以修改为:

root.__system.metric.127.0.0.1:6667.iot_consensus.name=logDispatcher-127.0.0.1:40010.***.**type=currentSyncIndex

grafana simple json query 返回格式要求:

[
  {
    "target":"upper_75", // The field being queried for
    "datapoints":[
      [622,1450754160000],  // Metric value as a float , unixtimestamp in milliseconds
      [365,1450754220000]
    ]
  },
  {
    "target":"upper_90",
    "datapoints":[
      [861,1450754160000],
      [767,1450754220000]
    ]
  }
]

但是 iotdb grafana connector 只支持 单个 target 返回,所以对 iotdb grafana connector 做了相关的扩展, 执行 * 匹配查询,可以支持多个 target 数据。

扩展以后的效果:

image.png
©著作权归作者所有,转载或内容合作请联系作者
【社区内容提示】社区部分内容疑似由AI辅助生成,浏览时请结合常识与多方信息审慎甄别。
平台声明:文章内容(如有图片或视频亦包括在内)由作者上传并发布,文章内容仅代表作者本人观点,简书系信息发布平台,仅提供信息存储服务。

相关阅读更多精彩内容

友情链接更多精彩内容