sensu-plugins-openldap 1.0.1 → 2.0.0
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +5 -5
- data/CHANGELOG.md +19 -1
- data/bin/check-syncrepl.rb +7 -5
- data/bin/metrics-ldap.rb +8 -7
- data/lib/sensu-plugins-openldap.rb +1 -0
- data/lib/sensu-plugins-openldap/version.rb +4 -2
- metadata +30 -30
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
|
-
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
2
|
+
SHA256:
|
3
|
+
metadata.gz: 053a42735699a1e59eacfd086cfc6a0fadb5a3a499c477e18d53e1cc4f7468ea
|
4
|
+
data.tar.gz: 44c0acf27ce59c7b8d35779ea6464d1343afdf70443162c24aa4a572a1179579
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: b9f33f547391c7078ad3be421d0c353db3f63eb9e9561a5763f6685e96cf85445343b05c3b02a15701937a6011a46cecf5b6c04d7c99c079cc13ea78fd7c0934
|
7
|
+
data.tar.gz: 576f8aba2d121576e5e569cc284c784621092fd51fa66a3d32d2c643d765658fa93d0eb4f7d5ac5377b5946c9296b1193fd3bca3b7f9ba1cef3bb1154fd0dc03
|
data/CHANGELOG.md
CHANGED
@@ -4,6 +4,23 @@ This project adheres to [Semantic Versioning](http://semver.org/).
|
|
4
4
|
This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachangelog.com/)
|
5
5
|
|
6
6
|
## [Unreleased]
|
7
|
+
|
8
|
+
## [2.0.0] - 2020-06-22
|
9
|
+
### Breaking Changes
|
10
|
+
- Update minimum required ruby version to 2.3. Drop unsupported ruby versions.
|
11
|
+
- Bump `sensu-plugin` dependency to `~> 4.0`
|
12
|
+
|
13
|
+
### Added
|
14
|
+
- Bonsai asset support
|
15
|
+
- Ruby 2.4.1 testing
|
16
|
+
|
17
|
+
### Changed
|
18
|
+
- Updated bundler dependency to '~> 2.1'
|
19
|
+
- Updated rubocop dependency to '0.81' # last version to support Ruby 2.3
|
20
|
+
- Updated net-ldap dependency to '0.16.2'
|
21
|
+
- Remediated rubocop issues
|
22
|
+
- Updated rake dependency to '~> 13.0'
|
23
|
+
|
7
24
|
### [1.0.1]
|
8
25
|
- Fix #3 : metrics-ldap.rb Error Cannot connect to (@roumano)
|
9
26
|
|
@@ -30,7 +47,8 @@ This CHANGELOG follows the format listed at [Keep A Changelog](http://keepachang
|
|
30
47
|
### Added
|
31
48
|
- initial release
|
32
49
|
|
33
|
-
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-openldap/compare/
|
50
|
+
[Unreleased]: https://github.com/sensu-plugins/sensu-plugins-openldap/compare/2.0.0...HEAD
|
51
|
+
[2.0.0]: https://github.com/sensu-plugins/sensu-plugins-openldap/compare/1.0.1...2.0.0
|
34
52
|
[1.0.1]: https://github.com/sensu-plugins/sensu-plugins-openldap/compare/1.0.0...1.0.1
|
35
53
|
[1.0.0]: https://github.com/sensu-plugins/sensu-plugins-openldap/compare/0.0.3...1.0.0
|
36
54
|
[0.0.3]: https://github.com/sensu-plugins/sensu-plugins-openldap/compare/0.0.2...0.0.3
|
data/bin/check-syncrepl.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#! /usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# check-syncrepl
|
4
6
|
#
|
@@ -105,7 +107,7 @@ class CheckSyncrepl < Sensu::Plugin::Check::CLI
|
|
105
107
|
proc: proc(&:to_i)
|
106
108
|
|
107
109
|
def get_csns(host)
|
108
|
-
if config[:user]
|
110
|
+
if config[:user] # rubocop:disable Style/ConditionalAssignment
|
109
111
|
ldap = Net::LDAP.new host: host,
|
110
112
|
port: config[:port],
|
111
113
|
auth: {
|
@@ -127,7 +129,7 @@ class CheckSyncrepl < Sensu::Plugin::Check::CLI
|
|
127
129
|
tls_options[:ca_file] = config[:cacert]
|
128
130
|
end
|
129
131
|
if config[:cert]
|
130
|
-
tls_options[:cert] = open(config[:cert]) { |i| OpenSSL::X509::Certificate.new(i) }
|
132
|
+
tls_options[:cert] = open(config[:cert]) { |i| OpenSSL::X509::Certificate.new(i) } # rubocop:disable Security/Open
|
131
133
|
end
|
132
134
|
ldap.encryption(method: config[:encryption], tls_options: tls_options)
|
133
135
|
end
|
@@ -145,7 +147,7 @@ class CheckSyncrepl < Sensu::Plugin::Check::CLI
|
|
145
147
|
critical message
|
146
148
|
end
|
147
149
|
end
|
148
|
-
rescue
|
150
|
+
rescue StandardError
|
149
151
|
message = "Cannot connect to #{host}:#{config[:port]}"
|
150
152
|
if config[:user]
|
151
153
|
message += " as #{config[:user]}"
|
@@ -168,11 +170,11 @@ class CheckSyncrepl < Sensu::Plugin::Check::CLI
|
|
168
170
|
@differences = []
|
169
171
|
combinations = csns.keys.combination(2).to_a
|
170
172
|
combinations.each do |hosts|
|
171
|
-
@differences << hosts if (csns[hosts[0]] - csns[hosts[1]]).length > 0 # rubocop:disable
|
173
|
+
@differences << hosts if (csns[hosts[0]] - csns[hosts[1]]).length > 0 # rubocop:disable all
|
172
174
|
end
|
173
175
|
|
174
176
|
# If everything is OK, no need to retry
|
175
|
-
ok 'All nodes are in sync' if @differences.length == 0 # rubocop:disable
|
177
|
+
ok 'All nodes are in sync' if @differences.length == 0 # rubocop:disable all
|
176
178
|
end
|
177
179
|
|
178
180
|
# Hit max retries, report latest differences
|
data/bin/metrics-ldap.rb
CHANGED
@@ -1,4 +1,6 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
|
+
# frozen_string_literal: false
|
3
|
+
|
2
4
|
#
|
3
5
|
# ldap-metrics.rb
|
4
6
|
#
|
@@ -38,9 +40,9 @@ require 'sensu-plugin/utils'
|
|
38
40
|
require 'socket'
|
39
41
|
require 'net/ldap'
|
40
42
|
|
41
|
-
include Sensu::Plugin::Utils
|
42
|
-
|
43
43
|
class LDAPGraphite < Sensu::Plugin::Metric::CLI::Graphite
|
44
|
+
include Sensu::Plugin::Utils
|
45
|
+
|
44
46
|
option :scheme,
|
45
47
|
description: 'Metric naming scheme, text to prepend to metric',
|
46
48
|
short: '-s SCHEME',
|
@@ -98,7 +100,6 @@ class LDAPGraphite < Sensu::Plugin::Metric::CLI::Graphite
|
|
98
100
|
|
99
101
|
begin
|
100
102
|
if ldap.bind
|
101
|
-
message = 'So far'
|
102
103
|
metrics = {
|
103
104
|
conn_total: {
|
104
105
|
title: 'connections.total',
|
@@ -131,8 +132,8 @@ class LDAPGraphite < Sensu::Plugin::Metric::CLI::Graphite
|
|
131
132
|
attribute: 'monitorCounter'
|
132
133
|
}
|
133
134
|
}
|
134
|
-
monitor_ops = %w
|
135
|
-
%w
|
135
|
+
monitor_ops = %w[add modify delete search compare bind unbind]
|
136
|
+
%w[initiated completed].each do |state|
|
136
137
|
monitor_ops.each do |op|
|
137
138
|
metrics["ops_#{op}_#{state}".to_sym] = {
|
138
139
|
title: "operations.#{op}.#{state}",
|
@@ -149,7 +150,7 @@ class LDAPGraphite < Sensu::Plugin::Metric::CLI::Graphite
|
|
149
150
|
metric[:value] = entry[metric[:attribute]]
|
150
151
|
end
|
151
152
|
end
|
152
|
-
return metrics
|
153
|
+
return metrics # rubocop:disable Style/RedundantReturn
|
153
154
|
else
|
154
155
|
message = "Cannot connect to #{host}:#{config[:port]}"
|
155
156
|
if config[:user]
|
@@ -158,7 +159,7 @@ class LDAPGraphite < Sensu::Plugin::Metric::CLI::Graphite
|
|
158
159
|
critical message
|
159
160
|
end
|
160
161
|
end
|
161
|
-
rescue
|
162
|
+
rescue StandardError
|
162
163
|
message = "Cannot connect to #{host}:#{config[:port]}"
|
163
164
|
message += " as #{config[:user]}"
|
164
165
|
critical message
|
metadata
CHANGED
@@ -1,85 +1,85 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: sensu-plugins-openldap
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version:
|
4
|
+
version: 2.0.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Sensu-Plugins and contributors
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date:
|
11
|
+
date: 2020-06-22 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
|
-
name:
|
14
|
+
name: net-ldap
|
15
15
|
requirement: !ruby/object:Gem::Requirement
|
16
16
|
requirements:
|
17
|
-
- -
|
17
|
+
- - '='
|
18
18
|
- !ruby/object:Gem::Version
|
19
|
-
version:
|
19
|
+
version: 0.16.2
|
20
20
|
type: :runtime
|
21
21
|
prerelease: false
|
22
22
|
version_requirements: !ruby/object:Gem::Requirement
|
23
23
|
requirements:
|
24
|
-
- -
|
24
|
+
- - '='
|
25
25
|
- !ruby/object:Gem::Version
|
26
|
-
version:
|
26
|
+
version: 0.16.2
|
27
27
|
- !ruby/object:Gem::Dependency
|
28
|
-
name:
|
28
|
+
name: sensu-plugin
|
29
29
|
requirement: !ruby/object:Gem::Requirement
|
30
30
|
requirements:
|
31
|
-
- -
|
31
|
+
- - "~>"
|
32
32
|
- !ruby/object:Gem::Version
|
33
|
-
version: '0
|
33
|
+
version: '4.0'
|
34
34
|
type: :runtime
|
35
35
|
prerelease: false
|
36
36
|
version_requirements: !ruby/object:Gem::Requirement
|
37
37
|
requirements:
|
38
|
-
- -
|
38
|
+
- - "~>"
|
39
39
|
- !ruby/object:Gem::Version
|
40
|
-
version: '0
|
40
|
+
version: '4.0'
|
41
41
|
- !ruby/object:Gem::Dependency
|
42
42
|
name: bundler
|
43
43
|
requirement: !ruby/object:Gem::Requirement
|
44
44
|
requirements:
|
45
45
|
- - "~>"
|
46
46
|
- !ruby/object:Gem::Version
|
47
|
-
version: '1
|
47
|
+
version: '2.1'
|
48
48
|
type: :development
|
49
49
|
prerelease: false
|
50
50
|
version_requirements: !ruby/object:Gem::Requirement
|
51
51
|
requirements:
|
52
52
|
- - "~>"
|
53
53
|
- !ruby/object:Gem::Version
|
54
|
-
version: '1
|
54
|
+
version: '2.1'
|
55
55
|
- !ruby/object:Gem::Dependency
|
56
56
|
name: codeclimate-test-reporter
|
57
57
|
requirement: !ruby/object:Gem::Requirement
|
58
58
|
requirements:
|
59
59
|
- - "~>"
|
60
60
|
- !ruby/object:Gem::Version
|
61
|
-
version: '0
|
61
|
+
version: '1.0'
|
62
62
|
type: :development
|
63
63
|
prerelease: false
|
64
64
|
version_requirements: !ruby/object:Gem::Requirement
|
65
65
|
requirements:
|
66
66
|
- - "~>"
|
67
67
|
- !ruby/object:Gem::Version
|
68
|
-
version: '0
|
68
|
+
version: '1.0'
|
69
69
|
- !ruby/object:Gem::Dependency
|
70
70
|
name: github-markup
|
71
71
|
requirement: !ruby/object:Gem::Requirement
|
72
72
|
requirements:
|
73
73
|
- - "~>"
|
74
74
|
- !ruby/object:Gem::Version
|
75
|
-
version: '
|
75
|
+
version: '3.0'
|
76
76
|
type: :development
|
77
77
|
prerelease: false
|
78
78
|
version_requirements: !ruby/object:Gem::Requirement
|
79
79
|
requirements:
|
80
80
|
- - "~>"
|
81
81
|
- !ruby/object:Gem::Version
|
82
|
-
version: '
|
82
|
+
version: '3.0'
|
83
83
|
- !ruby/object:Gem::Dependency
|
84
84
|
name: pry
|
85
85
|
requirement: !ruby/object:Gem::Requirement
|
@@ -100,14 +100,14 @@ dependencies:
|
|
100
100
|
requirements:
|
101
101
|
- - "~>"
|
102
102
|
- !ruby/object:Gem::Version
|
103
|
-
version: '
|
103
|
+
version: '13.0'
|
104
104
|
type: :development
|
105
105
|
prerelease: false
|
106
106
|
version_requirements: !ruby/object:Gem::Requirement
|
107
107
|
requirements:
|
108
108
|
- - "~>"
|
109
109
|
- !ruby/object:Gem::Version
|
110
|
-
version: '
|
110
|
+
version: '13.0'
|
111
111
|
- !ruby/object:Gem::Dependency
|
112
112
|
name: redcarpet
|
113
113
|
requirement: !ruby/object:Gem::Requirement
|
@@ -123,33 +123,33 @@ dependencies:
|
|
123
123
|
- !ruby/object:Gem::Version
|
124
124
|
version: '3.2'
|
125
125
|
- !ruby/object:Gem::Dependency
|
126
|
-
name:
|
126
|
+
name: rspec
|
127
127
|
requirement: !ruby/object:Gem::Requirement
|
128
128
|
requirements:
|
129
129
|
- - "~>"
|
130
130
|
- !ruby/object:Gem::Version
|
131
|
-
version:
|
131
|
+
version: '3.4'
|
132
132
|
type: :development
|
133
133
|
prerelease: false
|
134
134
|
version_requirements: !ruby/object:Gem::Requirement
|
135
135
|
requirements:
|
136
136
|
- - "~>"
|
137
137
|
- !ruby/object:Gem::Version
|
138
|
-
version:
|
138
|
+
version: '3.4'
|
139
139
|
- !ruby/object:Gem::Dependency
|
140
|
-
name:
|
140
|
+
name: rubocop
|
141
141
|
requirement: !ruby/object:Gem::Requirement
|
142
142
|
requirements:
|
143
|
-
- -
|
143
|
+
- - '='
|
144
144
|
- !ruby/object:Gem::Version
|
145
|
-
version: '
|
145
|
+
version: '0.81'
|
146
146
|
type: :development
|
147
147
|
prerelease: false
|
148
148
|
version_requirements: !ruby/object:Gem::Requirement
|
149
149
|
requirements:
|
150
|
-
- -
|
150
|
+
- - '='
|
151
151
|
- !ruby/object:Gem::Version
|
152
|
-
version: '
|
152
|
+
version: '0.81'
|
153
153
|
- !ruby/object:Gem::Dependency
|
154
154
|
name: yard
|
155
155
|
requirement: !ruby/object:Gem::Requirement
|
@@ -197,7 +197,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
197
197
|
requirements:
|
198
198
|
- - ">="
|
199
199
|
- !ruby/object:Gem::Version
|
200
|
-
version: 2.
|
200
|
+
version: '2.3'
|
201
201
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
202
202
|
requirements:
|
203
203
|
- - ">="
|
@@ -205,7 +205,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
205
205
|
version: '0'
|
206
206
|
requirements: []
|
207
207
|
rubyforge_project:
|
208
|
-
rubygems_version: 2.
|
208
|
+
rubygems_version: 2.7.7
|
209
209
|
signing_key:
|
210
210
|
specification_version: 4
|
211
211
|
summary: Sensu plugins for OpenLDAP
|