Method: NETSNMP::Session#initialize

Defined in:
lib/netsnmp/session.rb

#initialize(version: 1, community: "public", **options) ⇒ Session

Returns a new instance of Session.

Parameters:

  • opts (Hash)

    the options set



12
13
14
15
16
17
18
19
20
21
22
23
24
# File 'lib/netsnmp/session.rb', line 12

def initialize(version: 1, community: "public", **options)
  @version = case version
             when Integer then version # assume the use know what he's doing
             when /v?1/ then 0
             when /v?2c?/ then 1
             when /v?3/ then 3
             else
               raise "unsupported snmp version (#{version})"
             end
  @community = community
  validate(**options)
  initialize_logger(**options)
end