Skip to content

Instantly share code, notes, and snippets.

@mhnsr
Last active August 29, 2015 14:15
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save mhnsr/c72a1a49772e01ceee8d to your computer and use it in GitHub Desktop.
Save mhnsr/c72a1a49772e01ceee8d to your computer and use it in GitHub Desktop.
dstat_map でのエラー情報まとめと上手くいった設定のまとめ
■最初のtd-agent.conf
<source>
type dstat
tag dstat
option -lcn
delay 5
</source>
<match dstat>
type copy
<store>
type stdout
</store>
<store>
type map
tag "map.dstat.cpu"
time time
# record record['dstat']['total cpu usage']
record {"value" => record["dstat"]["load avg"]["1m"], "stat" => "loadavg-short", "host" => record["hostname"]}
</store>
</match>
■log
# service td-agent restart
/opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/config/basic_parser.rb:87:in `parse_error!': got incomplete JSON hash configuration at td-agent.conf line 28,9 (Fluent::ConfigParseError)
27: name_key_pattern .*
28: </match>
---------^
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/config/literal_parser.rb:236:in `scan_json'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/config/literal_parser.rb:58:in `parse_literal'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/config/v1_parser.rb:128:in `parse_element'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/config/v1_parser.rb:93:in `parse_element'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/config/v1_parser.rb:93:in `parse_element'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/config/v1_parser.rb:41:in `parse!'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/config/v1_parser.rb:31:in `parse'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/config.rb:30:in `parse'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/supervisor.rb:358:in `read_config'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/supervisor.rb:128:in `start'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/command/fluentd.rb:168:in `<top (required)>'
from /opt/td-agent/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /opt/td-agent/embedded/lib/ruby/site_ruby/2.1.0/rubygems/core_ext/kernel_require.rb:55:in `require'
from /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/bin/fluentd:6:in `<top (required)>'
from /opt/td-agent/embedded/bin/fluentd:23:in `load'
from /opt/td-agent/embedded/bin/fluentd:23:in `<top (required)>'
from /usr/sbin/td-agent:7:in `load'
from /usr/sbin/td-agent:7:in `<main>'
■fix_493投入版のログ
2015-02-22 23:49:59 +0900 [info]: using configuration file: <ROOT>
<source>
type dstat
tag dstat
option -lcn
delay 5
</source>
<match dstat>
type copy
<store>
type stdout
</store>
<store>
type map
tag map.dstat.cpu
time time
record {"value" => record["dstat"]["load avg"]["1m"], "stat" => "loadavg-short", "host" => record["hostname"]}
</store>
</match>
</ROOT>
2015-02-22 23:49:59 +0900 [info]: adding source type="dstat"
2015-02-22 23:49:59 +0900 [info]: adding match pattern="dstat" type="copy"
2015-02-22 23:49:59 +0900 dstat: {"hostname":"monitor","dstat":{"load avg":{"1m":"0.0","5m":"0.0","15m":"0.0"},"total cpu usage":{"usr":"1.517","sys":"0.323","idl":"98.122","wai":"0.032","hiq":"0.002","siq":"0.005"},"net/total":{"recv":"0.0","send":"0.0"}}}
2015-02-22 23:49:59 +0900 [warn]: emit transaction failed error_class=NoMethodError error=#<NoMethodError: undefined method `dstat' for nil:NilClass> tag="dstat"
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:79:in `eval'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:79:in `eval'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:79:in `block (2 levels) in generate_tuples_single'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:92:in `block in timeout_block'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:35:in `block in catch'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:35:in `catch'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:35:in `catch'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:106:in `timeout'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:91:in `timeout_block'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:73:in `block in generate_tuples_single'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/event.rb:55:in `call'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/event.rb:55:in `each'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:72:in `generate_tuples_single'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:48:in `do_map'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:31:in `emit'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/output.rb:33:in `next'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/plugin/out_stdout.rb:49:in `emit'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/output.rb:33:in `next'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/plugin/out_copy.rb:73:in `emit'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/match.rb:36:in `emit'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/engine.rb:160:in `emit_stream'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/engine.rb:140:in `emit'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:130:in `block in receive_lines'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:96:in `each'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:96:in `receive_lines'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:165:in `call'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:165:in `on_change'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/cool.io-1.2.4/lib/cool.io/loop.rb:88:in `run_once'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/cool.io-1.2.4/lib/cool.io/loop.rb:88:in `run'
2015-02-22 23:49:59 +0900 [warn]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:64:in `run'
2015-02-22 23:49:59 +0900 [error]: unexpected error error="undefined method `dstat' for nil:NilClass"
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:79:in `eval'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:79:in `eval'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:79:in `block (2 levels) in generate_tuples_single'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:92:in `block in timeout_block'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:91:in `block in timeout'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:35:in `block in catch'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:35:in `catch'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:35:in `catch'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/2.1.0/timeout.rb:106:in `timeout'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:91:in `timeout_block'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:73:in `block in generate_tuples_single'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/event.rb:55:in `call'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/event.rb:55:in `each'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:72:in `generate_tuples_single'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:48:in `do_map'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-map-0.0.4/lib/fluent/plugin/out_map.rb:31:in `emit'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/output.rb:33:in `next'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/plugin/out_stdout.rb:49:in `emit'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/output.rb:33:in `next'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/plugin/out_copy.rb:73:in `emit'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/match.rb:36:in `emit'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/engine.rb:160:in `emit_stream'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluentd-0.10.60/lib/fluent/engine.rb:140:in `emit'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:130:in `block in receive_lines'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:96:in `each'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:96:in `receive_lines'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:165:in `call'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:165:in `on_change'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/cool.io-1.2.4/lib/cool.io/loop.rb:88:in `run_once'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/cool.io-1.2.4/lib/cool.io/loop.rb:88:in `run'
2015-02-22 23:49:59 +0900 [error]: /opt/td-agent/embedded/lib/ruby/gems/2.1.0/gems/fluent-plugin-dstat-0.2.5/lib/fluent/plugin/in_dstat.rb:64:in `run'
■fix_493を適用しつつv1configで上手くいった版
2015-02-23 00:57:29 +0900 [info]: using configuration file: <ROOT>
<source>
type dstat
tag dstat
option -lcn
delay 5
</source>
<match dstat>
type copy
<store>
type stdout
</store>
<store>
type map
tag "map.dstat.cpu"
map ["map." + tag + ".cpu", time , "cpu" => record["dstat"]["load avg"]["1m"]]
</store>
</match>
<match map.dstat.**>
type stdout
</match>
</ROOT>
2015-02-23 00:57:29 +0900 [info]: adding source type="dstat"
2015-02-23 00:57:29 +0900 [info]: adding match pattern="dstat" type="copy"
2015-02-23 00:57:29 +0900 [info]: adding match pattern="map.dstat.**" type="stdout"
2015-02-23 00:57:29 +0900 dstat: {"hostname":"monitor","dstat":{"load avg":{"1m":"0.0","5m":"0.0","15m":"0.0"},"total cpu usage":{"usr":"1.533","sys":"0.322","idl":"98.103","wai":"0.032","hiq":"0.002","siq":"0.007"},"net/total":{"recv":"0.0","send":"0.0"}}}
2015-02-23 00:57:29 +0900 map.dstat.cpu: {"cpu":"0.0"}
2015-02-23 00:57:34 +0900 dstat: {"hostname":"monitor","dstat":{"load avg":{"1m":"0.0","5m":"0.0","15m":"0.0"},"total cpu usage":{"usr":"0.0","sys":"0.0","idl":"100.0","wai":"0.0","hiq":"0.0","siq":"0.0"},"net/total":{"recv":"36.0","send":"89.600"}}}
2015-02-23 00:57:34 +0900 map.dstat.cpu: {"cpu":"0.0"}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment