sensu-plugins-snmp 0.0.2 → 0.0.3

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 CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 6575888c6dd1d6f0fd17c76b4e47b676097e3cc9
4
- data.tar.gz: 7878a477e2aab5cf55ab3cad73710ae9d6c06217
3
+ metadata.gz: 981861f0c8c4d1c6224b22f085bd38ab3171336c
4
+ data.tar.gz: e9305f8fb476d104625eb2e2fbaaaf61c1490e46
5
5
  SHA512:
6
- metadata.gz: a71d2a815a3943cdc69e16f41d7c5b4047bf8c5fc0440681d3d81142fb225af3bc97fd2c239b88980990e680e7bbdcc693aae5ae3664fc1de5bf56641a57d359
7
- data.tar.gz: 3525d49681464216720f581d74ef09d9f72abc461f05402edcae18ef9d940a9752716705209ab3d9b3b6d1f370804f69633e81d72ab52206c4082af56b0ddb5d
6
+ metadata.gz: 058efc26776dbd20c0bb79b2c882ab34f442d824d858bc43a324ef3b631fd81c573903f65ab44c42ceea9ecedc74174d9fce198c616a4cbb92bb544da27c6bab
7
+ data.tar.gz: 0958889fb4dd9a7f80bb307db5d7f148d2a3105b94cbc8a445eac0b2bbd49867368b76e24a70464cf286b751cb86bdf62d5783792b64ac07a65debad63fca112
checksums.yaml.gz.sig CHANGED
Binary file
data/CHANGELOG.md CHANGED
@@ -5,6 +5,10 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
5
5
 
6
6
  ## Unreleased][unreleased]
7
7
 
8
+ ## [0.0.3] - 2015-07-14
9
+ ### Changed
10
+ - updated sensu-plugin gem to 1.2.0
11
+
8
12
  ## [0.0.2] - 2015-06-03
9
13
 
10
14
  ### Fixed
data/README.md CHANGED
@@ -1,6 +1,6 @@
1
1
  ## Sensu-Plugins-snmp
2
2
 
