LoginSignup
7
6

More than 5 years have passed since last update.

Muninにtd-agent/fluentdのプラグインを入れる(CentOS6.5)

Last updated at Posted at 2014-11-19

Fluentdを可視化したい!

手っ取り早く可視化したかったため、実装。

以下の値をグラフ化することができます。

fluentd_process プロセス数の取得
fluentd_resource メモリ量の取得
fluentd_monitor_agent 各種metricsの取得

Muninクライアントの導入

サーバ側は実装済みとする。

sudo yum install perl-XML-SAX-0.96-7.el6.noarch
sudo yum --disablerepo=rpmforge-extras --enablerepo=epel install munin-node

依存関係でエラーがでたので、Perlのインストールとdisablerepoは環境によってどうぞ。

設定

td-agentの設定ファイルにmonitor_agentを記載して再起動。

<source>
  type monitor_agent
  bind 127.0.0.1
  port 24220
</source>

動作確認。
値が帰ってくれば問題ない。

curl http://localhost:24220/api/plugins.json

プラグイン実装

munin-fluentdを使用して、monitor_agentの値をmuninに渡す。

cd /opt
git clone https://github.com/moaikids/munin-fluentd.git

シンボリックリンク

ln -s /opt/munin-fluentd/plugins/fluentd/fluentd_monitor_agent /etc/munin/plugins/
ln -s /opt/munin-fluentd/plugins/fluentd/fluentd_process /etc/munin/plugins/
ln -s /opt/munin-fluentd/plugins/fluentd/fluentd_resource /etc/munin/plugins/

実行権限を付与

chmod +x /opt/munin-fluentd/plugins/fluentd/fluentd_*

設定ファイルを記載

/etc/munin/plugin-conf.d/fluentd

[fluentd*]
user munin
env.host localhost
env.port 24220
env.package td-agent #もしくはfluentd

接続するサーバ追加

/etc/munin/munin-node.conf

allow ^10\.xx\.xx\.xx$

再起動

service munin-node restart

これで、サーバ側で値が取得できれば完了。

etc...

ホスト名にアンダーバー等の文字列が入っている場合は、munin-nodeがうまく動かないので
munin-node.confにhost_nameを記載して対応する。

参考サイト
http://docs.fluentd.org/articles/monitoring#monitoring-agent
http://itsneatlife.blogspot.jp/2013/06/td-agentfluentdmonitoragentbuffer.html

7
6
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
7
6