sensu-plugins-snmp 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +4 -4
- checksums.yaml.gz.sig +0 -0
- data/CHANGELOG.md +4 -0
- data/README.md +1 -1
- data/bin/check-snmp.rb +1 -0
- data/bin/metrics-snmp-bulk.rb +22 -4
- data/bin/metrics-snmp-if.rb +1 -0
- data/bin/metrics-snmp.rb +14 -0
- data/lib/sensu-plugins-snmp/version.rb +1 -1
- data.tar.gz.sig +0 -0
- metadata +6 -6
- metadata.gz.sig +3 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 981861f0c8c4d1c6224b22f085bd38ab3171336c
|
4
|
+
data.tar.gz: e9305f8fb476d104625eb2e2fbaaaf61c1490e46
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 058efc26776dbd20c0bb79b2c882ab34f442d824d858bc43a324ef3b631fd81c573903f65ab44c42ceea9ecedc74174d9fce198c616a4cbb92bb544da27c6bab
|
7
|
+
data.tar.gz: 0958889fb4dd9a7f80bb307db5d7f148d2a3105b94cbc8a445eac0b2bbd49867368b76e24a70464cf286b751cb86bdf62d5783792b64ac07a65debad63fca112
|
checksums.yaml.gz.sig
CHANGED
Binary file
|
data/CHANGELOG.md
CHANGED
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
data/bin/metrics-snmp-bulk.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',
|
@@ -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
|
-
|
93
|
-
|
94
|
-
|
95
|
-
|
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
|
data/bin/metrics-snmp-if.rb
CHANGED
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"
|
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.
|
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-
|
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.
|
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.
|
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
|
-
|
1
|
+
H7I3cPS78x#�(ׇ����`�ק;d��pz �OZ6B������n�Qf���'1�f�讖V�z��p�-�RY��������`x�Gn˳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�
|