snmp 1.0.2 → 1.0.3
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.
- data/README +10 -4
- data/Rakefile +1 -1
- data/lib/snmp/manager.rb +3 -2
- data/test/test_manager.rb +7 -1
- data/test/test_retry.rb +3 -2
- metadata +20 -6
data/README
CHANGED
@@ -9,7 +9,7 @@ that Ruby can run.
|
|
9
9
|
|
10
10
|
See snmplib.rubyforge.org[http://snmplib.rubyforge.org/] for more info.
|
11
11
|
|
12
|
-
Version 1.0.
|
12
|
+
Version 1.0.3 of this software supports the following:
|
13
13
|
|
14
14
|
* The GetRequest, GetNextRequest, GetBulkRequest, SetRequest, Response
|
15
15
|
SNMPv1_Trap, SNMPv2_Trap, and Inform PDUs
|
@@ -26,6 +26,12 @@ examples below for more details.
|
|
26
26
|
|
27
27
|
== Changes
|
28
28
|
|
29
|
+
Changes for version 1.0.3:
|
30
|
+
|
31
|
+
* Minor changes to Manager class. The :Transport option may now be an
|
32
|
+
object or a class. Explicity call Timeout.timeout so that a timeout
|
33
|
+
method may be defined in subclasses. Thanks to Eric Monti.
|
34
|
+
|
29
35
|
Changes for version 1.0.2:
|
30
36
|
|
31
37
|
* Internal code changes to make this library compatible with both Ruby 1.8
|
@@ -121,13 +127,13 @@ formats.
|
|
121
127
|
From the .gem file you can install using
|
122
128
|
RubyGems[http://rubyforge.org/projects/rubygems].
|
123
129
|
|
124
|
-
gem install snmp-1.0.
|
130
|
+
gem install snmp-1.0.3.gem
|
125
131
|
|
126
132
|
From the .tgz or .zip file you can install using
|
127
133
|
setup.rb[http://i.loveruby.net/en/prog/setup.html]. Uncompress the archive
|
128
134
|
and then run setup.
|
129
135
|
|
130
|
-
cd snmp-1.0.
|
136
|
+
cd snmp-1.0.3
|
131
137
|
ruby setup.rb (may require root privilege)
|
132
138
|
|
133
139
|
== Testing
|
@@ -238,7 +244,7 @@ Log traps to STDOUT.
|
|
238
244
|
|
239
245
|
== License
|
240
246
|
|
241
|
-
This SNMP Library is Copyright (c) 2004-
|
247
|
+
This SNMP Library is Copyright (c) 2004-2010 by David R. Halliday. It is free
|
242
248
|
software. Redistribution is permitted under the same terms and conditions as
|
243
249
|
the standard Ruby distribution. See the COPYING file in the Ruby distribution
|
244
250
|
for details.
|
data/Rakefile
CHANGED
data/lib/snmp/manager.rb
CHANGED
@@ -160,7 +160,8 @@ class Manager
|
|
160
160
|
@snmp_version = @config[:Version]
|
161
161
|
@timeout = @config[:Timeout]
|
162
162
|
@retries = @config[:Retries]
|
163
|
-
|
163
|
+
transport = @config[:Transport]
|
164
|
+
@transport = transport.respond_to?(:new) ? transport.new : transport
|
164
165
|
@max_bytes = @config[:MaxReceiveBytes]
|
165
166
|
@mib = MIB.new
|
166
167
|
load_modules(@config[:MibModules], @config[:MibDir])
|
@@ -461,7 +462,7 @@ class Manager
|
|
461
462
|
(@retries + 1).times do |n|
|
462
463
|
send_request(request, community, host, port)
|
463
464
|
begin
|
464
|
-
timeout(@timeout) do
|
465
|
+
Timeout.timeout(@timeout) do
|
465
466
|
return get_response(request)
|
466
467
|
end
|
467
468
|
rescue Timeout::Error
|
data/test/test_manager.rb
CHANGED
@@ -49,7 +49,13 @@ class TestManager < Test::Unit::TestCase
|
|
49
49
|
assert_equal('test', @manager.config[:Community])
|
50
50
|
assert_equal('private', @manager.config[:WriteCommunity])
|
51
51
|
end
|
52
|
-
|
52
|
+
|
53
|
+
def test_transport_instance
|
54
|
+
@manager = Manager.new(:Transport => EchoTransport.new)
|
55
|
+
response = @manager.get("1.2.3.4")
|
56
|
+
assert_equal("1.2.3.4", response.varbind_list.first.name.to_s)
|
57
|
+
end
|
58
|
+
|
53
59
|
def test_get
|
54
60
|
response = @manager.get("1.2.3.4")
|
55
61
|
assert_equal("1.2.3.4", response.varbind_list.first.name.to_s)
|
data/test/test_retry.rb
CHANGED
@@ -1,4 +1,5 @@
|
|
1
|
-
require '
|
1
|
+
require 'test/unit'
|
2
|
+
require 'snmp'
|
2
3
|
|
3
4
|
class TimeoutManager < SNMP::Manager
|
4
5
|
attr_accessor :response_count
|
@@ -39,7 +40,7 @@ class MismatchIdTransport
|
|
39
40
|
|
40
41
|
def send(data, host, port)
|
41
42
|
bad_id_data = data.dup
|
42
|
-
bad_msg = Message.decode(data)
|
43
|
+
bad_msg = SNMP::Message.decode(data)
|
43
44
|
bad_msg.pdu.request_id -= 3 # corrupt request_id
|
44
45
|
@data << bad_msg.encode # insert corrupted PDU before real data
|
45
46
|
@data << data
|
metadata
CHANGED
@@ -1,7 +1,13 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: snmp
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
|
4
|
+
hash: 17
|
5
|
+
prerelease: false
|
6
|
+
segments:
|
7
|
+
- 1
|
8
|
+
- 0
|
9
|
+
- 3
|
10
|
+
version: 1.0.3
|
5
11
|
platform: ruby
|
6
12
|
authors:
|
7
13
|
- Dave Halliday
|
@@ -9,7 +15,7 @@ autorequire:
|
|
9
15
|
bindir: bin
|
10
16
|
cert_chain: []
|
11
17
|
|
12
|
-
date:
|
18
|
+
date: 2010-05-27 00:00:00 -04:00
|
13
19
|
default_executable:
|
14
20
|
dependencies: []
|
15
21
|
|
@@ -244,6 +250,8 @@ files:
|
|
244
250
|
- data/ruby/snmp/mibs/WWW-MIB.yaml
|
245
251
|
has_rdoc: true
|
246
252
|
homepage: http://snmplib.rubyforge.org
|
253
|
+
licenses: []
|
254
|
+
|
247
255
|
post_install_message:
|
248
256
|
rdoc_options:
|
249
257
|
- --main
|
@@ -253,23 +261,29 @@ rdoc_options:
|
|
253
261
|
require_paths:
|
254
262
|
- lib
|
255
263
|
required_ruby_version: !ruby/object:Gem::Requirement
|
264
|
+
none: false
|
256
265
|
requirements:
|
257
266
|
- - ">="
|
258
267
|
- !ruby/object:Gem::Version
|
268
|
+
hash: 3
|
269
|
+
segments:
|
270
|
+
- 0
|
259
271
|
version: "0"
|
260
|
-
version:
|
261
272
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
273
|
+
none: false
|
262
274
|
requirements:
|
263
275
|
- - ">="
|
264
276
|
- !ruby/object:Gem::Version
|
277
|
+
hash: 3
|
278
|
+
segments:
|
279
|
+
- 0
|
265
280
|
version: "0"
|
266
|
-
version:
|
267
281
|
requirements: []
|
268
282
|
|
269
283
|
rubyforge_project: snmplib
|
270
|
-
rubygems_version: 1.
|
284
|
+
rubygems_version: 1.3.7
|
271
285
|
signing_key:
|
272
|
-
specification_version:
|
286
|
+
specification_version: 3
|
273
287
|
summary: A Ruby implementation of SNMP (the Simple Network Management Protocol).
|
274
288
|
test_files: []
|
275
289
|
|