openldap_monitor_extractor 0.0.2 → 0.0.3
Sign up to get free protection for your applications and to get access to all the features.
data/.gitignore
CHANGED
@@ -8,7 +8,11 @@ require 'yaml'
|
|
8
8
|
require 'openldap_monitor_extractor'
|
9
9
|
|
10
10
|
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
puts OpenldapMonitorExtractor.get(:total_connections)
|
11
|
+
if ARGV[0] && File.exist?(ARGV[0])
|
12
|
+
|
13
|
+
config = YAML.load_file(ARGV[0])
|
14
|
+
puts OpenldapMonitorExtractor.configure(config).get(:total_connections)
|
15
|
+
else
|
16
|
+
|
17
|
+
puts "usage: #{$0} config_file.yml"
|
18
|
+
end
|
@@ -7,6 +7,8 @@ module OpenldapMonitorExtractor
|
|
7
7
|
|
8
8
|
class Connection
|
9
9
|
|
10
|
+
DEFAULT_MONITOR_BASE = "cn=Monitor"
|
11
|
+
|
10
12
|
attr_reader :connection
|
11
13
|
|
12
14
|
def self.builder(parameters={ })
|
@@ -21,7 +23,7 @@ module OpenldapMonitorExtractor
|
|
21
23
|
cparameters = {
|
22
24
|
:host =>uri.host,
|
23
25
|
:port =>uri.port,
|
24
|
-
:base =>
|
26
|
+
:base =>DEFAULT_MONITOR_BASE,
|
25
27
|
:auth =>auth
|
26
28
|
}
|
27
29
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require "ostruct"
|
2
1
|
require "openldap_monitor_extractor/version"
|
3
2
|
require "openldap_monitor_extractor/connection"
|
4
3
|
|
@@ -6,7 +5,6 @@ require "openldap_monitor_extractor/connection"
|
|
6
5
|
module OpenldapMonitorExtractor
|
7
6
|
extend self
|
8
7
|
|
9
|
-
|
10
8
|
MAPPER = {
|
11
9
|
:total_connections =>{ :dn =>"cn=Total,cn=Connections,cn=Monitor", :attribute =>:monitorcounter },
|
12
10
|
:referals_statistics =>{ :dn =>"cn=Referrals,cn=Statistics,cn=Monitor",:attribute =>:monitorcounter },
|
@@ -31,11 +29,16 @@ module OpenldapMonitorExtractor
|
|
31
29
|
KEYS = MAPPER.keys
|
32
30
|
|
33
31
|
def configure(config)
|
32
|
+
|
34
33
|
@connection ||= Connection.new(config).connection
|
34
|
+
|
35
|
+
self
|
35
36
|
end
|
36
37
|
|
37
38
|
def get(key)
|
38
39
|
|
40
|
+
raise StandardError.new("The key: #{key} do not exist") unless KEYS.include?(key)
|
41
|
+
|
39
42
|
dn = MAPPER[key][:dn]
|
40
43
|
attribute = MAPPER[key][:attribute]
|
41
44
|
|
metadata
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: openldap_monitor_extractor
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.0.
|
4
|
+
version: 0.0.3
|
5
5
|
prerelease:
|
6
6
|
platform: ruby
|
7
7
|
authors:
|
@@ -9,7 +9,7 @@ authors:
|
|
9
9
|
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date: 2013-05-
|
12
|
+
date: 2013-05-28 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
14
|
- !ruby/object:Gem::Dependency
|
15
15
|
name: net-ldap
|
@@ -110,7 +110,7 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
110
110
|
version: '0'
|
111
111
|
segments:
|
112
112
|
- 0
|
113
|
-
hash: -
|
113
|
+
hash: -566327192966787389
|
114
114
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
115
115
|
none: false
|
116
116
|
requirements:
|
@@ -119,7 +119,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
119
119
|
version: '0'
|
120
120
|
segments:
|
121
121
|
- 0
|
122
|
-
hash: -
|
122
|
+
hash: -566327192966787389
|
123
123
|
requirements: []
|
124
124
|
rubyforge_project:
|
125
125
|
rubygems_version: 1.8.25
|