3
- [![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-snmp.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-snmp)
3
+ [ ![Build Status](https://travis-ci.org/sensu-plugins/sensu-plugins-snmp.svg?branch=master)](https://travis-ci.org/sensu-plugins/sensu-plugins-snmp)
4
4
  [![Gem Version](https://badge.fury.io/rb/sensu-plugins-snmp.svg)](http://badge.fury.io/rb/sensu-plugins-snmp)
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)
data/bin/check-snmp.rb CHANGED
@@ -22,6 +22,7 @@
22
22
  require 'sensu-plugin/check/cli'
23
23
  require 'snmp'
24
24
 
25
+ # Class that checks the return from querying SNMP.
25
26
  class CheckSNMP < Sensu::Plugin::Check::CLI
26
27
  option :host,
27
28
  short: '-h host',
@@ -20,6 +20,7 @@
20
20
  require 'sensu-plugin/metric/cli'
21
21
  require 'snmp'
22
22
 
23
+ # Class that collects and outputs SNMP metrics in graphite format
23
24
  class SNMPGraphite < Sensu::Plugin::Metric::CLI::Graphite
24
25
  option :host,
25
26
  short: '-h host',
@@ -66,17 +67,30 @@ class SNMPGraphite < Sensu::Plugin::Metric::CLI::Graphite
66
67
  description: 'Number of supplied OIDs that should not be iterated over (defaults to 0)',
67
68
  default: 0
68
69
 
70
+ option :mibdir,
71
+ short: '-d mibdir',
72
+ description: 'Full path to custom MIB directory.'
73
+
74
+ option :mibs,
75
+ short: '-l mib[,mib,mib...]',
76
+ description: 'Custom MIBs to load (from custom mib path).',
77
+ default: ''
78
+
69
79
  option :timeout,
70
80
  short: '-t timeout (seconds) (defaults to 5)',
71
81
  default: 5
72
82
 
73
83
  def run
74
84
  oids = config[:objectid].split(',')
85
+ mibs = config[:mibs].split(',')
75
86
  begin
76
87
  manager = SNMP::Manager.new(host: "#{config[:host]}",
77
88
  community: "#{config[:community]}",
78
89
  version: config[:snmp_version].to_sym,
79
90
  timeout: config[:timeout].to_i)
91
+ if config[:mibdir] && !mibs.empty?
92
+ manager.load_modules(mibs, config[:mibdir])
93
+ end
80
94
  response = manager.get_bulk(config[:nonrepeat].to_i,
81
95
  config[:maxrepeat].to_i,
82
96
  oids)
@@ -89,10 +103,14 @@ class SNMPGraphite < Sensu::Plugin::Metric::CLI::Graphite
89
103
  response.each_varbind do |vb|
90
104
  name = vb.oid
91
105
  name = "#{name}".gsub('.', '_') if config[:graphite]
92
- if config[:prefix]
93
- output "#{config[:prefix]}.#{config[:host]}.#{config[:suffix]}.#{name}", vb.value.to_f
94
- else
95
- output "#{config[:host]}.#{config[:suffix]}.#{name}", vb.value.to_f
106
+ begin
107
+ if config[:prefix]
108
+ output "#{config[:prefix]}.#{config[:host]}.#{config[:suffix]}.#{name}", value.to_f
109
+ else
110
+ output "#{config[:host]}.#{config[:suffix]}.#{name}", vb.value.to_f
111
+ end
112
+ rescue NameError # rubocop:disable all
113
+ # Some values may fail to cast to float
96
114
  end
97
115
  end
98
116
  manager.close
@@ -41,6 +41,7 @@ def graphite_safe_name(name)
41
41
  name.gsub(/\W/, '_')
42
42
  end
43
43
 
44
+ # Class that collects SNMP if metrics and outputs them in graphite format.
44
45
  class SNMPIfStatsGraphite < Sensu::Plugin::Metric::CLI::Graphite
45
46
  option :host,
46
47
  short: '-h host',
data/bin/metrics-snmp.rb CHANGED
@@ -20,6 +20,7 @@
20
20
  require 'sensu-plugin/metric/cli'
21
21
  require 'snmp'
22
22
 
23
+ # Class that collects and outputs SNMP metrics in graphite format
23
24
  class SNMPGraphite < Sensu::Plugin::Metric::CLI::Graphite
24
25
  option :host,
25
26
  short: '-h host',
@@ -56,9 +57,22 @@ class SNMPGraphite < Sensu::Plugin::Metric::CLI::Graphite
56
57
  description: 'Replace dots with underscores in hostname',
57
58
  boolean: true
58
59
 
60
+ option :mibdir,
61
+ short: '-d mibdir',
62
+ description: 'Full path to custom MIB directory.'
63
+
64
+ option :mibs,
65
+ short: '-l mib[,mib,mib...]',
66
+ description: 'Custom MIBs to load (from custom mib path).',
67
+ default: ''
68
+
59
69
  def run
70
+ mibs = config[:mibs].split(',')
60
71
  begin
61
72
  manager = SNMP::Manager.new(host: "#{config[:host]}", community: "#{config[:community]}", version: config[:snmp_version].to_sym)
73
+ if config[:mibdir] && !mibs.empty?
74
+ manager.load_modules(mibs, config[:mibdir])
75
+ end
62
76
  response = manager.get(["#{config[:objectid]}"])
63
77
  rescue SNMP::RequestTimeout
64
78
  unknown "#{config[:host]} not responding"
@@ -2,7 +2,7 @@ module SensuPluginsSnmp
2
2
  module Version
3
3
  MAJOR = 0
4
4
  MINOR = 0
5
- PATCH = 2
5
+ PATCH = 3
6
6
 
7
7
  VER_STRING = [MAJOR, MINOR, PATCH].compact.join('.')
8
8
  end
data.tar.gz.sig CHANGED
Binary file
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: sensu-plugins-snmp
3
3
  version: !ruby/object:Gem::Version
4
- version: 0.0.2
4
+ version: 0.0.3
5
5
  platform: ruby
6
6
  authors:
7
7
  - Sensu-Plugins and contributors
@@ -30,7 +30,7 @@ cert_chain:
30
30
  8sHuVruarogxxKPBzlL2is4EUb6oN/RdpGx2l4254+nyR+abg//Ed27Ym0PkB4lk
31
31
  HP0m8WSjZmFr109pE/sVsM5jtOCvogyujQOjNVGN4gz1wwPr
32
32
  -----END CERTIFICATE-----
33
- date: 2015-06-04 00:00:00.000000000 Z
33
+ date: 2015-07-14 00:00:00.000000000 Z
34
34
  dependencies:
35
35
  - !ruby/object:Gem::Dependency
36
36
  name: sensu-plugin
@@ -38,14 +38,14 @@ dependencies:
38
38
  requirements:
39
39
  - - '='
40
40
  - !ruby/object:Gem::Version
41
- version: 1.1.0
41
+ version: 1.2.0
42
42
  type: :runtime
43
43
  prerelease: false
44
44
  version_requirements: !ruby/object:Gem::Requirement
45
45
  requirements:
46
46
  - - '='
47
47
  - !ruby/object:Gem::Version
48
- version: 1.1.0
48
+ version: 1.2.0
49
49
  - !ruby/object:Gem::Dependency
50
50
  name: snmp
51
51
  requirement: !ruby/object:Gem::Requirement
@@ -78,14 +78,14 @@ dependencies:
78
78
  name: rubocop
79
79
  requirement: !ruby/object:Gem::Requirement
80
80
  requirements:
81
- - - "~>"
81
+ - - '='
82
82
  - !ruby/object:Gem::Version
83
83
  version: '0.30'
84
84
  type: :development
85
85
  prerelease: false
86
86
  version_requirements: !ruby/object:Gem::Requirement
87
87
  requirements:
88
- - - "~>"
88
+ - - '='
89
89
  - !ruby/object:Gem::Version
90
90
  version: '0.30'
91
91
  - !ruby/object:Gem::Dependency
metadata.gz.sig CHANGED
@@ -1 +1,3 @@
1
- A_ɦ�j=k���j�lԩ��d�+�s���x����U�t�� }EVԼ�g����v6�������� ��Q�H��`�n8���\��G����k�\�tSE��WR� �& �͊JM53M�bv&�}W���������L��4���u���L3y7f0��vgL^��2 T~��hV#�X(�᥋����F c7��Z�<��� {�J�*��(�l
1
+ H7I3cPS78x#�(ׇ����`�ק;d ��pz OZ6B������n�Qf���'1f�讖Vz��p�-�RY��������`xGn˳4��q
2
+ �$��F:�wQ}1�s]�-w�I�{j�y
3
+ �M��Q�@[��e�Тf�ҹ�'壕2�<Ѽ�7�H���ߙfqx����]_���V�n�+�Q_��_- =ez��6