Created
June 10, 2012 13:47
-
-
Save mikeda/2905707 to your computer and use it in GitHub Desktop.
fluent-plugin-zabbixをdatacounterと連携用にちょっといじる
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# 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