ganymed 0.2.1 → 0.2.2

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,5 +1,5 @@
1
1
  collect(0.3) do
2
- return if not File.readable?('/proc/stat')
2
+ break if not File.readable?('/proc/stat')
3
3
 
4
4
  File.open('/proc/stat').each do |line|
5
5
  next if not line =~ /^cpu /
@@ -5,7 +5,7 @@ Struct.new("IOStat",
5
5
  :running, :use, :aveq)
6
6
 
7
7
  collect(0.3) do
8
- return if not File.readable?('/proc/diskstats')
8
+ next if not File.readable?('/proc/diskstats')
9
9
  File.open('/proc/diskstats').each do |line|
10
10
  ios = Struct::IOStat.new(*line.strip.split(/\s+/))
11
11
  next if config.skip_numbered.tap{} and ios.dev =~ /\d+$/
@@ -1,5 +1,5 @@
1
1
  collect(5) do
2
- return if not File.readable?('/proc/loadavg')
2
+ next if not File.readable?('/proc/loadavg')
3
3
  File.open('/proc/loadavg') do |f|
4
4
  loadavg = f.read.chomp.split[0,3].map(&:to_f)
5
5
  sampler.emit(:gauge, "os.loadavg", loadavg[0])
@@ -1,5 +1,5 @@
1
1
  collect(5) do
2
- return if not File.readable?('/proc/meminfo')
2
+ next if not File.readable?('/proc/meminfo')
3
3
 
4
4
  # calculate app memory from total
5
5
  apps = 0
@@ -4,7 +4,7 @@ Struct.new("NetworkStat", :dev,
4
4
  :wbytes, :wpackets, :werrs, :wdrop, :wfifo, :wcolls, :wcarrier, :wcompressed)
5
5
 
6
6
  collect(0.3) do
7
- return if not File.readable?('/proc/net/dev')
7
+ break if not File.readable?('/proc/net/dev')
8
8
 
9
9
  File.open('/proc/net/dev') do |f|
10
10
  f.each do |line|
@@ -1,5 +1,5 @@
1
1
  collect(0.3) do
2
- return if not File.readable?('/proc/stat')
2
+ break if not File.readable?('/proc/stat')
3
3
  File.open('/proc/stat').each do |line|
4
4
  key, value = line.chomp.split
5
5
  case key
@@ -1,5 +1,5 @@
1
1
  collect do
2
- return if not File.readable?('/proc/stat')
2
+ break if not File.readable?('/proc/stat')
3
3
  File.open('/proc/stat').each do |line|
4
4
  next if not line =~ /^btime /
5
5
  boottime = Time.at(line.chomp.split[1].to_i)
@@ -72,6 +72,7 @@ module Ganymed
72
72
  :cf => cf,
73
73
  :origin => origin,
74
74
  :timestamp => timestamp,
75
+ :resolution => resolution,
75
76
  :value => value
76
77
  }
77
78
  end
@@ -75,7 +75,11 @@ module Ganymed
75
75
  connection.publish(event)
76
76
  end
77
77
 
78
- # skip events that are produced below the mongodb storage threshold
78
+ # normalize timestamp for events with a resolution
79
+ if event.resolution > 1
80
+ event.timestamp -= event.timestamp % event.resolution
81
+
82
+ # skip events that are produced below the resolution threshold
79
83
  return if (1...@config.resolution).include?(event.resolution)
80
84
 
81
85
  # insert event into ns collection
@@ -1,4 +1,4 @@
1
1
  module Ganymed
2
2
  # @private
3
- VERSION = '0.2.1'
3
+ VERSION = '0.2.2'
4
4
  end
@@ -11,10 +11,10 @@ module Ganymed
11
11
  @spec.map do |skey, svalue|
12
12
  evalue = event.send(skey.to_sym)
13
13
  case svalue
14
- when String
15
- svalue == evalue
16
14
  when Array
17
15
  svalue.include?(evalue)
16
+ else
17
+ svalue == evalue
18
18
  end
19
19
  end.all?
20
20
  end
@@ -15,23 +15,23 @@ module Ganymed
15
15
 
16
16
  def subscribe(data)
17
17
  return if not authenticated?
18
- data.each do |prefix, filter|
19
- log.debug("client #{peer} subscribed to #{prefix} with filter=#{filter.inspect}")
20
- filters[prefix] = Filter.new(filter)
18
+ data.each do |ns, filter|
19
+ log.debug("client #{peer} subscribed to #{ns} with filter=#{filter.inspect}")
20
+ filters[ns] = Filter.new(filter)
21
21
  end
22
22
  end
23
23
 
24
24
  def unsubscribe(data)
25
25
  return if not authenticated?
26
- data.each do |prefix, filter|
27
- log.debug("client #{peer} unsubscribed prefix #{prefix}")
28
- filters.delete(prefix)
26
+ data.each do |ns, filter|
27
+ log.debug("client #{peer} unsubscribed namespace #{ns}")
28
+ filters.delete(ns)
29
29
  end
30
30
  end
