logstash-input-ganglia 3.0.2 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: f9027acda85099173a8d1521296246995c5103b9
4
- data.tar.gz: 385006fcdaa7132e9fe0c020abc87fa4262a7b7e
3
+ metadata.gz: e71cd4eb2c312f38f6a9cdd424a1b40eaa104095
4
+ data.tar.gz: 8ce6c1eace0180133fe1408b4267224447e1e835
5
5
  SHA512:
6
- metadata.gz: 986725b977be118d1b6f74d382a54d73a09413556265d9c27a725df05f5428a081f955bf1b1d07cee861c6e0e9bb87cbcd1d6d1c5c2bb9cec0a6244c31cc9bb9
7
- data.tar.gz: 5313d4148b54340acca0a544381fee6c9f1c8cb529ff344e296d5deeeae82ec97a63e5932544f2b788995674f614b4e4e1f64c4259e7c7f063b1d4dae5ea3ddb
6
+ metadata.gz: e201136446763096ad428755dbf2896ec589d7ce5ede7bdac752a513efd5dc1e2963c4baa63ea267667afda2267b21ca1e712491b3f158e883d5e5067eda5517
7
+ data.tar.gz: abb1831b01ad5fa9206a10daa9c64c71dcb1ac98a4b64b93a8e957adb470e7a4e3d9abffb76314850a172a1c165aa331d91cd421700677781adf093597f74010
@@ -1,3 +1,6 @@
1
+ ## 3.1.0
2
+ - Store the name and value of ganglia metrics
3
+
1
4
  ## 3.0.2
2
5
  - Relax constraint on logstash-core-plugin-api to >= 1.60 <= 2.99
3
6
 
@@ -111,8 +111,9 @@ class LogStash::Inputs::Ganglia < LogStash::Inputs::Base
111
111
 
112
112
  # Check if it was a valid data request
113
113
  return nil unless data
114
- props={ "program" => "ganglia", "log_host" => data["hostname"] }
115
- %w{dmax tmax slope type units}.each do |info|
114
+ props={ "program" => "ganglia", "log_host" => data["hostname"],
115
+ "val" => data["val"] }
116
+ %w{dmax tmax slope type units name}.each do |info|
116
117
  props[info] = @metadata[data["name"]][info]
117
118
  end
118
119
  return LogStash::Event.new(props)
@@ -20,12 +20,22 @@ class GmonPacket
20
20
  case type
21
21
  when 128
22
22
  @type=:meta
23
+ when 129
24
+ @type=:ushort
25
+ when 130
26
+ @type=:short
27
+ when 131
28
+ @type=:int
23
29
  when 132
24
- @type=:heartbeat
25
- when 133..134
26
- @type=:data
30
+ @type=:uint
31
+ when 133
32
+ @type=:string
33
+ when 134
34
+ @type=:float
27
35
  when 135
28
- @type=:gexec
36
+ @type=:double
37
+ when 136
38
+ @type=:meta_request
29
39
  else
30
40
  @type=:unknown
31
41
  end
@@ -36,7 +46,7 @@ class GmonPacket
36
46
  end
37
47
 
38
48
  def data?
39
- @type == :data
49
+ [:ushort, :short, :int, :uint, :string, :float, :double].include? @type
40
50
  end
41
51
 
42
52
  def meta?
@@ -94,15 +104,7 @@ class GmonPacket
94
104
  data['spoof']=@xdr.uint32
95
105
  data['format']=@xdr.string
96
106
 
97
- metrictype=name_to_type(metricname,metadata)
98
-
99
- if metrictype.nil?
100
- # Probably we got a data packet before a metadata packet
101
- #puts "Received datapacket without metadata packet"
102
- return nil
103
- end
104
-
105
- data['val']=parse_value(metrictype)
107
+ data['val']=parse_value(@type)
106
108
 
107
109
  # If we received a packet, last update was 0 time ago
108
110
  data['tn']=0
@@ -114,19 +116,19 @@ class GmonPacket
114
116
  def parse_value(type)
115
117
  value=:unknown
116
118
  case type
117
- when "int16"
119
+ when :short
118
120
  value=@xdr.int16
119
- when "uint16"
121
+ when :ushort
120
122
  value=@xdr.uint16
121
- when "uint32"
122
- value=@xdr.uint32
123
- when "int32"
123
+ when :int
124
124
  value=@xdr.int32
125
- when "float"
125
+ when :uint
126
+ value=@xdr.uint32
127
+ when :float
126
128
  value=@xdr.float32
127
- when "double"
129
+ when :double
128
130
  value=@xdr.float64
129
- when "string"
131
+ when :string
130
132
  value=@xdr.string
131
133
  else
132
134
  #puts "Received unknown type #{type}"
@@ -134,13 +136,4 @@ class GmonPacket
134
136
  return value
135
137
  end
136
138
 
137
- # Does lookup of metricname in metadata table to find the correct type
138
- def name_to_type(name,metadata)
139
- # Lookup this metric metadata
140
- meta=metadata[name]
141
- return nil if meta.nil?
142
-
143
- return meta['type']
144
- end
145
-
146
139
  end
@@ -1,7 +1,7 @@
1
1
  Gem::Specification.new do |s|
2
2
 
3
3
  s.name = 'logstash-input-ganglia'
4
- s.version = '3.0.2'
4
+ s.version = '3.1.0'
5
5
  s.licenses = ['Apache License (2.0)']
6
6
  s.summary = "Read ganglia packets from the network via udp"
7
7
  s.description = "This gem is a Logstash plugin required to be installed on top of the Logstash core pipeline using $LS_HOME/bin/logstash-plugin install gemname. This gem is not a stand-alone program"
@@ -61,5 +61,16 @@ describe LogStash::Inputs::Ganglia do
61
61
  expect(event.get("tmax")).to eq(60)
62
62
  end
63
63
 
64
+ it "should receive the correct data type" do
65
+ expect(event.get("type")).to eq('uint8')
66
+ end
67
+
68
+ it "should receive the name" do
69
+ expect(event.get("name")).to eq('pageviews')
70
+ end
71
+
72
+ it "should receive the value" do
73
+ expect(event.get("val")).to eq('7000')
74
+ end
64
75
  end
65
76
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: logstash-input-ganglia
3
3
  version: !ruby/object:Gem::Version
4
- version: 3.0.2
4
+ version: 3.1.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Elastic
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-07-14 00:00:00.000000000 Z
11
+ date: 2016-12-26 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  requirement: !ruby/object:Gem::Requirement
@@ -127,7 +127,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
127
127
  version: '0'
128
128
  requirements: []
129
129
  rubyforge_project:
130
- rubygems_version: 2.6.3
130
+ rubygems_version: 2.4.8
131
131
  signing_key:
132
132
  specification_version: 4
133
133
  summary: Read ganglia packets from the network via udp