nfagent 0.9.30 → 0.9.31
Sign up to get free protection for your applications and to get access to all the features.
- data/{sandbox/dumps/debug → .gemtest} +0 -0
- data/History.txt +1 -1
- data/Manifest.txt +14 -32
- data/PostInstall.txt +0 -6
- data/{README.rdoc → README.txt} +15 -7
- data/Rakefile +21 -18
- data/bin/squid_log_writer +0 -2
- data/lib/nfagent.rb +1 -6
- data/lib/nfagent/chunk.rb +16 -30
- data/lib/nfagent/chunk_handler.rb +23 -55
- data/lib/nfagent/cli.rb +2 -2
- data/lib/nfagent/client.rb +2 -5
- data/lib/nfagent/config.rb +0 -33
- data/lib/nfagent/event.rb +1 -1
- data/lib/nfagent/payload.rb +7 -11
- data/lib/nfagent/server.rb +0 -5
- data/lib/nfagent/submitter.rb +0 -1
- data/nfagent.conf +4 -4
- metadata +102 -131
- data/lib/nfagent/mapper_proxy.rb +0 -18
- data/lib/nfagent/object_extra.rb +0 -5
- data/lib/nfagent/plugin.rb +0 -14
- data/script/console +0 -10
- data/script/destroy +0 -14
- data/script/generate +0 -14
- data/test/config +0 -5
- data/test/plugins/my_mapper.rb +0 -18
- data/test/test_chunk.rb +0 -79
- data/test/test_chunk_handler.rb +0 -131
- data/test/test_client.rb +0 -20
- data/test/test_config.rb +0 -49
- data/test/test_helper.rb +0 -6
- data/test/test_mapper_proxy.rb +0 -20
- data/test/test_nfagent.rb +0 -8
- data/test/test_payload.rb +0 -77
- data/test/test_plugin.rb +0 -13
data/lib/nfagent/event.rb
CHANGED
data/lib/nfagent/payload.rb
CHANGED
@@ -1,6 +1,6 @@
|
|
1
1
|
|
2
2
|
module NFAgent
|
3
|
-
class Payload < Struct.new(:data, :checksum, :filename, :line_count, :chunk_expired
|
3
|
+
class Payload < Struct.new(:data, :checksum, :filename, :line_count, :chunk_expired)
|
4
4
|
def initialize
|
5
5
|
yield self
|
6
6
|
end
|
@@ -23,19 +23,16 @@ module NFAgent
|
|
23
23
|
end
|
24
24
|
|
25
25
|
def to_hash
|
26
|
-
|
26
|
+
{
|
27
27
|
"payload" => self.data,
|
28
28
|
"checksum" => self.checksum,
|
29
29
|
"line_count" => self.line_count,
|
30
30
|
"chunk_expired" => self.chunk_expired
|
31
31
|
}
|
32
|
-
ret["key"] = self.key unless self.key.blank?
|
33
|
-
ret
|
34
32
|
end
|
35
33
|
|
36
34
|
def write_to_disk(directory)
|
37
|
-
|
38
|
-
File.open(File.join(directory, filename), "w") do |file|
|
35
|
+
File.open(File.join(directory, "#{self.checksum}-#{self.attempt}"), "w") do |file|
|
39
36
|
file << self.data
|
40
37
|
end
|
41
38
|
end
|
@@ -51,14 +48,14 @@ module NFAgent
|
|
51
48
|
filename && File.exists?(lockfile)
|
52
49
|
end
|
53
50
|
|
54
|
-
def self.read_from_file(filename
|
51
|
+
def self.read_from_file(filename)
|
55
52
|
# Ensure the file is only relative
|
56
53
|
filename = File.basename(filename)
|
57
54
|
self.new do |payload|
|
58
55
|
payload.filename = filename
|
59
|
-
payload.checksum, payload.attempt
|
56
|
+
payload.checksum, payload.attempt = filename.split("-")
|
60
57
|
payload.data = ""
|
61
|
-
ref = File.join(
|
58
|
+
ref = File.join(Config.dump_dir, filename)
|
62
59
|
File.open(ref, "r") do |file|
|
63
60
|
payload.data << file.read
|
64
61
|
end
|
@@ -71,8 +68,7 @@ module NFAgent
|
|
71
68
|
|
72
69
|
def try_again_later
|
73
70
|
# TODO: Move the file to a new name with a later timetamp
|
74
|
-
|
75
|
-
FileUtils.mv(File.join(Config.dump_dir, self.filename), File.join(Config.dump_dir, new_filename))
|
71
|
+
FileUtils.mv(File.join(Config.dump_dir, self.filename), File.join(Config.dump_dir, "#{self.checksum}-#{self.attempt}"))
|
76
72
|
end
|
77
73
|
|
78
74
|
private
|
data/lib/nfagent/server.rb
CHANGED
data/lib/nfagent/submitter.rb
CHANGED
data/nfagent.conf
CHANGED
@@ -1,4 +1,4 @@
|
|
1
|
-
client_key =
|
2
|
-
dump_dir =
|
3
|
-
log_file =
|
4
|
-
pid_file =
|
1
|
+
client_key = 1234
|
2
|
+
dump_dir = /tmp/dumps
|
3
|
+
log_file = /tmp/debug
|
4
|
+
pid_file = /tmp/nfagent.pid
|
metadata
CHANGED
@@ -1,177 +1,148 @@
|
|
1
|
-
--- !ruby/object:Gem::Specification
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
2
|
name: nfagent
|
3
|
-
version: !ruby/object:Gem::Version
|
4
|
-
|
5
|
-
|
6
|
-
- 0
|
7
|
-
- 9
|
8
|
-
- 30
|
9
|
-
version: 0.9.30
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.9.31
|
5
|
+
prerelease:
|
10
6
|
platform: ruby
|
11
|
-
authors:
|
7
|
+
authors:
|
12
8
|
- Daniel Draper
|
13
9
|
autorequire:
|
14
10
|
bindir: bin
|
15
11
|
cert_chain: []
|
16
|
-
|
17
|
-
|
18
|
-
|
19
|
-
dependencies:
|
20
|
-
- !ruby/object:Gem::Dependency
|
12
|
+
date: 2013-03-17 00:00:00.000000000 Z
|
13
|
+
dependencies:
|
14
|
+
- !ruby/object:Gem::Dependency
|
21
15
|
name: svutil
|
22
|
-
|
23
|
-
|
24
|
-
requirements:
|
25
|
-
- -
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
|
28
|
-
- 0
|
29
|
-
- 1
|
30
|
-
- 3
|
31
|
-
version: 0.1.3
|
16
|
+
requirement: !ruby/object:Gem::Requirement
|
17
|
+
none: false
|
18
|
+
requirements:
|
19
|
+
- - ! '>='
|
20
|
+
- !ruby/object:Gem::Version
|
21
|
+
version: 0.0.12
|
32
22
|
type: :runtime
|
33
|
-
version_requirements: *id001
|
34
|
-
- !ruby/object:Gem::Dependency
|
35
|
-
name: eventmachine
|
36
23
|
prerelease: false
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
|
43
|
-
|
44
|
-
|
24
|
+
version_requirements: !ruby/object:Gem::Requirement
|
25
|
+
none: false
|
26
|
+
requirements:
|
27
|
+
- - ! '>='
|
28
|
+
- !ruby/object:Gem::Version
|
29
|
+
version: 0.0.12
|
30
|
+
- !ruby/object:Gem::Dependency
|
31
|
+
name: eventmachine
|
32
|
+
requirement: !ruby/object:Gem::Requirement
|
33
|
+
none: false
|
34
|
+
requirements:
|
35
|
+
- - ! '>='
|
36
|
+
- !ruby/object:Gem::Version
|
45
37
|
version: 0.12.8
|
46
38
|
type: :runtime
|
47
|
-
version_requirements: *id002
|
48
|
-
- !ruby/object:Gem::Dependency
|
49
|
-
name: squiggle
|
50
39
|
prerelease: false
|
51
|
-
|
52
|
-
|
53
|
-
|
54
|
-
|
55
|
-
|
56
|
-
|
57
|
-
|
58
|
-
|
59
|
-
|
60
|
-
|
61
|
-
|
62
|
-
- !
|
63
|
-
|
40
|
+
version_requirements: !ruby/object:Gem::Requirement
|
41
|
+
none: false
|
42
|
+
requirements:
|
43
|
+
- - ! '>='
|
44
|
+
- !ruby/object:Gem::Version
|
45
|
+
version: 0.12.8
|
46
|
+
- !ruby/object:Gem::Dependency
|
47
|
+
name: newgem
|
48
|
+
requirement: !ruby/object:Gem::Requirement
|
49
|
+
none: false
|
50
|
+
requirements:
|
51
|
+
- - ! '>='
|
52
|
+
- !ruby/object:Gem::Version
|
53
|
+
version: 1.5.3
|
54
|
+
type: :development
|
64
55
|
prerelease: false
|
65
|
-
|
66
|
-
|
67
|
-
|
68
|
-
|
69
|
-
|
70
|
-
|
71
|
-
|
72
|
-
|
73
|
-
|
56
|
+
version_requirements: !ruby/object:Gem::Requirement
|
57
|
+
none: false
|
58
|
+
requirements:
|
59
|
+
- - ! '>='
|
60
|
+
- !ruby/object:Gem::Version
|
61
|
+
version: 1.5.3
|
62
|
+
- !ruby/object:Gem::Dependency
|
63
|
+
name: hoe
|
64
|
+
requirement: !ruby/object:Gem::Requirement
|
65
|
+
none: false
|
66
|
+
requirements:
|
67
|
+
- - ~>
|
68
|
+
- !ruby/object:Gem::Version
|
69
|
+
version: '3.5'
|
74
70
|
type: :development
|
75
|
-
|
71
|
+
prerelease: false
|
72
|
+
version_requirements: !ruby/object:Gem::Requirement
|
73
|
+
none: false
|
74
|
+
requirements:
|
75
|
+
- - ~>
|
76
|
+
- !ruby/object:Gem::Version
|
77
|
+
version: '3.5'
|
76
78
|
description: Logging Agent for NetFox Online
|
77
|
-
email:
|
79
|
+
email:
|
78
80
|
- daniel@netfox.com
|
79
|
-
executables:
|
81
|
+
executables:
|
80
82
|
- nfagent
|
81
83
|
- squid_log_writer
|
82
84
|
extensions: []
|
83
|
-
|
84
|
-
|
85
|
+
extra_rdoc_files:
|
86
|
+
- PostInstall.txt
|
85
87
|
- History.txt
|
86
88
|
- Manifest.txt
|
87
|
-
-
|
89
|
+
- README.txt
|
88
90
|
- nfagent.init.ubuntu.txt
|
89
91
|
- nfagent.init.redhat.txt
|
90
|
-
files:
|
91
|
-
- History.txt
|
92
|
-
- Manifest.txt
|
93
|
-
- PostInstall.txt
|
94
|
-
- README.rdoc
|
92
|
+
files:
|
95
93
|
- Rakefile
|
96
|
-
- script/console
|
97
|
-
- script/destroy
|
98
|
-
- script/generate
|
99
|
-
- test/test_chunk.rb
|
100
|
-
- test/test_chunk_handler.rb
|
101
|
-
- test/test_client.rb
|
102
|
-
- test/test_config.rb
|
103
|
-
- test/test_helper.rb
|
104
|
-
- test/test_mapper_proxy.rb
|
105
|
-
- test/test_nfagent.rb
|
106
|
-
- test/test_payload.rb
|
107
|
-
- test/test_plugin.rb
|
108
|
-
- test/config
|
109
|
-
- sandbox/dumps/debug
|
110
|
-
- test/plugins/my_mapper.rb
|
111
94
|
- lib/nfagent.rb
|
112
|
-
- lib/nfagent/base64.rb
|
113
|
-
- lib/nfagent/chunk.rb
|
114
|
-
- lib/nfagent/chunk_handler.rb
|
115
95
|
- lib/nfagent/cli.rb
|
116
|
-
- lib/nfagent/
|
117
|
-
- lib/nfagent/client_response.rb
|
118
|
-
- lib/nfagent/config.rb
|
96
|
+
- lib/nfagent/base64.rb
|
119
97
|
- lib/nfagent/encoder.rb
|
120
|
-
- lib/nfagent/
|
121
|
-
- lib/nfagent/
|
98
|
+
- lib/nfagent/server.rb
|
99
|
+
- lib/nfagent/chunk_handler.rb
|
122
100
|
- lib/nfagent/log.rb
|
123
|
-
- lib/nfagent/
|
124
|
-
- lib/nfagent/
|
101
|
+
- lib/nfagent/info.rb
|
102
|
+
- lib/nfagent/event.rb
|
125
103
|
- lib/nfagent/payload.rb
|
126
|
-
- lib/nfagent/plugin.rb
|
127
104
|
- lib/nfagent/poller.rb
|
128
|
-
- lib/nfagent/
|
129
|
-
- lib/nfagent/
|
105
|
+
- lib/nfagent/chunk.rb
|
106
|
+
- lib/nfagent/client.rb
|
107
|
+
- lib/nfagent/client_response.rb
|
108
|
+
- lib/nfagent/config.rb
|
130
109
|
- lib/nfagent/tail.rb
|
131
110
|
- lib/nfagent/tests.rb
|
111
|
+
- lib/nfagent/submitter.rb
|
132
112
|
- bin/nfagent
|
133
113
|
- bin/squid_log_writer
|
114
|
+
- PostInstall.txt
|
115
|
+
- History.txt
|
116
|
+
- Manifest.txt
|
117
|
+
- README.txt
|
134
118
|
- nfagent.conf
|
135
119
|
- nfagent.init.ubuntu.txt
|
136
120
|
- nfagent.init.redhat.txt
|
137
|
-
|
138
|
-
homepage: http://
|
121
|
+
- .gemtest
|
122
|
+
homepage: http://netfox.com
|
139
123
|
licenses: []
|
140
|
-
|
141
124
|
post_install_message: PostInstall.txt
|
142
|
-
rdoc_options:
|
125
|
+
rdoc_options:
|
143
126
|
- --main
|
144
|
-
- README.
|
145
|
-
require_paths:
|
127
|
+
- README.txt
|
128
|
+
require_paths:
|
146
129
|
- lib
|
147
|
-
required_ruby_version: !ruby/object:Gem::Requirement
|
148
|
-
|
149
|
-
|
150
|
-
|
151
|
-
|
152
|
-
|
153
|
-
|
154
|
-
|
155
|
-
requirements:
|
156
|
-
- -
|
157
|
-
- !ruby/object:Gem::Version
|
158
|
-
|
159
|
-
- 0
|
160
|
-
version: "0"
|
130
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
131
|
+
none: false
|
132
|
+
requirements:
|
133
|
+
- - ! '>='
|
134
|
+
- !ruby/object:Gem::Version
|
135
|
+
version: '0'
|
136
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
137
|
+
none: false
|
138
|
+
requirements:
|
139
|
+
- - ! '>='
|
140
|
+
- !ruby/object:Gem::Version
|
141
|
+
version: '0'
|
161
142
|
requirements: []
|
162
|
-
|
163
143
|
rubyforge_project: nfagent
|
164
|
-
rubygems_version: 1.
|
144
|
+
rubygems_version: 1.8.24
|
165
145
|
signing_key:
|
166
146
|
specification_version: 3
|
167
147
|
summary: Logging Agent for NetFox Online
|
168
|
-
test_files:
|
169
|
-
- test/test_chunk.rb
|
170
|
-
- test/test_chunk_handler.rb
|
171
|
-
- test/test_client.rb
|
172
|
-
- test/test_config.rb
|
173
|
-
- test/test_helper.rb
|
174
|
-
- test/test_mapper_proxy.rb
|
175
|
-
- test/test_nfagent.rb
|
176
|
-
- test/test_payload.rb
|
177
|
-
- test/test_plugin.rb
|
148
|
+
test_files: []
|
data/lib/nfagent/mapper_proxy.rb
DELETED
@@ -1,18 +0,0 @@
|
|
1
|
-
module NFAgent
|
2
|
-
class MapperProxy
|
3
|
-
class << self
|
4
|
-
def instance
|
5
|
-
return @instance if @instance
|
6
|
-
raise "No Mapper Set" if Config.mapper.blank?
|
7
|
-
@instance = Object.const_get(Config.mapper).new
|
8
|
-
end
|
9
|
-
|
10
|
-
# TODO: Can we delegate?
|
11
|
-
def find_account_id(username, client_ip)
|
12
|
-
instance.find_account_id(username, client_ip)
|
13
|
-
end
|
14
|
-
|
15
|
-
# TODO: before shutdown
|
16
|
-
end
|
17
|
-
end
|
18
|
-
end
|
data/lib/nfagent/object_extra.rb
DELETED
data/lib/nfagent/plugin.rb
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
module NFAgent
|
2
|
-
class Plugin
|
3
|
-
class << self
|
4
|
-
def load_plugins
|
5
|
-
if Config.plugin_directory && !Config.plugin_directory.empty? && File.exists?(Config.plugin_directory)
|
6
|
-
Dir.glob(File.join(Config.plugin_directory, "*.rb")).each do |file|
|
7
|
-
Log.info("Loading plugin: #{file}")
|
8
|
-
load(file)
|
9
|
-
end
|
10
|
-
end
|
11
|
-
end
|
12
|
-
end
|
13
|
-
end
|
14
|
-
end
|
data/script/console
DELETED
@@ -1,10 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
# File: script/console
|
3
|
-
irb = RUBY_PLATFORM =~ /(:?mswin|mingw)/ ? 'irb.bat' : 'irb'
|
4
|
-
|
5
|
-
libs = " -r irb/completion"
|
6
|
-
# Perhaps use a console_lib to store any extra methods I may want available in the cosole
|
7
|
-
# libs << " -r #{File.dirname(__FILE__) + '/../lib/console_lib/console_logger.rb'}"
|
8
|
-
libs << " -r #{File.dirname(__FILE__) + '/../lib/nfagent.rb'}"
|
9
|
-
puts "Loading nfagent gem"
|
10
|
-
exec "#{irb} #{libs} --simple-prompt"
|
data/script/destroy
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/destroy'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Destroy.new.run(ARGV)
|
data/script/generate
DELETED
@@ -1,14 +0,0 @@
|
|
1
|
-
#!/usr/bin/env ruby
|
2
|
-
APP_ROOT = File.expand_path(File.join(File.dirname(__FILE__), '..'))
|
3
|
-
|
4
|
-
begin
|
5
|
-
require 'rubigen'
|
6
|
-
rescue LoadError
|
7
|
-
require 'rubygems'
|
8
|
-
require 'rubigen'
|
9
|
-
end
|
10
|
-
require 'rubigen/scripts/generate'
|
11
|
-
|
12
|
-
ARGV.shift if ['--help', '-h'].include?(ARGV[0])
|
13
|
-
RubiGen::Base.use_component_sources! [:rubygems, :newgem, :newgem_theme, :test_unit]
|
14
|
-
RubiGen::Scripts::Generate.new.run(ARGV)
|