31
31
 
32
32
  def subscribed?(event)
33
- filters.map do |prefix, filter|
34
- filter if prefix == "all" or event.ns =~ /^#{prefix}/
33
+ filters.map do |ns, filter|
34
+ filter if ns == "all" or event.ns == ns
35
35
  end.compact.map do |filter|
36
36
  filter.match?(event)
37
37
  end.any?
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: ganymed
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.2.1
4
+ version: 0.2.2
5
5
  prerelease:
6
6
  platform: ruby
7
7
  authors:
@@ -9,11 +9,11 @@ authors:
9
9
  autorequire:
10
10
  bindir: bin
11
11
  cert_chain: []
12
- date: 2012-05-29 00:00:00.000000000 Z
12
+ date: 2012-05-30 00:00:00.000000000 Z
13
13
  dependencies:
14
14
  - !ruby/object:Gem::Dependency
15
15
  name: activesupport
16
- requirement: &11533840 !ruby/object:Gem::Requirement
16
+ requirement: &11336480 !ruby/object:Gem::Requirement
17
17
  none: false
18
18
  requirements:
19
19
  - - ! '>='
@@ -21,10 +21,10 @@ dependencies:
21
21
  version: '3.2'
22
22
  type: :runtime
23
23
  prerelease: false
24
- version_requirements: *11533840
24
+ version_requirements: *11336480
25
25
  - !ruby/object:Gem::Dependency
26
26
  name: eventmachine
27
- requirement: &11547700 !ruby/object:Gem::Requirement
27
+ requirement: &11333940 !ruby/object:Gem::Requirement
28
28
  none: false
29
29
  requirements:
30
30
  - - ! '>='
@@ -32,10 +32,10 @@ dependencies:
32
32
  version: 0.12.10
33
33
  type: :runtime
34
34
  prerelease: false
35
- version_requirements: *11547700
35
+ version_requirements: *11333940
36
36
  - !ruby/object:Gem::Dependency
37
37
  name: ganymed-client
38
- requirement: &11545880 !ruby/object:Gem::Requirement
38
+ requirement: &11331240 !ruby/object:Gem::Requirement
39
39
  none: false
40
40
  requirements:
41
41
  - - ! '>='
@@ -43,10 +43,10 @@ dependencies:
43
43
  version: '0'
44
44
  type: :runtime
45
45
  prerelease: false
46
- version_requirements: *11545880
46
+ version_requirements: *11331240
47
47
  - !ruby/object:Gem::Dependency
48
48
  name: madvertise-ext
49
- requirement: &11543540 !ruby/object:Gem::Requirement
49
+ requirement: &11329740 !ruby/object:Gem::Requirement
50
50
  none: false
51
51
  requirements:
52
52
  - - ! '>='
@@ -54,10 +54,10 @@ dependencies:
54
54
  version: 0.1.2
55
55
  type: :runtime
56
56
  prerelease: false
57
- version_requirements: *11543540
57
+ version_requirements: *11329740
58
58
  - !ruby/object:Gem::Dependency
59
59
  name: madvertise-logging
60
- requirement: &11568260 !ruby/object:Gem::Requirement
60
+ requirement: &11357980 !ruby/object:Gem::Requirement
61
61
  none: false
62
62
  requirements:
63
63
  - - ! '>='
@@ -65,10 +65,10 @@ dependencies:
65
65
  version: 0.3.2
66
66
  type: :runtime
67
67
  prerelease: false
68
- version_requirements: *11568260
68
+ version_requirements: *11357980
69
69
  - !ruby/object:Gem::Dependency
70
70
  name: mixlib-cli
71
- requirement: &11567280 !ruby/object:Gem::Requirement
71
+ requirement: &11356980 !ruby/object:Gem::Requirement
72
72
  none: false
73
73
  requirements:
74
74
  - - ! '>='
@@ -76,10 +76,10 @@ dependencies:
76
76
  version: '0'
77
77
  type: :runtime
78
78
  prerelease: false
79
- version_requirements: *11567280
79
+ version_requirements: *11356980
80
80
  - !ruby/object:Gem::Dependency
81
81
  name: RubyInline
82
- requirement: &11565860 !ruby/object:Gem::Requirement
82
+ requirement: &11354780 !ruby/object:Gem::Requirement
83
83
  none: false
84
84
  requirements:
85
85
  - - ! '>='
@@ -87,10 +87,10 @@ dependencies:
87
87
  version: '0'
88
88
  type: :runtime
89
89
  prerelease: false
90
- version_requirements: *11565860
90
+ version_requirements: *11354780
91
91
  - !ruby/object:Gem::Dependency
92
92
  name: servolux
93
- requirement: &11564440 !ruby/object:Gem::Requirement
93
+ requirement: &11352760 !ruby/object:Gem::Requirement
94
94
  none: false
95
95
  requirements:
96
96
  - - ! '>='
@@ -98,10 +98,10 @@ dependencies:
98
98
  version: '0'
99
99
  type: :runtime
100
100
  prerelease: false
