Skip to content

Instantly share code, notes, and snippets.

@studio3104
Last active August 29, 2015 13:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save studio3104/10024213 to your computer and use it in GitHub Desktop.
Save studio3104/10024213 to your computer and use it in GitHub Desktop.
# key の構成は変わってしまうけど td-agent.conf としてはこっちのほうがシンプル
<source>
type dstat
tag dstat.__HOSTNAME__
option -lnc
delay 3
</source>
<match dstat.**>
type flatten_hash
add_tag_prefix flattened.
separator .
</match>
<match flattened.dstat.**>
type graphite
host localhost
remove_tag_prefix flattened.dstat.
port 2003
tag_for prefix
name_key_pattern ^((?!hostname).)*$
</match>
# https://github.com/hotchpotch/fluent-plugin-graphite を https://github.com/studio3104/fluent-plugin-graphite に置き換えた場合に http://blog.nomadscafe.jp/2014/04/dstat-fluentd-graphite-grafana.html と同じ出力をするための設定
<source>
type dstat
tag dstat
option -lcn
delay 5
</source>
<match dstat>
type copy
<store>
type map
tag "map.dstat.gauges." + record["hostname"]
time time
record { "loadavg-short" => record["dstat"]["load avg"]["1m"] }
</store>
<store>
type map
tag "map.dstat.gauges." + record["hostname"]
time time
record { "cpu-usr" => record["dstat"]["total cpu usage"]["usr"] }
</store>
<store>
type map
tag "map.dstat.gauges." + record["hostname"]
time time
record { "cpu-sys" => record["dstat"]["total cpu usage"]["sys"] }
</store>
<store>
type map
tag "map.dstat.gauges." + record["hostname"]
time time
record { "cpu-hiq" => record["dstat"]["total cpu usage"]["hiq"] }
</store>
<store>
type map
tag "map.dstat.gauges." + record["hostname"]
time time
record { "cpu-siq" => record["dstat"]["total cpu usage"]["siq"] }
</store>
<store>
type map
tag "map.dstat.gauges." + record["hostname"]
time time
record { "net-recv" => record["dstat"]["net/total"]["recv"] }
</store>
<store>
type map
tag "map.dstat.gauges." + record["hostname"]
time time
record { "net-send" => record["dstat"]["net/total"]["send"] }
</store>
</match>
<match map.dstat.**>
type graphite
host localhost
port 2003
remove_tag_prefix map
name_key_pattern .+
</match>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment