Sha256: 8b2a3932e0beef27a936b92bd0ec6d3565fe7614f71d7cb396fbe02e9e56b6dc
Contents?: true
Size: 1.29 KB
Versions: 1
Compression:
Stored size: 1.29 KB
Contents
require "hosted_graphite" module Fluent class OutHostedGraphite < Fluent::Output Fluent::Plugin.register_output('hosted_graphite', self) config_param :api_key, :string config_param :metric_key, :string, default: nil config_param :protocol, :string, default: "http" def configure(conf) super # end def start super # ... end def shutdown super # ... end def emit(tag, es, chain) chain.next es.each {|time,record| unless record.include?(@metric_key) log.warn "metric_key does not exists." else metric_key = @metric_key metric = record[@metric_key].to_f post_metrics(metric_key, metric) end } end def post_metrics(metric_key, metric) HostedGraphite.api_key = @api_key case @protocol when "http" HostedGraphite.protocol = HostedGraphite::HTTP when "tcp" HostedGraphite.protocol = HostedGraphite::TCP when "udp" HostedGraphite.protocol = HostedGraphite::UDP end HostedGraphite.send_metric(metric_key, metric) #result = HostedGraphite.send_metric(metric_key, metric) #puts "debug_out: #{@api_key} #{@protocol} #{result} - #{metric_key} - #{metric}" end end end
Version data entries
1 entries across 1 versions & 1 rubygems
Version | Path |
---|---|
fluent-plugin-out_hosted_graphite-0.0.1 | lib/fluent/plugin/out_hosted_graphite.rb |