Skip to content

Commit

Permalink
Cleaned up documentation and Rakefile
Browse files Browse the repository at this point in the history
  • Loading branch information
hallidave committed Oct 21, 2011
1 parent 9401f10 commit 22c54c6
Show file tree
Hide file tree
Showing 9 changed files with 149 additions and 145 deletions.
5 changes: 4 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
doc
web/web
web/site
pkg
*.ipr
*.iml
*.iws
94 changes: 7 additions & 87 deletions README.rdoc
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ that Ruby can run.

See snmplib.rubyforge.org[http://snmplib.rubyforge.org/] for more info.

Version 1.0.3 of this software supports the following:
This release supports the following:

* The GetRequest, GetNextRequest, GetBulkRequest, SetRequest, Response
SNMPv1_Trap, SNMPv2_Trap, and Inform PDUs
Expand Down Expand Up @@ -49,98 +49,18 @@ Changes for version 1.0.0:
instead of just a number. The to_i method can still be used to get the
number of ticks.

Changes for version 0.6.1:

* Made decoding of unsigned integers more liberal, so that they are
interpreted as positive integers even if the high bit is set.
* Added support for receiving InformRequest PDUs from the TrapListener class.

Changes for version 0.6.0:

* Added support for sending informs and traps for SNMPv2c and traps for
SNMPv1
* Improved SNMP::Manager#walk so that it can handle missing varbinds
when reading tables. The indexes for a table row read by #walk are now
guaranteed to match.
* Added to_oid methods to SNMP::OctetString, SNMP::Integer, and
SNMP::IpAddress (feature request #2486)
* Fixed some problems with retrying requests that caused annoying "Request ID
mismatch" warnings and caused too few retries to be attempted
* Thanks to Mark Cotner, Dan Hamlin, Tim Howe, Diana Eichert, Ery Lee,
Jan Åge Johnsen, and Jeff Foster for their help and suggestions (and
apologies in advance if I have forgotten someone).

Changes for version 0.5.1:

* Fixed bugs #2054 and #2164. Responses were ignored if they did
not come back from the same host that the request was sent to. This
behavior causes problems for some multi-homed hosts.
* Fixed bugs #1679 (NameError in Manager.get_response()) and #1736
(Notifications not included in YAML output).
* Added Manager.get_value convenience method to get a list of values for a
list of OIDs instead of the full VarBindList list like Manager.get.
* Added vb_list alias for PDU.varbind_list.
* Changed how Manager.walk yields to it's block. It is now more consistent
about yielding a list if a list is provided as an argument.
* Break out of Manager.walk instead of looping forever if OIDs returned by the
remote host are not in ascending order.

Changes for version 0.4.0:

* Added support for loading MIBs and using symbolic OID values.
* Enhanced Manager.walk
* It can now take an OID list as a parameter. (Thanks to Simon
Barnes for the suggestion.)
* Takes a block instead of returning a list to allow incremental
processing of results.
* Some minor improvements to code structure and error messages.

Changes for version 0.3.0:

* Added SNMPv1_Trap and SNMPv2_Trap classes
* Added TrapListener class for receiving v1 and v2 traps
* Added Manager.walk
* Fixed a problem with IpAddress encoding
* Defined IpAddress.== and IpAddress.eql? so that IpAddress objects can be
compared by value

Changes for version 0.2.0:

* Added GetBulkRequest
* Added open and close methods to the Manager class to ensure that
sockets can be properly released.
* Made SNMP::OctetString and SNMP::Integer behave more like Ruby's String and
Fixnum
* Fixed a problem with encoding/decoding the object id "0.0"

== Installation

You can use RubyGems [http://rubyforge.org/projects/rubygems] to
install the latest version of the SNMP library remotely.

gem install --remote snmp

The SNMP Library can be downloaded from
RubyForge[http://rubyforge.org/projects/snmplib/] in several different
formats.

From the .gem file you can install using
RubyGems[http://rubyforge.org/projects/rubygems].

gem install snmp-1.0.3.gem

From the .tgz or .zip file you can install using
setup.rb[http://i.loveruby.net/en/prog/setup.html]. Uncompress the archive
and then run setup.
You can use RubyGems [http://rubygems.org/] to
install the latest version of the SNMP library.

cd snmp-1.0.3
ruby setup.rb (may require root privilege)
gem install snmp

== Testing

This library has received limited testing:
* The unit tests have been executed with both Ruby 1.8.6 and Ruby 1.9.0 on
Mac OS X 10.5.
* The unit tests have been executed with both Ruby 1.8.7 and Ruby 1.9.2 on
Mac OS X 10.7.
* Basic interoperability testing has been done with the
net-snmp[http://www.net-snmp.org/] tools.

Expand Down Expand Up @@ -244,7 +164,7 @@ Log traps to STDOUT.

== License

This SNMP Library is Copyright (c) 2004-2010 by David R. Halliday. It is free
This SNMP Library is Copyright (c) 2004-2011 by David R. Halliday. It is free
software. Redistribution is permitted under the same terms and conditions as
the standard Ruby distribution. See the COPYING file in the Ruby distribution
for details.
Expand Down
57 changes: 22 additions & 35 deletions Rakefile
Original file line number Diff line number Diff line change
@@ -1,50 +1,25 @@
require 'rake'
require 'rake/testtask'
require 'rake/gempackagetask'
require 'rake/rdoctask'
require 'rake/clean'

require 'rubygems/package_task'

# test target
Rake::TestTask.new do |test|
test.libs << "lib"
end

# package target
PKG_VERSION = '1.0.3'
PKG_FILES = FileList[
'Rakefile',
'README.rdoc',
'setup.rb',
'lib/**/*.rb',
'test/**/test*.rb',
'test/**/*.yaml',
'examples/*.rb',
'data/**/*.yaml']

CLEAN.include 'pkg'
CLEAN.include 'doc'
CLEAN.include 'web/web'

spec = Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "A Ruby implementation of SNMP (the Simple Network Management Protocol)."
s.name = 'snmp'
s.version = PKG_VERSION
s.files = PKG_FILES.to_a
s.has_rdoc = true
s.extra_rdoc_files = ['README.rdoc']
s.rdoc_options << '--main' << 'README.rdoc' <<
'--title' << 'SNMP Library for Ruby'
s.description = "A Ruby implementation of SNMP (the Simple Network Management Protocol)."
s.author = 'Dave Halliday'
s.email = 'hallidave@gmail.com'
s.rubyforge_project = 'snmplib'
s.homepage = 'http://snmplib.rubyforge.org'
end
CLEAN.include 'web/site'

spec = Gem::Specification.load "snmp.gemspec"

Rake::GemPackageTask.new(spec) do |package|
package.need_zip = true
package.need_tar = true
Gem::PackageTask.new(spec) do |package|
package.need_zip = false
package.need_tar = false
end

# rdoc, clobber_rdoc, rerdoc targets
Expand All @@ -57,6 +32,18 @@ end

desc "Generate website content"
task :web => :rdoc do
require 'web/generate'
end
ROOT_PATH = File.dirname(File.expand_path(__FILE__))
SRC_DIR = ROOT_PATH + "/web/content"
DEST_DIR = ROOT_PATH + "/web/site"

rm_rf DEST_DIR
mkdir_p DEST_DIR

Dir.glob(SRC_DIR + "/*").each do |name|
puts "#{name}...copying"
FileUtils.cp(name, DEST_DIR + "/" + File.basename(name))
end

puts "Documentation...copying"
cp_r(ROOT_PATH + "/doc", DEST_DIR + "/doc")
end
79 changes: 79 additions & 0 deletions interop/snmpd.conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,79 @@
###########################################################################
#
# snmpd.conf
#
# - created by the snmpconf configuration program
#
###########################################################################
# SECTION: Access Control Setup
#
# This section defines who is allowed to talk to your running
# snmp agent.

# rocommunity: a SNMPv1/SNMPv2c read-only access community name
# arguments: community [default|hostname|network/bits] [oid]

rocommunity public localhost

# rwcommunity: a SNMPv1/SNMPv2c read-write access community name
# arguments: community [default|hostname|network/bits] [oid]

rwcommunity private localhost









###########################################################################
# SECTION: Agent Operating Mode
#
# This section defines how the agent will operate when it
# is running.

# agentaddress: The IP address and port number that the agent will listen on.
# By default the agent listens to any and all traffic from any
# interface on the default SNMP port (161). This allows you to
# specify which address, interface, transport type and port(s) that you
# want the agent to listen on. Multiple definitions of this token
# are concatenated together (using ':'s).
# arguments: [transport:]port[@interface/address],...

agentaddress localhost:1061



###########################################################################
# SECTION: System Information Setup
#
# This section defines some of the information reported in
# the "system" mib group in the mibII tree.

# syslocation: The [typically physical] location of the system.
# Note that setting this value here means that when trying to
# perform an snmp SET operation to the sysLocation.0 variable will make
# the agent return the "notWritable" error code. IE, including
# this token in the snmpd.conf file will disable write access to
# the variable.
# arguments: location_string

syslocation "Test Location"

# syscontact: The contact information for the administrator
# Note that setting this value here means that when trying to
# perform an snmp SET operation to the sysContact.0 variable will make
# the agent return the "notWritable" error code. IE, including
# this token in the snmpd.conf file will disable write access to
# the variable.
# arguments: contact_string

syscontact "Test Contact"






3 changes: 3 additions & 0 deletions lib/snmp/version.rb
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
module SNMP
VERSION = "1.0.4.dev"
end
29 changes: 29 additions & 0 deletions snmp.gemspec
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
$:.unshift File.expand_path("../lib", __FILE__)

require 'snmp/version'

PKG_FILES = FileList[
'Rakefile',
'README.rdoc',
'setup.rb',
'lib/**/*.rb',
'test/**/test*.rb',
'test/**/*.yaml',
'examples/*.rb',
'data/**/*.yaml']

Gem::Specification.new do |s|
s.platform = Gem::Platform::RUBY
s.summary = "A Ruby implementation of SNMP (the Simple Network Management Protocol)."
s.name = 'snmp'
s.version = SNMP::VERSION
s.files = PKG_FILES.to_a
s.extra_rdoc_files = ['README.rdoc']
s.rdoc_options << '--main' << 'README.rdoc' <<
'--title' << 'SNMP Library for Ruby'
s.description = "A Ruby implementation of SNMP (the Simple Network Management Protocol)."
s.author = 'Dave Halliday'
s.email = 'hallidave@gmail.com'
s.rubyforge_project = 'snmplib'
s.homepage = 'http://snmplib.rubyforge.org'
end
9 changes: 4 additions & 5 deletions web/content/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,9 @@ <h2>Network Management the Ruby Way</h2>
<h2>Getting Started</h2>

<h3>Install</h3>
<p>If you already have <a href="http://docs.rubygems.org/">RubyGems</a> all you need to do is:</p>
<p>Using <a href="http://rubygems.org/">RubyGems</a> all you need to do is:</p>
<p><code>gem install snmp</code></p>
<p>If you don't have RubyGems then <a href="http://rubyforge.org/frs/?group_id=126">go get it</a>. Otherwise, you will need to <a href="http://rubyforge.org/projects/snmplib/">download</a> the library from RubyForge, uncompress it, and run install.rb to install it.</p>


<h3>Import MIBs</h3>
<p>If you are using standard <a href="http://www.ietf.org/">IETF</a> MIBs then you're ready to go. Most of the IETF MIBs have been included for you with Ruby SNMP. Just list the MIBs that you need when you open your SNMP session and you will have full symbolic access to all of the OIDs.</p>

Expand Down Expand Up @@ -138,15 +137,15 @@ <h3>Net-SNMP</h3>
</div>
<div id="sidebar">
<h3><a href="doc/index.html">Documentation &raquo;</a></h3>
<h3><a href="http://rubyforge.org/projects/snmplib/">Download &raquo;</a></h3>
<h3><a href="http://rubygems.org/gems/snmp/">Download &raquo;</a></h3>
<h3>Happy Users</h3>
<div id="quotes">
<p>&ldquo;I'd like to thank you for such a fantastic library.&rdquo;</p>
<p>&ldquo;This is excellent - better functionality than Perl's Net::SNMP
module.&rdquo;</p>
<p>&ldquo;Your work alone heightens my interest in Ruby quite a bit.&rdquo;</p>
</div>
<p>Have feeback? Send it <a href="http://rubyforge.org/sendmessage.php?touser=842">via RubyForge</a>.</p>
<p>Have feeback? Send it <a href="https://github.com/hallidave/ruby-snmp/">via GitHub</a>.</p>
<h3>What is SNMP?</h3>
<p>SNMP is the Simple Network Management Protocol. This protocol provides the capability to monitor and manage switches, routers, printers, desktops, and other equipment in your network.</p>

Expand Down
16 changes: 0 additions & 16 deletions web/generate.rb

This file was deleted.

2 changes: 1 addition & 1 deletion web/upload.sh
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
#!/bin/sh
scp -r web/* davehal@rubyforge.org:/var/www/gforge-projects/snmplib
scp -r site/* davehal@rubyforge.org:/var/www/gforge-projects/snmplib

0 comments on commit 22c54c6

Please sign in to comment.