Class: LogStash::Outputs::Ganglia

Inherits:
Base show all
Defined in:
lib/logstash/outputs/ganglia.rb

Overview

This output allows you to pull metrics from your logs and ship them to ganglia’s gmond. This is heavily based on the graphite output.

Constant Summary

Constants included from Config::Mixin

Config::Mixin::CONFIGSORT

Instance Attribute Summary

Attributes included from Config::Mixin

#config, #original_params

Attributes inherited from Plugin

#logger, #params

Instance Method Summary collapse

Methods inherited from Base

#handle, #handle_worker, #initialize, #worker_setup, #workers_not_supported

Methods included from Config::Mixin

#config_init, included

Methods inherited from Plugin

#eql?, #finished, #finished?, #hash, #initialize, #inspect, lookup, #reload, #running?, #shutdown, #teardown, #terminating?, #to_s

Constructor Details

This class inherits a constructor from LogStash::Outputs::Base

Instance Method Details

#receive(event) ⇒ Object



50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# File 'lib/logstash/outputs/ganglia.rb', line 50

def receive(event)
  return unless output?(event)

  # gmetric only takes integer values, so convert it to int.
  case @metric_type
    when "string"
      localvalue = event.sprintf(@value)
    when "float"
      localvalue = event.sprintf(@value).to_f
    when "double"
      localvalue = event.sprintf(@value).to_f
    else # int8|uint8|int16|uint16|int32|uint32
      localvalue = event.sprintf(@value).to_i
  end
  Ganglia::GMetric.send(@host, @port, {
    :name => event.sprintf(@metric),
    :units => @units,
    :type => @metric_type,
    :value => localvalue,
    :group => @group,
    :slope => @slope,
    :tmax => @max_interval,
    :dmax => @lifetime
  })
end

#registerObject



45
46
47
# File 'lib/logstash/outputs/ganglia.rb', line 45

def register
  require "gmetric"
end