sensu-extensions-snmp-trap 0.0.32 → 0.0.33
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- data/README.md +12 -3
- data/lib/sensu/extensions/snmp-trap.rb +9 -19
- 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: c4342e74ab5be7cb98d42caa3c2e352db94b9d54
|
4
|
+
data.tar.gz: d7992dee469ed47b372d0244db058e00b4721066
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 77aa4ebe890f716b1dce69097e5e7a74b42fb681a0237927292c3ad633dc5bcd8c06372ef5905bdc318fdb613c2e259a734ce506576fdc5d67e10da805edd02d
|
7
|
+
data.tar.gz: 7c1deb9d986c2c356a57ca23170483f453be8a65074a6923bfd6f15ac938f2daba6dece3fa5addfd5e3a205a00725b1df484df7bdfafa419e19846e754a111e0
|
data/README.md
CHANGED
@@ -25,7 +25,7 @@ This extension requires Sensu version >= 0.26.
|
|
25
25
|
On a Sensu client machine.
|
26
26
|
|
27
27
|
```
|
28
|
-
sensu-install -e snmp-trap:0.0.
|
28
|
+
sensu-install -e snmp-trap:0.0.33
|
29
29
|
```
|
30
30
|
|
31
31
|
Edit `/etc/sensu/conf.d/extensions.json` to load it.
|
@@ -34,7 +34,7 @@ Edit `/etc/sensu/conf.d/extensions.json` to load it.
|
|
34
34
|
{
|
35
35
|
"extensions": {
|
36
36
|
"snmp-trap": {
|
37
|
-
"version": "0.0.
|
37
|
+
"version": "0.0.33"
|
38
38
|
}
|
39
39
|
}
|
40
40
|
}
|
@@ -47,7 +47,13 @@ Edit `/etc/sensu/conf.d/snmp_trap.json` to change its configuration.
|
|
47
47
|
``` json
|
48
48
|
{
|
49
49
|
"snmp_trap": {
|
50
|
-
"community": "secret"
|
50
|
+
"community": "secret",
|
51
|
+
"result_attributes": {
|
52
|
+
"datacenter": "DC01"
|
53
|
+
},
|
54
|
+
"result_status_map": [
|
55
|
+
["authenticationFailure", 0]
|
56
|
+
]
|
51
57
|
}
|
52
58
|
}
|
53
59
|
```
|
@@ -60,3 +66,6 @@ Edit `/etc/sensu/conf.d/snmp_trap.json` to change its configuration.
|
|
60
66
|
|mibs_dir|string|"/etc/sensu/mibs"|MIBs directory to import and load MIBs from|
|
61
67
|
|imported_dir|string|"$TMPDIR/sensu_snmp_imported_mibs"|Directory to store imported MIB data in|
|
62
68
|
|handlers|array|["default"]|Handlers to specify in Sensu check results|
|
69
|
+
|result_attributes|hash|{}|Custom check result attributes to add to every SNMP trap Sensu check result|
|
70
|
+
|result_map|array|[]|SNMP trap varbind to Sensu check result translation mappings|
|
71
|
+
|result_status_map|array|[]|SNMP trap OID to Sensu check result status mappings|
|
@@ -53,21 +53,19 @@ module Sensu
|
|
53
53
|
:bind => "0.0.0.0",
|
54
54
|
:port => 1062,
|
55
55
|
:community => "public",
|
56
|
-
:handlers => ["default"],
|
57
56
|
:mibs_dir => "/etc/sensu/mibs",
|
58
57
|
:imported_dir => File.join(Dir.tmpdir, "sensu_snmp_imported_mibs"),
|
58
|
+
:handlers => ["default"],
|
59
59
|
:result_attributes => {},
|
60
|
-
:
|
61
|
-
|
62
|
-
:result_status => []
|
63
|
-
}
|
60
|
+
:result_map => [],
|
61
|
+
:result_status_map => []
|
64
62
|
}
|
65
63
|
@options.merge!(@settings[:snmp_trap]) if @settings[:snmp_trap].is_a?(Hash)
|
66
64
|
@options
|
67
65
|
end
|
68
66
|
|
69
|
-
def
|
70
|
-
|
67
|
+
def convert_to_map(configured_map)
|
68
|
+
configured_map.map do |mapping|
|
71
69
|
[
|
72
70
|
Regexp.new(mapping.first),
|
73
71
|
mapping.last.is_a?(String) ? mapping.last.to_sym : mapping.last
|
@@ -77,12 +75,8 @@ module Sensu
|
|
77
75
|
|
78
76
|
def result_map
|
79
77
|
return @result_map if @result_map
|
80
|
-
if options[:
|
81
|
-
|
82
|
-
options[:mappings][:result] &&
|
83
|
-
options[:mappings][:result].is_a?(Array)
|
84
|
-
configured_mapping = options[:mappings][:result]
|
85
|
-
@result_map = convert_to_mapping(configured_mapping) + RESULT_MAP
|
78
|
+
if options[:result_map] && options[:result_map].is_a?(Array)
|
79
|
+
@result_map = convert_to_map(options[:result_map]) + RESULT_MAP
|
86
80
|
else
|
87
81
|
@result_map = RESULT_MAP
|
88
82
|
end
|
@@ -90,12 +84,8 @@ module Sensu
|
|
90
84
|
|
91
85
|
def result_status_map
|
92
86
|
return @result_status_map if @result_status_map
|
93
|
-
if options[:
|
94
|
-
|
95
|
-
options[:mappings][:result_status] &&
|
96
|
-
options[:mappings][:result_status].is_a?(Array)
|
97
|
-
configured_mapping = options[:mappings][:result_status]
|
98
|
-
@result_status_map = convert_to_mapping(configured_mapping) + RESULT_STATUS_MAP
|
87
|
+
if options[:result_status_map] && options[:result_status_map].is_a?(Array)
|
88
|
+
@result_status_map = convert_to_map(options[:result_status_map]) + RESULT_STATUS_MAP
|
99
89
|
else
|
100
90
|
@result_status_map = RESULT_STATUS_MAP
|
101
91
|
end
|