sensu-extensions-snmp-trap 0.0.27 → 0.0.28
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +4 -4
- data/lib/sensu/extensions/snmp-trap.rb +24 -3
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: adf65d516cbb7841c38b4b1555b192da5feaf106
|
4
|
+
data.tar.gz: f2d2db96b5faa60585d65508ec96098869be43bf
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 1f8ced94e1b14739ea8f0df8b8124dc64d37d9d26bd343a5b6c8c37248829d617ed55881c6941a324f3d7b56de47d524513972459964f7d5cb5daf2f96eda995
|
7
|
+
data.tar.gz: 4a92c2e7bb8acee58ab37f0e84ad58d15ed630877816ba2caefdbf6ba7247614e98b3c562339454fcdaaecc0fc2fdbb90bf62068d23044e7c689b2c2af96cb0a
|
@@ -198,14 +198,14 @@ module Sensu
|
|
198
198
|
def determine_trap_name(trap)
|
199
199
|
oid_symbolic_name = determine_trap_oid(trap)
|
200
200
|
if oid_symbolic_name =~ /link(down|up)/i
|
201
|
-
name = "
|
201
|
+
name = "link_status"
|
202
202
|
trap.varbind_list.each do |varbind|
|
203
203
|
symbolic_name = @mibs.name(varbind.name.to_oid)
|
204
204
|
if symbolic_name =~ /ifindex/i || symbolic_name =~ /systemobject/i
|
205
205
|
type_conversion = RUBY_ASN1_MAP[varbind.value.asn1_type]
|
206
206
|
if type_conversion
|
207
207
|
value = varbind.value.send(type_conversion)
|
208
|
-
name = "#{name}
|
208
|
+
name = "#{name}_#{value}"
|
209
209
|
end
|
210
210
|
end
|
211
211
|
end
|
@@ -215,6 +215,27 @@ module Sensu
|
|
215
215
|
end
|
216
216
|
end
|
217
217
|
|
218
|
+
def determine_trap_output(trap)
|
219
|
+
oid_symbolic_name = determine_trap_oid(trap)
|
220
|
+
if matched = /link(down|up)/i.match(oid_symbolic_name)
|
221
|
+
link_status = matched[1].downcase
|
222
|
+
output = "link is #{link_status}"
|
223
|
+
trap.varbind_list.each do |varbind|
|
224
|
+
symbolic_name = @mibs.name(varbind.name.to_oid)
|
225
|
+
if symbolic_name =~ /ifalias/i || symbolic_name =~ /ifdesc/i
|
226
|
+
type_conversion = RUBY_ASN1_MAP[varbind.value.asn1_type]
|
227
|
+
if type_conversion
|
228
|
+
value = varbind.value.send(type_conversion)
|
229
|
+
output = "#{output} - #{value}"
|
230
|
+
end
|
231
|
+
end
|
232
|
+
end
|
233
|
+
output
|
234
|
+
else
|
235
|
+
"received snmp trap"
|
236
|
+
end
|
237
|
+
end
|
238
|
+
|
218
239
|
def determine_trap_status(trap)
|
219
240
|
oid_symbolic_name = determine_trap_oid(trap)
|
220
241
|
mapping = RESULT_STATUS_MAP.detect do |mapping|
|
@@ -257,7 +278,7 @@ module Sensu
|
|
257
278
|
end
|
258
279
|
end
|
259
280
|
result[:name] ||= determine_trap_name(trap)
|
260
|
-
result[:output] ||=
|
281
|
+
result[:output] ||= determine_trap_output(trap)
|
261
282
|
result[:status] ||= determine_trap_status(trap)
|
262
283
|
send_result(result)
|
263
284
|
end
|