sensu-plugins-snmp 0.1.0 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,15 @@
1
1
  ---
2
- SHA1:
3
- metadata.gz: 3f7350b0daf73bd6077d7407eedcc0fcd8c996b0
4
- data.tar.gz: 60155093f565f86579df5fb82819a12b36517107
2
+ !binary "U0hBMQ==":
3
+ metadata.gz: !binary |-
4
+ MjM1NWRmMGU2NmFjNTI0ODRlOTFlZmQ2YzFjMjQyODkwY2UwMjJmNQ==
5
+ data.tar.gz: !binary |-
6
+ MWU4NjYwMzYwOWQ1ZDJjNzk3YWE3M2U1MzhhZDM4MjgxMjg1NmNlYw==
5
7
  SHA512:
6
- metadata.gz: b793699f8c01672a2fee7572737a5037ed8472676016d77e9898d7849534f54a9d2c942e3113578c4b8950eafb8ba15e5fe46523b15a94d57600c5afb499818a
7
- data.tar.gz: 80311ba562bf6c80dc7464555d558d98d7fcb9bbe555972cfa570c1a533f4d46c156acbba4e1f0660d70d00388e8eb45dea0ccc6aea06364ffd26c3bdfe51b00
8
+ metadata.gz: !binary |-
9
+ ZDkwZDQyMGFmN2UzMGRkZTBjMzkwZDFjNDVhNDgxZDE4NGFhNzJjOTQ2MWFl
10
+ ZjVmYzdjOTRlMDcyZWRkYzhjOTgxNTRkMjM4ZTA2NTEyZGQyMjY1MmViZjgz
11
+ MDRiNjEzYTU5ODFlYTFkYTJlMzZiMzE2MWViZmUwZTI2MzdlNWY=
12
+ data.tar.gz: !binary |-
13
+ ZWYwODQwZGZmYTdmMGNjZTBiYjk2YjI2MDJkNjk5NWFjYmEwNjU1NjUzMDM0
14
+ OTBmOWQ2YzY2NDM5ODkwNWIwYmE4ZjZlMzQ1NTk2MzdjOWIzOTUzODQ0ZjZj
15
+ OTgxZjI0ZjUyMGQ2NDRjYjBmM2U4YmY1NzMxMjhmODllY2ViY2I=
data/CHANGELOG.md CHANGED
@@ -3,7 +3,13 @@ This project adheres to [Semantic Versioning](http://semver.org/).
3
3
 
4
4
  This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
5
5
 
6
- ## Unreleased
6
+ ## [Unreleased]
7
+
8
+ ## [0.2.0] - 2016-08-10
9
+ ### Added
10
+ - Updated sensu-plugin dependency from `= 1.2.0` to `~> 1.2`
11
+ - check-snmp.rb: Option to convert SNMP Timetick data to Integer for easier comparisons
12
+ - check-snmp.rb Debug option for troubleshooting pesky SNMP data
7
13
 
8
14
  ## [0.1.0] - 2015-11-13
9
15
  ### Added
@@ -21,7 +27,6 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
21
27
  - updated sensu-plugin gem to 1.2.0
22
28
 
23
29
  ## [0.0.2] - 2015-06-03
24
-
25
30
  ### Fixed
26
31
  - added binstubs
27
32
 
@@ -29,6 +34,12 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
29
34
  - removed cruft from /lib
30
35
 
31
36
  ## 0.0.1 - 2015-04-30
32
-
33
37
  ### Added
34
38
  - initial release
39
+
40
+ [Unreleased]: https://github.com/sensu-plugins/sensu-plugins-snmp/compare/0.2.0...HEAD
41
+ [0.2.0]: https://github.com/sensu-plugins/sensu-plugins-snmp/compare/0.1.0...0.2.0
42
+ [0.1.0]: https://github.com/sensu-plugins/sensu-plugins-snmp/compare/0.0.4...0.1.0
43
+ [0.0.4]: https://github.com/sensu-plugins/sensu-plugins-snmp/compare/0.0.3...0.0.4
44
+ [0.0.3]: https://github.com/sensu-plugins/sensu-plugins-snmp/compare/0.0.2...0.0.3
45
+ [0.0.2]: https://github.com/sensu-plugins/sensu-plugins-snmp/compare/0.0.1...0.0.2
data/README.md CHANGED
@@ -5,7 +5,6 @@
5
5
  [![Code Climate](https://codeclimate.com/github/sensu-plugins/sensu-plugins-snmp/badges/gpa.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-snmp)
6
6
  [![Test Coverage](https://codeclimate.com/github/sensu-plugins/sensu-plugins-snmp/badges/coverage.svg)](https://codeclimate.com/github/sensu-plugins/sensu-plugins-snmp)
7
7
  [![Dependency Status](https://gemnasium.com/sensu-plugins/sensu-plugins-snmp.svg)](https://gemnasium.com/sensu-plugins/sensu-plugins-snmp)
8
- [![Codeship Status for sensu-plugins/sensu-plugins-snmp](https://codeship.com/projects/c7145640-e8a4-0132-3bde-62885e5c211b/status?branch=master)](https://codeship.com/projects/82852)
9
8
 
10
9
  ## Functionality
11
10
 
@@ -95,8 +95,8 @@ class CheckSNMP < Sensu::Plugin::Check::CLI
95
95
  dev_size_oid = base_oid + '.5'
96
96
  dev_used_oid = base_oid + '.6'
97
97
  begin
98
- manager = SNMP::Manager.new(host: "#{config[:host]}",
99
- community: "#{config[:community]}",
98
+ manager = SNMP::Manager.new(host: config[:host].to_s,
99
+ community: config[:community].to_s,
100
100
  version: config[:snmp_version].to_sym,
101
101
  timeout: config[:timeout].to_i)
102
102
  response = manager.get_bulk(0, 200, [dev_desc_oid])
data/bin/check-snmp.rb CHANGED
@@ -60,17 +60,35 @@ class CheckSNMP < Sensu::Plugin::Check::CLI
60
60
  description: 'Operator used to compare data with warning/critial values. Can be set to "le" (<=), "ge" (>=).',
61
61
  default: 'ge'
62
62
 
63
+ option :convert_timeticks,
64
+ short: '-T',
65
+ long: '--convert-timeticks',
66
+ description: 'Convert SNMP::TimeTicks to Integer for comparisons',
67
+ boolean: true,
68
+ default: false
69
+
63
70
  option :timeout,
64
71
  short: '-t timeout (seconds)',
65
72
  default: '1'
66
73
 
74
+ option :debug,
75
+ short: '-D',
76
+ long: '--debug',
77
+ description: 'Enable debugging to assist with inspecting OID values / data.',
78
+ boolean: true,
79
+ default: false
80
+
67
81
  def run
68
82
  begin
69
- manager = SNMP::Manager.new(host: "#{config[:host]}",
70
- community: "#{config[:community]}",
83
+ manager = SNMP::Manager.new(host: config[:host].to_s,
84
+ community: config[:community].to_s,
71
85
  version: config[:snmp_version].to_sym,
72
86
  timeout: config[:timeout].to_i)
73
- response = manager.get(["#{config[:objectid]}"])
87
+ response = manager.get([config[:objectid].to_s])
88
+ if config[:debug]
89
+ puts 'DEBUG OUTPUT:'
90
+ response.each_varbind { |vb| puts vb.inspect }
91
+ end
74
92
  rescue SNMP::RequestTimeout
75
93
  unknown "#{config[:host]} not responding"
76
94
  rescue => e
@@ -87,10 +105,16 @@ class CheckSNMP < Sensu::Plugin::Check::CLI
87
105
  critical "Value: #{vb.value} failed to match Pattern: #{config[:match]}"
88
106
  end
89
107
  else
90
- critical 'Critical state detected' if "#{vb.value}".to_i.send(symbol, "#{config[:critical]}".to_i)
108
+ snmp_value = if config[:convert_timeticks]
109
+ vb.value.is_a?(SNMP::TimeTicks) ? vb.value.to_i : vb.value
110
+ else
111
+ vb.value
112
+ end
113
+
114
+ critical 'Critical state detected' if snmp_value.to_s.to_i.send(symbol, config[:critical].to_s.to_i)
91
115
  # #YELLOW
92
- warning 'Warning state detected' if ("#{vb.value}".to_i.send(symbol, "#{config[:warning]}".to_i)) && !("#{vb.value}".to_i.send(symbol, "#{config[:critical]}".to_i)) # rubocop:disable LineLength
93
- unless "#{vb.value}".to_i.send(symbol, "#{config[:warning]}".to_i)
116
+ warning 'Warning state detected' if snmp_value.to_s.to_i.send(symbol, config[:warning].to_s.to_i) && !snmp_value.to_s.to_i.send(symbol, config[:critical].to_s.to_i) # rubocop:disable LineLength
117
+ unless snmp_value.to_s.to_i.send(symbol, config[:warning].to_s.to_i)
94
118
  ok 'All is well!'
95
119
  end
96
120
  end
@@ -85,8 +85,8 @@ class SNMPGraphite < Sensu::Plugin::Metric::CLI::Graphite
85
85
  oids = config[:objectid].split(',')
86
86
  mibs = config[:mibs].split(',')
87
87
  begin
88
- manager = SNMP::Manager.new(host: "#{config[:host]}",
89
- community: "#{config[:community]}",
88
+ manager = SNMP::Manager.new(host: config[:host].to_s,
89
+ community: config[:community].to_s,
90
90
  version: config[:snmp_version].to_sym,
91
91
  timeout: config[:timeout].to_i)
92
92
  if config[:mibdir] && !mibs.empty?
@@ -100,10 +100,10 @@ class SNMPGraphite < Sensu::Plugin::Metric::CLI::Graphite
100
100
  rescue => e
101
101
  unknown "An unknown error occured: #{e.inspect}"
102
102
  end
103
- config[:host] = config[:host].gsub('.', '_') if config[:graphite]
103
+ config[:host] = config[:host].tr('.', '_') if config[:graphite]
104
104
  response.each_varbind do |vb|
105
105
  name = vb.oid
106
- name = "#{name}".gsub('.', '_') if config[:graphite]
106
+ name = name.to_s.tr('.', '_') if config[:graphite]
107
107
  begin
108
108
  metric_string = config[:host]
109
109
  metric_string = "#{config[:prefix]}.#{metric_string}" if config[:prefix]
@@ -138,7 +138,7 @@ class SNMPIfStatsGraphite < Sensu::Plugin::Metric::CLI::Graphite
138
138
  if_table_columns = if_table_common_columns +
139
139
  (config[:low_capacity] ? if_table_LC_columns : if_table_HC_columns)
140
140
 
141
- SNMP::Manager.open(host: "#{config[:host]}", community: "#{config[:community]}", version: config[:version]) do |manager|
141
+ SNMP::Manager.open(host: config[:host].to_s, community: config[:community].to_s, version: config[:version]) do |manager|
142
142
  manager.walk(if_table_columns) do |row_array|
143
143
  # turn row (an array) into a hash for eaiser access to the columns
144
144
  row = Hash[*if_table_columns.zip(row_array).flatten]
data/bin/metrics-snmp.rb CHANGED
@@ -71,17 +71,17 @@ class SNMPGraphite < Sensu::Plugin::Metric::CLI::Graphite
71
71
  def run
72
72
  mibs = config[:mibs].split(',')
73
73
  begin
74
- manager = SNMP::Manager.new(host: "#{config[:host]}", community: "#{config[:community]}", version: config[:snmp_version].to_sym)
74
+ manager = SNMP::Manager.new(host: config[:host].to_s, community: config[:community].to_s, version: config[:snmp_version].to_sym)
75
75
  if config[:mibdir] && !mibs.empty?
76
76
  manager.load_modules(mibs, config[:mibdir])
77
77
  end
78
- response = manager.get(["#{config[:objectid]}"])
78
+ response = manager.get([config[:objectid].to_s])
79
79
  rescue SNMP::RequestTimeout
80
80
  unknown "#{config[:host]} not responding"
81
81
  rescue => e
82
82
  unknown "An unknown error occured: #{e.inspect}"
83
83
  end
84
- config[:host] = config[:host].gsub('.', '_') if config[:graphite]
84
+ config[:host] = config[:host].tr('.', '_') if config[:graphite]
85
85
  response.each_varbind do |vb|
86
86
  if config[:prefix]
87
87
  output "#{config[:prefix]}.#{config[:host]}.#{config[:suffix]}", vb.value.to_f
@@ -1,7 +1,7 @@
1
1
  module SensuPluginsSnmp
2
2
  module Version
3
3
  MAJOR = 0
4
- MINOR = 1
4
+ MINOR = 2
5
5
  PATCH = 0
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
metadata CHANGED
@@ -1,51 +1,29 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-snmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.1.0
4
+ version: 0.2.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
8
8
  autorequire:
9
9
  bindir: bin
10
- cert_chain:
11
- - |
12
- -----BEGIN CERTIFICATE-----
13
- MIIDgDCCAmigAwIBAgIBATANBgkqhkiG9w0BAQUFADBDMRIwEAYDVQQDDAltYXR0
14
- am9uZXMxGDAWBgoJkiaJk/IsZAEZFgh5aWVsZGJvdDETMBEGCgmSJomT8ixkARkW
15
- A2NvbTAeFw0xNTAxMjgyMTAyNTFaFw0xNjAxMjgyMTAyNTFaMEMxEjAQBgNVBAMM
16
- CW1hdHRqb25lczEYMBYGCgmSJomT8ixkARkWCHlpZWxkYm90MRMwEQYKCZImiZPy
17
- LGQBGRYDY29tMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAyTSzVYnO
18
- CLgyrIyT1mBQakArQyW8xhi6MlDqyzXHJGeERT790U6EgoBVeS4XoK0ptFZNR8Tf
19
- zko0w+Nv47TarSCgkPOaxY+mxWnAVR10dOmfeLr7huiMyps+YD56/EF2FqQ3jf/+
20
- qohENfKD91qy1ieEy+Fn7Pf74ltbNKUdkb9a9eFXQ0DQ4ip5vik7DzjQkUTj4lca
21
- k6ArwnmHX4YDhZoYtrQJ8jVktN0/+NtA40M5qkCYHNe5tUW25b/tKVYuioxG6b2Z
22
- oIzaZxRLxf6HVAWpCVRT/F5+/yjigkX4u++eYacfLGleXQzoK7BL65vHGMJygWEE
23
- 0TKGqFOrl/L0AQIDAQABo38wfTAJBgNVHRMEAjAAMAsGA1UdDwQEAwIEsDAdBgNV
24
- HQ4EFgQUEf6a8Td7MrSZc8ImbLFZAENPbz0wIQYDVR0RBBowGIEWbWF0dGpvbmVz
25
- QHlpZWxkYm90LmNvbTAhBgNVHRIEGjAYgRZtYXR0am9uZXNAeWllbGRib3QuY29t
26
- MA0GCSqGSIb3DQEBBQUAA4IBAQBbzXAYA3BVGw8DZ0YYoY1VHPNEcH5qPIApmHO8
27
- rvSmuUT0yMEi7u00H/5uHRFf4LleGT/+sTdyXKsNPGT9kdRuQEgwi+vf7Zfvd8aX
28
- UF/+4VkEYf/8rV8Ere6u2QaWPgApdMV6JjKr1fAwCTd8AuGXNaWItiPPMseSQzLJ
29
- JKP4hVvbc1d+oS925B1lcBiqn2aYvElbyNAVmQPywNNqkWmvtlqj9ZVJfV5HQLdu
30
- 8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
- HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
- -----END CERTIFICATE-----
33
- date: 2015-11-13 00:00:00.000000000 Z
10
+ cert_chain: []
11
+ date: 2016-08-10 00:00:00.000000000 Z
34
12
  dependencies:
35
13
  - !ruby/object:Gem::Dependency
36
14
  name: sensu-plugin
37
15
  requirement: !ruby/object:Gem::Requirement
38
16
  requirements:
39
- - - '='
17
+ - - ~>
40
18
  - !ruby/object:Gem::Version
41
- version: 1.2.0
19
+ version: '1.2'
42
20
  type: :runtime
43
21
  prerelease: false
44
22
  version_requirements: !ruby/object:Gem::Requirement
45
23
  requirements:
46
- - - '='
24
+ - - ~>
47
25
  - !ruby/object:Gem::Version
48
- version: 1.2.0
26
+ version: '1.2'
49
27
  - !ruby/object:Gem::Dependency
50
28
  name: snmp
51
29
  requirement: !ruby/object:Gem::Requirement
@@ -64,140 +42,139 @@ dependencies:
64
42
  name: codeclimate-test-reporter
65
43
  requirement: !ruby/object:Gem::Requirement
66
44
  requirements:
67
- - - "~>"
45
+ - - ~>
68
46
  - !ruby/object:Gem::Version
69
47
  version: '0.4'
70
48
  type: :development
71
49
  prerelease: false
72
50
  version_requirements: !ruby/object:Gem::Requirement
73
51
  requirements:
74
- - - "~>"
52
+ - - ~>
75
53
  - !ruby/object:Gem::Version
76
54
  version: '0.4'
77
55
  - !ruby/object:Gem::Dependency
78
56
  name: rubocop
79
57
  requirement: !ruby/object:Gem::Requirement
80
58
  requirements:
81
- - - '='
59
+ - - ~>
82
60
  - !ruby/object:Gem::Version
83
- version: 0.32.1
61
+ version: 0.40.0
84
62
  type: :development
85
63
  prerelease: false
86
64
  version_requirements: !ruby/object:Gem::Requirement
87
65
  requirements:
88
- - - '='
66
+ - - ~>
89
67
  - !ruby/object:Gem::Version
90
- version: 0.32.1
68
+ version: 0.40.0
91
69
  - !ruby/object:Gem::Dependency
92
70
  name: rspec
93
71
  requirement: !ruby/object:Gem::Requirement
94
72
  requirements:
95
- - - "~>"
73
+ - - ~>
96
74
  - !ruby/object:Gem::Version
97
75
  version: '3.1'
98
76
  type: :development
99
77
  prerelease: false
100
78
  version_requirements: !ruby/object:Gem::Requirement
101
79
  requirements:
102
- - - "~>"
80
+ - - ~>
103
81
  - !ruby/object:Gem::Version
104
82
  version: '3.1'
105
83
  - !ruby/object:Gem::Dependency
106
84
  name: bundler
107
85
  requirement: !ruby/object:Gem::Requirement
108
86
  requirements:
109
- - - "~>"
87
+ - - ~>
110
88
  - !ruby/object:Gem::Version
111
89
  version: '1.7'
112
90
  type: :development
113
91
  prerelease: false
114
92
  version_requirements: !ruby/object:Gem::Requirement
115
93
  requirements:
116
- - - "~>"
94
+ - - ~>
117
95
  - !ruby/object:Gem::Version
118
96
  version: '1.7'
119
97
  - !ruby/object:Gem::Dependency
120
98
  name: rake
121
99
  requirement: !ruby/object:Gem::Requirement
122
100
  requirements:
123
- - - "~>"
101
+ - - ~>
124
102
  - !ruby/object:Gem::Version
125
103
  version: '10.0'
126
104
  type: :development
127
105
  prerelease: false
128
106
  version_requirements: !ruby/object:Gem::Requirement
129
107
  requirements:
130
- - - "~>"
108
+ - - ~>
131
109
  - !ruby/object:Gem::Version
132
110
  version: '10.0'
133
111
  - !ruby/object:Gem::Dependency
134
112
  name: github-markup
135
113
  requirement: !ruby/object:Gem::Requirement
136
114
  requirements:
137
- - - "~>"
115
+ - - ~>
138
116
  - !ruby/object:Gem::Version
139
117
  version: '1.3'
140
118
  type: :development
141
119
  prerelease: false
142
120
  version_requirements: !ruby/object:Gem::Requirement
143
121
  requirements:
144
- - - "~>"
122
+ - - ~>
145
123
  - !ruby/object:Gem::Version
146
124
  version: '1.3'
147
125
  - !ruby/object:Gem::Dependency
148
126
  name: redcarpet
149
127
  requirement: !ruby/object:Gem::Requirement
150
128
  requirements:
151
- - - "~>"
129
+ - - ~>
152
130
  - !ruby/object:Gem::Version
153
131
  version: '3.2'
154
132
  type: :development
155
133
  prerelease: false
156
134
  version_requirements: !ruby/object:Gem::Requirement
157
135
  requirements:
158
- - - "~>"
136
+ - - ~>
159
137
  - !ruby/object:Gem::Version
160
138
  version: '3.2'
161
139
  - !ruby/object:Gem::Dependency
162
140
  name: yard
163
141
  requirement: !ruby/object:Gem::Requirement
164
142
  requirements:
165
- - - "~>"
143
+ - - ~>
166
144
  - !ruby/object:Gem::Version
167
145
  version: '0.8'
168
146
  type: :development
169
147
  prerelease: false
170
148
  version_requirements: !ruby/object:Gem::Requirement
171
149
  requirements:
172
- - - "~>"
150
+ - - ~>
173
151
  - !ruby/object:Gem::Version
174
152
  version: '0.8'
175
153
  - !ruby/object:Gem::Dependency
176
154
  name: pry
177
155
  requirement: !ruby/object:Gem::Requirement
178
156
  requirements:
179
- - - "~>"
157
+ - - ~>
180
158
  - !ruby/object:Gem::Version
181
159
  version: '0.10'
182
160
  type: :development
183
161
  prerelease: false
184
162
  version_requirements: !ruby/object:Gem::Requirement
185
163
  requirements:
186
- - - "~>"
164
+ - - ~>
187
165
  - !ruby/object:Gem::Version
188
166
  version: '0.10'
189
- description: |-
190
- This plugin provides native SNMP instrumentation
191
- for monitoring and metrics collection, including:
192
- generic OID single/bulk query for status and
193
- metrics, and ifTable metrics
194
- email: "<sensu-users@googlegroups.com>"
167
+ description: ! "This plugin provides native SNMP instrumentation\n for
168
+ monitoring and metrics collection, including:\n generic
169
+ OID single/bulk query for status and\n metrics, and
170
+ ifTable metrics."
171
+ email: <sensu-users@googlegroups.com>
195
172
  executables:
196
- - metrics-snmp.rb
197
- - metrics-snmp-if.rb
198
- - metrics-snmp-bulk.rb
199
- - check-snmp.rb
200
173
  - check-snmp-disk.rb
174
+ - check-snmp.rb
175
+ - metrics-snmp-bulk.rb
176
+ - metrics-snmp-if.rb
177
+ - metrics-snmp.rb
201
178
  extensions: []
202
179
  extra_rdoc_files: []
203
180
  files:
@@ -227,17 +204,17 @@ require_paths:
227
204
  - lib
228
205
  required_ruby_version: !ruby/object:Gem::Requirement
229
206
  requirements:
230
- - - ">="
207
+ - - ! '>='
231
208
  - !ruby/object:Gem::Version
232
209
  version: 1.9.3
233
210
  required_rubygems_version: !ruby/object:Gem::Requirement
234
211
  requirements:
235
- - - ">="
212
+ - - ! '>='
236
213
  - !ruby/object:Gem::Version
237
214
  version: '0'
238
215
  requirements: []
239
216
  rubyforge_project:
240
- rubygems_version: 2.4.8
217
+ rubygems_version: 2.4.5
241
218
  signing_key:
242
219
  specification_version: 4
243
220
  summary: Sensu plugins for SNMP
checksums.yaml.gz.sig DELETED
@@ -1 +0,0 @@
1
- ' �N���2W;�(y�-I�T�D���OpC��+W� �<�p�i��I�Y��:'�i���e���O�e%e���{��9�7L(粒��XyF�j�Hڼ�v~Xx@��R~[�μs���鑳a
data.tar.gz.sig DELETED
Binary file
metadata.gz.sig DELETED
Binary file