sensu-extensions-snmp-trap 0.0.11 → 0.0.12
Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9f0973bb3ae00e0a0ce2cb2c73f791647e1c0cc6
|
4
|
+
data.tar.gz: dfb3cddff9fdd957baebc60eb66f98ca0abc5122
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 9821e8c84870558c58d524457e7755cc03d64ed0bf4669bf0b8278de07588d96cd602531a998fe7c8a99ac7a35112b58cbebc6f302a723c067804afd126bb28f
|
7
|
+
data.tar.gz: c16dff9fa82c6a204858921c49449bd0ef4881e1ac441cc93236322dc1032d86cc29087bf2c99826a76586b3baad2c64d0bcf48dc6d4789c63843809f8ae0fbd
|
@@ -71,10 +71,12 @@ module Sensu
|
|
71
71
|
:mibs_dir => options[:mibs_dir],
|
72
72
|
:imported_dir => options[:imported_dir]
|
73
73
|
})
|
74
|
-
Dir.glob(File.join(options[:mibs_dir], "*"))
|
74
|
+
mib_files = Dir.glob(File.join(options[:mibs_dir], "*"))
|
75
|
+
mib_files.each do |mib_file|
|
75
76
|
@logger.debug("snmp trap check extension importing mib", :mib_file => mib_file)
|
76
77
|
begin
|
77
|
-
|
78
|
+
preload = mib_files - [mib_file]
|
79
|
+
SNMP::MIB.import_module(mib_file, options[:imported_dir], preload)
|
78
80
|
rescue StandardError, SyntaxError => error
|
79
81
|
@logger.debug("snmp trap check extension failed to import mib", {
|
80
82
|
:mib_file => mib_file,
|
@@ -13,11 +13,13 @@ module SNMP
|
|
13
13
|
@sensu_logger.warn("snmp trap check extension mib warning", :warning => message.downcase)
|
14
14
|
end
|
15
15
|
|
16
|
-
def import_module(module_file, mib_dir=DEFAULT_MIB_PATH)
|
16
|
+
def import_module(module_file, mib_dir=DEFAULT_MIB_PATH, mib_preload=[])
|
17
17
|
raise "smidump tool must be installed" unless import_supported?
|
18
18
|
FileUtils.makedirs mib_dir
|
19
|
+
# PATCH: add preload support
|
20
|
+
preload = mib_preload.map {|mib_file| " -p #{mib_file}"}.join("")
|
19
21
|
# PATCH: redirect STDERR to /dev/null
|
20
|
-
mib_hash = `smidump -k -f python #{module_file} 2>/dev/null`
|
22
|
+
mib_hash = `smidump#{preload} -k -f python #{module_file} 2>/dev/null`
|
21
23
|
mib = eval_mib_data(mib_hash)
|
22
24
|
if mib
|
23
25
|
module_name = mib["moduleName"]
|