LoginSignup
6
6

More than 5 years have passed since last update.

mackerelでfluentdのmonitor_agent監視するplugin作った

Last updated at Posted at 2015-02-10

経緯

go-mackerel-pluginを使って何か作ってみたかったので、fluentdのretry_countを監視するものを作ってみました。

リポジトリはこちら。
https://github.com/y-matsuwitter/mackerel-fluentd

使い方

インストール

Linux向けのコンパイル済みバイナリを用意してあるのでcurlして権限与えるだけでOKです。

$ curl -L -o /path/to/mackerel-fluentd  https://github.com/y-matsuwitter/mackerel-fluentd/releases/download/v0.0.1/mackerel-fluentd.linux
$ chmod a+x /path/to/mackerel-fluentd

設定

mackerel-agent.confに下記を追記して下さい。

mackerel-agent.conf
[plugin.metrics.fluentd]
command="/path/to/mackerel-fluentd -host=localhost -port=24220"

サンプル

retry_countが全て0なので見にくいですがこんな感じでメトリクスを取得できます。

スクリーンショット 2015-02-11 7.49.51.png

注意点

fluentdの監視にあたり、monitor_agentを経由していますが、ここで得られるpluginのidは、指定がなければ再起動ごとに切り替わります。
より良い監視のためには、fluentdの設定ファイルにて、下記のようにidの指定をお願いします。

td-agent.conf
<match **>
  id   mystdout
  type stdout
</match>

最後に

mackerel使おう。
https://mackerel.io

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