101
- version_requirements: *11564440
101
+ version_requirements: *11352760
102
102
  - !ruby/object:Gem::Dependency
103
103
  name: msgpack
104
- requirement: &11562600 !ruby/object:Gem::Requirement
104
+ requirement: &11351720 !ruby/object:Gem::Requirement
105
105
  none: false
106
106
  requirements:
107
107
  - - ! '>='
@@ -109,10 +109,10 @@ dependencies:
109
109
  version: '0'
110
110
  type: :runtime
111
111
  prerelease: false
112
- version_requirements: *11562600
112
+ version_requirements: *11351720
113
113
  - !ruby/object:Gem::Dependency
114
114
  name: mongo
115
- requirement: &11576160 !ruby/object:Gem::Requirement
115
+ requirement: &11372540 !ruby/object:Gem::Requirement
116
116
  none: false
117
117
  requirements:
118
118
  - - ! '>='
@@ -120,10 +120,10 @@ dependencies:
120
120
  version: '1.6'
121
121
  type: :runtime
122
122
  prerelease: false
123
- version_requirements: *11576160
123
+ version_requirements: *11372540
124
124
  - !ruby/object:Gem::Dependency
125
125
  name: em-websocket
126
- requirement: &11573300 !ruby/object:Gem::Requirement
126
+ requirement: &11368680 !ruby/object:Gem::Requirement
127
127
  none: false
128
128
  requirements:
129
129
  - - ! '>='
@@ -131,10 +131,10 @@ dependencies:
131
131
  version: '0'
132
132
  type: :runtime
133
133
  prerelease: false
134
- version_requirements: *11573300
134
+ version_requirements: *11368680
135
135
  - !ruby/object:Gem::Dependency
136
136
  name: yajl-ruby
137
- requirement: &11572500 !ruby/object:Gem::Requirement
137
+ requirement: &11367160 !ruby/object:Gem::Requirement
138
138
  none: false
139
139
  requirements:
140
140
  - - ! '>='
@@ -142,10 +142,10 @@ dependencies:
142
142
  version: '0'
143
143
  type: :runtime
144
144
  prerelease: false
145
- version_requirements: *11572500
145
+ version_requirements: *11367160
146
146
  - !ruby/object:Gem::Dependency
147
147
  name: sys-filesystem
148
- requirement: &11570040 !ruby/object:Gem::Requirement
148
+ requirement: &11365860 !ruby/object:Gem::Requirement
149
149
  none: false
150
150
  requirements:
151
151
  - - ! '>='
@@ -153,10 +153,10 @@ dependencies:
153
153
  version: '0'
154
154
  type: :runtime
155
155
  prerelease: false
156
- version_requirements: *11570040
156
+ version_requirements: *11365860
157
157
  - !ruby/object:Gem::Dependency
158
158
  name: ohai
159
- requirement: &11598400 !ruby/object:Gem::Requirement
159
+ requirement: &11387480 !ruby/object:Gem::Requirement
160
160
  none: false
161
161
  requirements:
162
162
  - - ! '>='
@@ -164,7 +164,7 @@ dependencies:
164
164
  version: 0.6.12
165
165
  type: :runtime
166
166
  prerelease: false
167
- version_requirements: *11598400
167
+ version_requirements: *11387480
168
168
  description: Ganymed is an event collection daemon
169
169
  email:
170
170
  - bb@xnull.de
@@ -192,7 +192,6 @@ files:
192
192
  - lib/ganymed/collectors/iostat.rb
193
193
  - lib/ganymed/collectors/load.rb
194
194
  - lib/ganymed/collectors/memory.rb
195
- - lib/ganymed/collectors/metadata.rb
196
195
  - lib/ganymed/collectors/network.rb
197
196
  - lib/ganymed/collectors/process.rb
198
197
  - lib/ganymed/collectors/uptime.rb
@@ -239,7 +238,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
239
238
  version: '0'
240
239
  segments:
241
240
  - 0
242
- hash: 2510946604903301186
241
+ hash: 2492483449465881370
243
242
  required_rubygems_version: !ruby/object:Gem::Requirement
244
243
  none: false
245
244
  requirements:
@@ -248,7 +247,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
248
247
  version: '0'
249
248
  segments:
250
249
  - 0
251
- hash: 2510946604903301186
250
+ hash: 2492483449465881370
252
251
  requirements: []
253
252
  rubyforge_project:
254
253
  rubygems_version: 1.8.17
@@ -1,22 +0,0 @@
1
- require 'ohai'
2
-
3
- collect do
4
- Ohai::System.new.tap do |ohai|
5
- %w(
6
- os
7
- kernel
8
- hostname
9
- keys
10
- network
11
- platform
12
- uptime
13
- virtualization
14
- ).each do |plugin|
15
- ohai.require_plugin(plugin)
16
- end
17
- processor.metadata(ohai.data)
18
-
19
- # ohai doesn't cleanup after itself
20
- true while Process.wait(-1, Process::WNOHANG) rescue nil
21
- end
22
- end