Sha256: bbc74560d7172ee500a2749365c368500b205f06fe532650533ae8fd1feb5d66
Contents?: true
Size: 1.37 KB
Versions: 2
Compression:
Stored size: 1.37 KB
Contents
# frozen_string_literal: true require "strada" require "logger" class Netdisco # 实例化配置对象 CONFIG = Strada.new name: "netdisco", load: false # 设置默认参数 CONFIG.default.use = %w(LLDP CDP) CONFIG.default.poll = %w(192.168.8.0/24 10.250.8.0/24) CONFIG.default.snmp.community = "cisco" CONFIG.default.snmp.timeout = 15 CONFIG.default.snmp.retries = 1 CONFIG.default.snmp.bulkrows = 30 # 1500B packet should fit about 50 :cdpCacheAddress rows CONFIG.default.dot.bothlinks = false # keep both a-b and b-a links CONFIG.default.dot.linklabels = true # label link with interface names CONFIG.default.dot.color = [ # regexp of host => color %w[cpe gold], %w[-sw blue], %w[-pe red], %w[-p yellow], ] CONFIG.default.dns.afi = nil # could be 'ipv4' or 'ipv6' CONFIG.default.log = "STDERR" CONFIG.default.debug = true CONFIG.default.name_map = [ # regexp match+sub of hostname (needed for LLDP) ['-\d+', ""], ["^(.*(?<!mojo.local)$)", '\1.mojo.local'], # adds missing domain name ] # 加载配置并设置对应常量 CONFIG.load CFG = CONFIG.cfg # 设置项目日志参数 log = CFG.log log = STDERR if log == "STDERR" log = STDOUT if log == "STDOUT" Log = Logger.new log Log.level = Logger::INFO Log.level = Logger::DEBUG if CFG.debug end
Version data entries
2 entries across 2 versions & 1 rubygems
Version | Path |
---|---|
netdisco-0.0.8 | lib/netdisco/config.rb |
netdisco-0.0.7 | lib/netdisco/config.rb |