Skip to content

Instantly share code, notes, and snippets.

@mikeda
Created June 10, 2012 13:47
Show Gist options
  • Save mikeda/2905707 to your computer and use it in GitHub Desktop.
Save mikeda/2905707 to your computer and use it in GitHub Desktop.
fluent-plugin-zabbixをdatacounterと連携用にちょっといじる
# datacounterと連携させるときにアイテム、グラフ、スクリーン作りまくるのが面倒だから
# テンプレート化できるようにに変換する
# host:webservice, key:site1_2xx_count
# => host:webservice_site1, key:2xx_count
module Fluent
class ZabbixExtOutput < ZabbixOutput
Fluent::Plugin.register_output('zabbix_ext', self)
config_param :split_host, :bool, :default => false
def configure(conf)
super
@host_orig = @host
end
def send(tag, name, value, time)
if @split_host
prj, name = name.split("_", 2)
@host = "#{@host_orig}_#{prj}"
$log.warn("host:#{@host} key:#{name}")
end
super
end
end
end
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment