0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 5 years have passed since last update.

Grafanaでelasticsearchの時系列データではないデータを表示する方法

Last updated at Posted at 2019-08-22

やりたいこと

elsticsearchに入れている、
サーバーの構成管理の情報とサーバーのアラームをGrafana上で同じダッシュボードに表示したい。
elasticsearchをデータソースにし、Grafanaのパネルはtableにし、rawdocumentで表示する。
サーバーのアラームはGrafanaの時間帯指定に範囲を表示し、
構成管理の情報はGrafanaの時間帯指定に関係なく表示したい(ついでにtemplateとvariablesでフィルターをかけたい)。

課題

elasticsearchのデータを、Grafanaの時間帯指定に関係なく表示するというのが一工夫のいるポイント。
ただ表示するだけでは、Grafanaの時間帯指定の範囲しか表示されないので、やりたいことは実現できない。

コミュニテイの似たような質問

基本的にはできない模様。パネルの種類によってはできるような感じ
https://community.grafana.com/t/graphs-for-non-time-series-data/3932

Override rerative time 機能

GrafanaのパネルのOverride rerative time 機能を使って解決する。
Grafanaのパネルには、
Override rerative time 機能といって、ダッシュボードで表示するよう指定した時間帯とは関係なく、常時直近の時間を表示する機能がある。

まず表示したいデータのタイムスタンプを常時更新するようにシェルをelasticssearchに対して動かして、
このOverride rerative time 機能で直近1日(last 1day)を常時表示させれば、
Grafanaの時間指定に関係なく、データを表示できる。

elasticsearchのデータの@timestampを更新する

そのためには、elasicsearchのタイムスタンプを全件更新するシェルが必要になる。
それは次の記事に書く。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?