Class: Fuey::Inspections::SNMPWalk

Inherits:
Inspection show all
Defined in:
lib/fuey_client/fuey/inspections/snmp_walk.rb

Instance Attribute Summary collapse

Attributes inherited from Inspection

#name, #state

Instance Method Summary collapse

Methods inherited from Inspection

#failed?, #notify, #passed?, #status

Constructor Details

#initialize(args) ⇒ SNMPWalk

Returns a new instance of SNMPWalk.



8
9
10
11
12
13
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 8

def initialize(args)
  super(args)
  @version ||= "v1"
  @community ||= "public"
  @status_message = ""
end

Instance Attribute Details

#agentObject

Returns the value of attribute agent.



6
7
8
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 6

def agent
  @agent
end

#communityObject

Returns the value of attribute community.



6
7
8
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 6

def community
  @community
end

#ipObject

Returns the value of attribute ip.



6
7
8
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 6

def ip
  @ip
end

#oidObject

Returns the value of attribute oid.



6
7
8
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 6

def oid
  @oid
end

#responseObject

Returns the value of attribute response.



6
7
8
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 6

def response
  @response
end

#versionObject

Returns the value of attribute version.



6
7
8
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 6

def version
  @version
end

Instance Method Details

#_executeObject



15
16
17
18
19
20
21
22
23
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 15

def _execute
  @response = Support::ShellCommand.new(snmp_walk_command).execute
  result = (response =~ /#{ip}/)
  if result
    self.pass
  else
    self.fail
  end
end

#settingsObject



30
31
32
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 30

def settings
  snmp_walk_command || ""
end

#status_messageObject



25
26
27
28
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 25

def status_message
  return %(SNMPWalk #{state} #{snmp_walk_command}) if @response.nil? || passed?
  %(SNMPWalk #{state}. #{response})
end

#to_sObject



34
35
36
# File 'lib/fuey_client/fuey/inspections/snmp_walk.rb', line 34

def to_s
  snmp_walk_command
end