fluent-plugin-growthforecastをネストしたデータに対応してみた
fluentdからgrowthforecastに投げるとき以下のようなデータがきた場合
2012-07-16 13:50:27 +0000 dstat.all: {"hostname":"localhost","dstat":{"total-cpu-usage":{"usr":"5","sys":"2","idl":"93","wai":"0","hiq":"0","siq":null},"memory-usage":{"used":"62.6M","buff":"122M","cach":"210M 8","free":".6M"},"dsk/total":{"read":"0","writ":"0"},"net/total":{"recv":"383B","send":"100B"}}}
うまくgrowthforecastに投げれなかったのでネストしたデータがあっても投げれる
ように対応した.設定ファイルは以下の通り
<match dstat.all> type growthforecast gfapi_url http://localhost:5125/api/ service dstat section memory name_nested_keys dstat.total-cpu-usage.usr, dstat.total-cpu-usage.sys, dstat.total-cpu-usage.idl, dstat.total-cpu-usage.wai </match>
でデータが取れるようになります.こんな感じに
グラフが取れました.
ここにおいてあります:https://github.com/katsyoshi/fluent-plugin-growthforecast