55
53

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.

dstatをfluentd + GrowthForecastで可視化する

Posted at

dstatの結果をfluentd経由でGrowthForecastに投げる方法は、ぐぐると何件かブログ記事がでてきます。 ただ、どれもdstatを改造したり、プラグインを改造したりしてて、あまり使い勝手がよくありません。

というわけで、gemでいれれるプラグインだけを使って、可視化できる設定を探してみました。

準備

必要なgemをインストールする。

gem install fluent-plugin-map fluent-plugin-dstat fluent-plugin-growthforecast

設定ファイル

<source>
  type dstat
  tag dstat
  option -cm
  delay 3
</source>

# GrowthForecast用にメッセージを加工する
<match dstat>
  type copy

  # CPU関連の結果だけを取り出す
  <store> 
    type map
    tag "perf.cpu"
    time time
    record record['dstat']['total cpu usage']
  </store>

  # メモリ関連の結果だけを取り出す
  <store> 
    type map
    tag "perf.mem"
    time time
    record record['dstat']['memory usage']
  </store>
</match>

# GrowthForecastに転送する
<match perf.**>
   type growthforecast
   gfapi_url http://example.com/api/
   service dstat
   tag_for section
   remove_prefix perf
   name_key_pattern .*
</match>

参考

55
53
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
55
53

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?