smi-ffi 0.0.1 → 0.1.0

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.
Files changed (3) hide show
  1. data/README.rdoc +19 -1
  2. data/lib/smi/version.rb +1 -1
  3. metadata +3 -3
data/README.rdoc CHANGED
@@ -1,8 +1,10 @@
1
1
  = smi-ffi
2
2
 
3
- FFI wrapper around libsmi. Useful for translating SNMP oids.
3
+ FFI wrapper around libsmi. Useful for translating SNMP oids and retreiving other MIB information.
4
4
  You should have libsmi installed, and a directory with any MIB files you want to use.
5
5
 
6
+ == USAGE
7
+
6
8
  # Set path to MIBs, initialize libsmi, and load the standard RFC1213 MIB
7
9
  Smi::Config.set_path('/usr/local/share/mibs')
8
10
  Smi::Config.init(nil) # You MUST call this
@@ -11,6 +13,22 @@ Smi::Config.load_module("RFC1213-MIB")
11
13
  # get the oid for sysDescr
12
14
  Smi.translate("sysDescr") => ".1.3.6.1.2.1.2.1.1"
13
15
 
16
+ # get a MIB node
17
+ node = Smi::Node.get_node("ifIndex")
18
+ puts node.name # "ifIndex"
19
+ puts node.oid # "1.3.6.1.2.1.2.2.1.1"
20
+ puts node.description # "Some verbose description"
21
+
22
+ # get children of node
23
+ node.children.each |child|
24
+ puts "#{child.name} - #{child.oid}"
25
+ end
26
+
27
+ # get a MIB module
28
+ m = Smi::Module.get_module("RFC1213-MIB")
29
+ node = m.get_nodes
30
+
31
+
14
32
  You may have to add smilib to LD_LIBRARY_PATH. For example
15
33
  export LD_LIBRARY_PATH=/opt/local/lib
16
34
 
data/lib/smi/version.rb CHANGED
@@ -1,5 +1,5 @@
1
1
  module Smi
2
2
  module Ffi
3
- VERSION = "0.0.1"
3
+ VERSION = "0.1.0"
4
4
  end
5
5
  end
metadata CHANGED
@@ -4,9 +4,9 @@ version: !ruby/object:Gem::Version
4
4
  prerelease: false
5
5
  segments:
6
6
  - 0
7
- - 0
8
7
  - 1
9
- version: 0.0.1
8
+ - 0
9
+ version: 0.1.0
10
10
  platform: ruby
11
11
  authors:
12
12
  - Ron McClain
@@ -14,7 +14,7 @@ autorequire:
14
14
  bindir: bin
15
15
  cert_chain: []
16
16
 
17
- date: 2011-03-19 00:00:00 -05:00
17
+ date: 2011-03-24 00:00:00 -05:00
18
18
  default_executable:
19
19
  dependencies:
20
20
  - !ruby/object:Gem::Dependency