Skip to content

Instantly share code, notes, and snippets.

@kazu634
Created March 1, 2016 13:38
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 kazu634/23612b45375243e8a7da to your computer and use it in GitHub Desktop.
Save kazu634/23612b45375243e8a7da to your computer and use it in GitHub Desktop.
Test configuration file for td-agent
<source>
type dstat
tag foo
option -cdnm --tcp --udp --load -gs
delay 5
</source>
<source>
type df
option -k
interval 10
tag_prefix df
target_mounts /
replace_slash true
rm_percent true
hostname false
</source>
<match df.**>
type record_reformer
enable_ruby false
tag test.df
<record>
hostname ${hostname}
</record>
</match>
<match test.df>
type rewrite_tag_filter
rewriterule1 hostname (.+) tmp.df.$1
</match>
<match tmp.df.*>
type forest
subtype growthforecast
remove_prefix tmp
<template>
gfapi_url http://localhost:5125/api/
service host:${tag_parts[1]}
section df
name_key_pattern capacity
keeplive true
enable_float_number true
</template>
</match>
<match foo>
type record_reformer
enable_ruby false
tag test.dstat
<record>
hostname ${hostname}
</record>
</match>
<match test.dstat>
type rewrite_tag_filter
rewriterule1 hostname (.+) tmp.dstat.$1
</match>
<match tmp.dstat.*>
type forest
subtype copy
<template>
<store>
type map
tag ("dstat.cpu.${tag_parts[2]}")
time time
record record['dstat']['total_cpu_usage']
</store>
<store>
type map
tag ("dstat.memory.${tag_parts[2]}")
time time
record record['dstat']['memory_usage']
</store>
<store>
type map
tag ("dstat.loadavg.${tag_parts[2]}")
time time
record record['dstat']['load_avg']
</store>
<store>
type map
tag ("dstat.network.${tag_parts[2]}")
time time
record record['dstat']['net/total']
</store>
<store>
type map
tag ("dstat.disk_io.${tag_parts[2]}")
time time
record record['dstat']['dsk/total']
</store>
<store>
type map
tag ("dstat.tcp.${tag_parts[2]}")
time time
record record['dstat']['tcp_sockets']
</store>
<store>
type map
tag ("dstat.udp.${tag_parts[2]}")
time time
record record['dstat']['udp']
</store>
<store>
type map
tag ("dstat.swap.${tag_parts[2]}")
time time
record record['dstat']['swap']
</store>
<store>
type map
tag ("dstat.paging.${tag_parts[2]}")
time time
record record['dstat']['paging']
</store>
<store>
type file
path /tmp/result.json
</store>
</template>
</match>
<match dstat.*.*>
type forest
subtype growthforecast
remove_prefix dstat
<template>
gfapi_url http://localhost:5125/api/
section ${tag_parts[0]}
service host:${tag_parts[1]}
name_key_pattern .*
keeplive true
enable_float_number true
</template>
</match>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment