sensu-extensions-snmp-trap 0.0.19 → 0.0.20

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: 12d3654058c74601dd3cb4761f66538d1f1729d8
4
- data.tar.gz: e6b602eda0c4f9d44b2479e192be2fdca4b0d845
3
+ metadata.gz: 7fa747ee393177360df251077de7f15670287f57
4
+ data.tar.gz: d4eb71a7e0b93ac4cbb260696622d57c1baec6d5
5
5
  SHA512:
6
- metadata.gz: 089c02af275d3ba0722c2057634a456b92a5f1d11d400b8f5faf531a83b39b2d53ac76d9b39f363d860d9b9218c2ff759a274b470eb615e2f2a446dd39fa0e61
7
- data.tar.gz: 29bfa3eff6dd24dcc52d3f07ff4b2e4d7a3799e54058381a880e50e07912d17edcb2e452fa765f011907f7072065992fcaa1d50941e7ffa980e4b10ff84855ce
6
+ metadata.gz: 0e9e7f89bb35fb95eeeb548ae2ddd89b38fdd7df3daca7586e2e6185d76ef5ac1fbdf2033deb7647e967d2b387eea8158c4b60392b43bb5c8f90f543f00024da
7
+ data.tar.gz: c2dd787e127782697c5760dde231437d279cd8e1d190232089db93437d4a60887dd5cf83c124e8f64a7c0e53896749fc4cf2a99fe4f072e2c544cdc52a478047
data/README.md CHANGED
@@ -1,8 +1,17 @@
1
- # Sensu SNMP Trap Check Extension
1
+ # Sensu SNMP Trap Extension
2
2
 
3
- Creates a SNMPv2 trap listener as part of the Sensu client process.
4
- This SNMP trap extension loads MIBs and attempts to translate SNMP
5
- traps into Sensu check results.
3
+ A SNMP trap listener for the Sensu client process. This check
4
+ extension creates a SNMPv2 trap listener, loads & imports MIB files,
5
+ and attempts to translate SNMP traps into Sensu check results. Sensu
6
+ proxy clients are created for SNMP devices, using the device hostname
7
+ as the client name, when a SNMP trap is received.
8
+
9
+ The SNMP trap to Sensu check result translation logic is currently
10
+ being improved. Failure to translate the SNMP trap will produce a
11
+ check result (and event) like the following (addresses have been
12
+ redacted):
13
+
14
+ ![screenshot](https://raw.github.com/sensu-extensions/sensu-extensions-snmp-trap/master/iflinkdown.png)
6
15
 
7
16
  ## Inspiration
8
17
 
@@ -11,8 +20,12 @@ on [SNMPTrapHandler](https://github.com/warmfusion/sensu-extension-snmptrap).
11
20
 
12
21
  ## Installation
13
22
 
23
+ This extension requires Sensu version >= 0.26.
24
+
25
+ On a Sensu client machine.
26
+
14
27
  ```
15
- sensu-install -e snmp-trap
28
+ sensu-install -e snmp-trap:0.0.19
16
29
  ```
17
30
 
18
31
  Edit `/etc/sensu/conf.d/extensions.json` to load it.
@@ -21,7 +34,7 @@ Edit `/etc/sensu/conf.d/extensions.json` to load it.
21
34
  {
22
35
  "extensions": {
23
36
  "snmp-trap": {
24
- "version": "0.0.2"
37
+ "version": "0.0.19"
25
38
  }
26
39
  }
27
40
  }
@@ -29,10 +42,21 @@ Edit `/etc/sensu/conf.d/extensions.json` to load it.
29
42
 
30
43
  ## Configuration
31
44
 
32
- |param|type|default|description|
45
+ Edit `/etc/sensu/conf.d/snmp_trap.json` to change its configuration.
46
+
47
+ ``` json
48
+ {
49
+ "snmp_trap": {
50
+ "community": "secret"
51
+ }
52
+ }
53
+ ```
54
+
55
+ |attribute|type|default|description|
33
56
  |----|----|----|---|
34
- |:bind|:string|0.0.0.0|IP to bind the SNMP trap listener to|
35
- |:port|:integer|1062|Port to bind the SNMP trap listener to|
36
- |:community|:string|"public"|SNMP community string to use|
37
- |:handlers|:array|["default"]|Handlers to specify in Sensu check results|
38
- |:mibs_dir|:string|"/etc/sensu/mibs"|MIBs directory to import and load MIBs from|
57
+ |bind|string|0.0.0.0|IP to bind the SNMP trap listener to|
58
+ |port|integer|1062|Port to bind the SNMP trap listener to|
59
+ |community|string|"public"|SNMP community string to use|
60
+ |mibs_dir|string|"/etc/sensu/mibs"|MIBs directory to import and load MIBs from|
61
+ |imported_dir|string|"$TMPDIR/sensu_snmp_imported_mibs"|Directory to store imported MIB data in|
62
+ |handlers|array|["default"]|Handlers to specify in Sensu check results|
@@ -12,6 +12,11 @@ module Sensu
12
12
  [/severity/i, :status]
13
13
  ]
14
14
 
15
+ RESULT_STATUS_MAP = [
16
+ [/down/i, 2],
17
+ [/authenticationfailure/i, 1]
18
+ ]
19
+
15
20
  RUBY_ASN1_MAP = {
16
21
  "INTEGER" => :to_i,
17
22
  "OCTET STRING" => :to_s,
@@ -189,11 +194,10 @@ module Sensu
189
194
 
190
195
  def determine_trap_status(trap)
191
196
  oid_symoblic_name = determine_trap_oid(trap)
192
- critical_regexp = [
193
- /down/i
194
- ]
195
- critical = critical_regexp.any? { |regexp| oid_symoblic_name =~ regexp }
196
- critical ? 2 : 0
197
+ mapping = RESULT_STATUS_MAP.detect do |mapping|
198
+ oid_symbolic_name =~ mapping.first
199
+ end
200
+ mapping ? mapping.last : 0
197
201
  end
198
202
 
199
203
  def process_trap(trap)
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-extensions-snmp-trap
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.19
4
+ version: 0.0.20
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Extensions and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-11-21 00:00:00.000000000 Z
11
+ date: 2017-01-19 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: sensu-extension