nfagent 0.9.20 → 0.9.26
Sign up to get free protection for your applications and to get access to all the features.
- data/Manifest.txt +2 -0
- data/README.rdoc +2 -2
- data/Rakefile +1 -1
- data/lib/nfagent.rb +2 -1
- data/lib/nfagent/chunk.rb +1 -1
- data/lib/nfagent/cli.rb +1 -1
- data/lib/nfagent/config.rb +8 -8
- data/lib/nfagent/object_extra.rb +5 -0
- data/lib/nfagent/plugin.rb +2 -1
- data/lib/nfagent/server.rb +3 -0
- data/sandbox/dumps/debug +0 -0
- data/test/config +3 -3
- data/test/test_chunk.rb +1 -2
- data/test/test_chunk_handler.rb +1 -4
- data/test/test_config.rb +12 -3
- metadata +16 -26
data/Manifest.txt
CHANGED
@@ -16,6 +16,7 @@ test/test_nfagent.rb
|
|
16
16
|
test/test_payload.rb
|
17
17
|
test/test_plugin.rb
|
18
18
|
test/config
|
19
|
+
sandbox/dumps/debug
|
19
20
|
test/plugins/my_mapper.rb
|
20
21
|
lib/nfagent.rb
|
21
22
|
lib/nfagent
|
@@ -31,6 +32,7 @@ lib/nfagent/event.rb
|
|
31
32
|
lib/nfagent/info.rb
|
32
33
|
lib/nfagent/log.rb
|
33
34
|
lib/nfagent/mapper_proxy.rb
|
35
|
+
lib/nfagent/object_extra.rb
|
34
36
|
lib/nfagent/payload.rb
|
35
37
|
lib/nfagent/plugin.rb
|
36
38
|
lib/nfagent/poller.rb
|
data/README.rdoc
CHANGED
@@ -4,7 +4,7 @@
|
|
4
4
|
|
5
5
|
== DESCRIPTION:
|
6
6
|
|
7
|
-
|
7
|
+
Logging Agent for NetFox Online
|
8
8
|
|
9
9
|
== FEATURES/PROBLEMS:
|
10
10
|
|
@@ -45,4 +45,4 @@ MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.
|
|
45
45
|
IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY
|
46
46
|
CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT,
|
47
47
|
TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE
|
48
|
-
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
48
|
+
SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
data/Rakefile
CHANGED
@@ -15,7 +15,7 @@ $hoe = Hoe.spec 'nfagent' do
|
|
15
15
|
self.post_install_message = 'PostInstall.txt' # TODO remove if post-install message not required
|
16
16
|
self.rubyforge_name = self.name # TODO this is default value
|
17
17
|
self.extra_deps = [
|
18
|
-
['svutil','>= 0.
|
18
|
+
['svutil','>= 0.1.2'], ['eventmachine', '>= 0.12.8'], ['squiggle', '>= 0.0.7']
|
19
19
|
]
|
20
20
|
|
21
21
|
end
|
data/lib/nfagent.rb
CHANGED
@@ -14,6 +14,7 @@ require 'eventmachine'
|
|
14
14
|
require 'em/timers'
|
15
15
|
require 'rbconfig'
|
16
16
|
|
17
|
+
require 'nfagent/object_extra'
|
17
18
|
require 'nfagent/chunk'
|
18
19
|
require 'nfagent/client'
|
19
20
|
require 'nfagent/client_response'
|
@@ -34,5 +35,5 @@ require 'nfagent/cli'
|
|
34
35
|
require 'nfagent/tests'
|
35
36
|
|
36
37
|
module NFAgent
|
37
|
-
VERSION = '0.9.
|
38
|
+
VERSION = '0.9.26'
|
38
39
|
end
|
data/lib/nfagent/chunk.rb
CHANGED
data/lib/nfagent/cli.rb
CHANGED
data/lib/nfagent/config.rb
CHANGED
@@ -16,15 +16,15 @@ module NFAgent
|
|
16
16
|
# mapping: Class, this is a plugin class which must be stored in a file in the directory /etc/nfagent/plugins/
|
17
17
|
# parse: (optional, default: 'remotely'): String, either 'remotely' or 'locally'
|
18
18
|
#
|
19
|
-
|
20
|
-
|
21
|
-
|
22
|
-
|
23
|
-
|
24
|
-
|
25
|
-
|
26
|
-
end
|
19
|
+
defaults do |c|
|
20
|
+
c.mode = 'normal'
|
21
|
+
c.parse = 'remotely'
|
22
|
+
c.chunk_timeout = 60
|
23
|
+
c.time_zone = 'UTC'
|
24
|
+
c.plugin_directory = '/etc/nfagent/plugins/'
|
25
|
+
end
|
27
26
|
|
27
|
+
class << self
|
28
28
|
def validate
|
29
29
|
unless dump_dir and File.exists?(dump_dir) and File.directory?(dump_dir)
|
30
30
|
raise "Dump dir (#{dump_dir}) must exist and be a directory"
|
data/lib/nfagent/plugin.rb
CHANGED
@@ -2,8 +2,9 @@ module NFAgent
|
|
2
2
|
class Plugin
|
3
3
|
class << self
|
4
4
|
def load_plugins
|
5
|
-
|
5
|
+
if Config.plugin_directory && !Config.plugin_directory.empty? && File.exists?(Config.plugin_directory)
|
6
6
|
Dir.glob(File.join(Config.plugin_directory, "*.rb")).each do |file|
|
7
|
+
Log.info("Loading plugin: #{file}")
|
7
8
|
load(file)
|
8
9
|
end
|
9
10
|
end
|
data/lib/nfagent/server.rb
CHANGED
data/sandbox/dumps/debug
ADDED
File without changes
|
data/test/config
CHANGED
data/test/test_chunk.rb
CHANGED
@@ -4,7 +4,7 @@ require 'test/test_helper'
|
|
4
4
|
class TestChunk < ActiveSupport::TestCase
|
5
5
|
setup do
|
6
6
|
NFAgent::Config.config_file = "test/config"
|
7
|
-
NFAgent::Config.
|
7
|
+
NFAgent::Config.init
|
8
8
|
@logline = "1253604221 19 127.0.0.1 TCP_MISS/200 562 GET http://www.gravatar.com/blavatar/e81cfb9068d04d1cfd598533bb380e1f?s=16&d=http://s.wordpress.com/favicon.ico - NONE/- text/html"
|
9
9
|
end
|
10
10
|
|
@@ -28,7 +28,6 @@ class TestChunk < ActiveSupport::TestCase
|
|
28
28
|
|
29
29
|
test "won't expire if empty" do
|
30
30
|
NFAgent::Config.chunk_time_out = 1
|
31
|
-
NFAgent::Config.validate
|
32
31
|
chunk = NFAgent::Chunk.new
|
33
32
|
assert !chunk.expired?
|
34
33
|
Timecop.freeze(Time.now + 61) do
|
data/test/test_chunk_handler.rb
CHANGED
@@ -4,7 +4,7 @@ require 'test/test_helper'
|
|
4
4
|
class TestChunkHandler < ActiveSupport::TestCase
|
5
5
|
setup do
|
6
6
|
NFAgent::Config.config_file = "test/config"
|
7
|
-
NFAgent::Config.
|
7
|
+
NFAgent::Config.init
|
8
8
|
NFAgent::Config.plugin_directory = File.dirname(__FILE__) + '/../test/plugins/'
|
9
9
|
NFAgent::Plugin.load_plugins
|
10
10
|
@logline = "1253604221 19 127.0.0.1 TCP_MISS/200 562 GET http://www.gravatar.com/blavatar/e81cfb9068d04d1cfd598533bb380e1f?s=16&d=http://s.wordpress.com/favicon.ico dan NONE/- text/html"
|
@@ -30,7 +30,6 @@ class TestChunkHandler < ActiveSupport::TestCase
|
|
30
30
|
NFAgent::Config.parse = 'locally'
|
31
31
|
NFAgent::Config.mode = 'multi'
|
32
32
|
NFAgent::Config.mapper = 'MyMapper'
|
33
|
-
NFAgent::Config.validate
|
34
33
|
chunk_handler = NFAgent::ChunkHandler.new
|
35
34
|
chunk_handler.append(@logline)
|
36
35
|
assert chunk_handler.chunk_group.has_key?('acme')
|
@@ -46,7 +45,6 @@ class TestChunkHandler < ActiveSupport::TestCase
|
|
46
45
|
NFAgent::Config.parse = 'locally'
|
47
46
|
NFAgent::Config.mode = 'multi'
|
48
47
|
NFAgent::Config.mapper = 'MyMapper'
|
49
|
-
NFAgent::Config.validate
|
50
48
|
NFAgent::Submitter.any_instance.expects(:perform).times(2)
|
51
49
|
chunk_handler = NFAgent::ChunkHandler.new
|
52
50
|
chunk_handler.append(@logline)
|
@@ -73,7 +71,6 @@ class TestChunkHandler < ActiveSupport::TestCase
|
|
73
71
|
NFAgent::Config.parse = 'locally'
|
74
72
|
NFAgent::Config.mode = 'multi'
|
75
73
|
NFAgent::Config.mapper = 'MyMapper'
|
76
|
-
NFAgent::Config.validate
|
77
74
|
NFAgent::Submitter.any_instance.expects(:perform).times(2)
|
78
75
|
chunk_handler = NFAgent::ChunkHandler.new(:chunk_size => 10)
|
79
76
|
9.times { chunk_handler.append(@logline) }
|
data/test/test_config.rb
CHANGED
@@ -3,14 +3,15 @@ require 'test/test_helper'
|
|
3
3
|
|
4
4
|
class TestConfig < ActiveSupport::TestCase
|
5
5
|
setup do
|
6
|
-
NFAgent::Config.
|
7
|
-
NFAgent::Config.load_and_parse
|
6
|
+
NFAgent::Config.attrs.clear
|
8
7
|
end
|
9
8
|
|
10
9
|
test "defaults" do
|
10
|
+
puts "HHHHHH"
|
11
|
+
p NFAgent::Config.attrs
|
11
12
|
assert_equal "normal", NFAgent::Config.mode
|
12
13
|
assert_equal "remotely", NFAgent::Config.parse
|
13
|
-
assert_equal 60, NFAgent::Config.
|
14
|
+
assert_equal 60, NFAgent::Config.chunk_timeout
|
14
15
|
assert_equal 'UTC', NFAgent::Config.time_zone
|
15
16
|
assert_equal '/etc/nfagent/plugins/', NFAgent::Config.plugin_directory
|
16
17
|
end
|
@@ -21,6 +22,10 @@ class TestConfig < ActiveSupport::TestCase
|
|
21
22
|
end
|
22
23
|
|
23
24
|
test "validates mapping with multi" do
|
25
|
+
NFAgent::Config.attrs.clear
|
26
|
+
NFAgent::Config.config_file = "test/config"
|
27
|
+
NFAgent::Config.init
|
28
|
+
|
24
29
|
NFAgent::Config.mode = 'multi'
|
25
30
|
assert_raises(RuntimeError) { NFAgent::Config.validate }
|
26
31
|
NFAgent::Config.mapper = 'AccountMapper'
|
@@ -30,6 +35,10 @@ class TestConfig < ActiveSupport::TestCase
|
|
30
35
|
end
|
31
36
|
|
32
37
|
test "validates valid parse option" do
|
38
|
+
NFAgent::Config.attrs.clear
|
39
|
+
NFAgent::Config.config_file = "test/config"
|
40
|
+
NFAgent::Config.init
|
41
|
+
|
33
42
|
NFAgent::Config.parse = 'some stupid thing'
|
34
43
|
assert_raises(RuntimeError) { NFAgent::Config.validate }
|
35
44
|
NFAgent::Config.parse = 'locally'
|
metadata
CHANGED
@@ -5,8 +5,8 @@ version: !ruby/object:Gem::Version
|
|
5
5
|
segments:
|
6
6
|
- 0
|
7
7
|
- 9
|
8
|
-
-
|
9
|
-
version: 0.9.
|
8
|
+
- 26
|
9
|
+
version: 0.9.26
|
10
10
|
platform: ruby
|
11
11
|
authors:
|
12
12
|
- Daniel Draper
|
@@ -14,7 +14,7 @@ autorequire:
|
|
14
14
|
bindir: bin
|
15
15
|
cert_chain: []
|
16
16
|
|
17
|
-
date: 2011-02-
|
17
|
+
date: 2011-02-08 00:00:00 +10:30
|
18
18
|
default_executable:
|
19
19
|
dependencies:
|
20
20
|
- !ruby/object:Gem::Dependency
|
@@ -26,9 +26,9 @@ dependencies:
|
|
26
26
|
- !ruby/object:Gem::Version
|
27
27
|
segments:
|
28
28
|
- 0
|
29
|
-
-
|
30
|
-
-
|
31
|
-
version: 0.
|
29
|
+
- 1
|
30
|
+
- 2
|
31
|
+
version: 0.1.2
|
32
32
|
type: :runtime
|
33
33
|
version_requirements: *id001
|
34
34
|
- !ruby/object:Gem::Dependency
|
@@ -54,11 +54,13 @@ dependencies:
|
|
54
54
|
- !ruby/object:Gem::Version
|
55
55
|
segments:
|
56
56
|
- 0
|
57
|
-
|
57
|
+
- 0
|
58
|
+
- 7
|
59
|
+
version: 0.0.7
|
58
60
|
type: :runtime
|
59
61
|
version_requirements: *id003
|
60
62
|
- !ruby/object:Gem::Dependency
|
61
|
-
name:
|
63
|
+
name: hoe
|
62
64
|
prerelease: false
|
63
65
|
requirement: &id004 !ruby/object:Gem::Requirement
|
64
66
|
requirements:
|
@@ -66,26 +68,12 @@ dependencies:
|
|
66
68
|
- !ruby/object:Gem::Version
|
67
69
|
segments:
|
68
70
|
- 2
|
69
|
-
- 0
|
70
71
|
- 4
|
71
|
-
version: 2.0.4
|
72
|
-
type: :development
|
73
|
-
version_requirements: *id004
|
74
|
-
- !ruby/object:Gem::Dependency
|
75
|
-
name: hoe
|
76
|
-
prerelease: false
|
77
|
-
requirement: &id005 !ruby/object:Gem::Requirement
|
78
|
-
requirements:
|
79
|
-
- - ">="
|
80
|
-
- !ruby/object:Gem::Version
|
81
|
-
segments:
|
82
|
-
- 2
|
83
|
-
- 6
|
84
72
|
- 0
|
85
|
-
version: 2.
|
73
|
+
version: 2.4.0
|
86
74
|
type: :development
|
87
|
-
version_requirements: *
|
88
|
-
description:
|
75
|
+
version_requirements: *id004
|
76
|
+
description: Logging Agent for NetFox Online
|
89
77
|
email:
|
90
78
|
- daniel@netfox.com
|
91
79
|
executables:
|
@@ -118,6 +106,7 @@ files:
|
|
118
106
|
- test/test_payload.rb
|
119
107
|
- test/test_plugin.rb
|
120
108
|
- test/config
|
109
|
+
- sandbox/dumps/debug
|
121
110
|
- test/plugins/my_mapper.rb
|
122
111
|
- lib/nfagent.rb
|
123
112
|
- lib/nfagent/base64.rb
|
@@ -132,6 +121,7 @@ files:
|
|
132
121
|
- lib/nfagent/info.rb
|
133
122
|
- lib/nfagent/log.rb
|
134
123
|
- lib/nfagent/mapper_proxy.rb
|
124
|
+
- lib/nfagent/object_extra.rb
|
135
125
|
- lib/nfagent/payload.rb
|
136
126
|
- lib/nfagent/plugin.rb
|
137
127
|
- lib/nfagent/poller.rb
|
@@ -174,7 +164,7 @@ rubyforge_project: nfagent
|
|
174
164
|
rubygems_version: 1.3.6
|
175
165
|
signing_key:
|
176
166
|
specification_version: 3
|
177
|
-
summary:
|
167
|
+
summary: Logging Agent for NetFox Online
|
178
168
|
test_files:
|
179
169
|
- test/test_chunk.rb
|
180
170
|
- test/test_chunk_handler.rb
|