Class: GRI::AppWalker

Inherits:
Object show all
Defined in:
lib/gri/app_walker.rb

Instance Attribute Summary collapse

Instance Method Summary collapse

Constructor Details

#initialize(config) ⇒ AppWalker

Returns a new instance of AppWalker.



5
6
7
8
9
# File 'lib/gri/app_walker.rb', line 5

def initialize config
  @config = config
  @writers = []
  @metrics = Hash.new 0
end

Instance Attribute Details

#configObject (readonly)

Returns the value of attribute config.



3
4
5
# File 'lib/gri/app_walker.rb', line 3

def config
  @config
end

#metricsObject (readonly)

Returns the value of attribute metrics.



3
4
5
# File 'lib/gri/app_walker.rb', line 3

def metrics
  @metrics
end

#writersObject (readonly)

Returns the value of attribute writers.



3
4
5
# File 'lib/gri/app_walker.rb', line 3

def writers
  @writers
end

Instance Method Details

#runObject



11
12
13
14
15
16
17
18
19
20
21
# File 'lib/gri/app_walker.rb', line 11

def run
  if ARGV.size == 2
    host, sym_oid = ARGV
    snmp = SNMP.new host
    snmp.version = @config['version'] || '1'
    snmp.community = @config['community'] || 'public'
    snmp.walk(sym_oid) {|oid, tag, val|
      p [oid, tag, val]
    }
  end
end