smart_proxy_monitoring 0.1.2 → 0.3.0
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 +4 -4
- data/lib/smart_proxy_monitoring/monitoring_api.rb +4 -1
- data/lib/smart_proxy_monitoring/monitoring_plugin.rb +3 -2
- data/lib/smart_proxy_monitoring/version.rb +1 -1
- data/lib/smart_proxy_monitoring_common/monitoring_common.rb +25 -1
- data/lib/smart_proxy_monitoring_icinga2/icinga2_api_observer.rb +10 -13
- data/lib/smart_proxy_monitoring_icinga2/icinga2_client.rb +8 -7
- data/lib/smart_proxy_monitoring_icinga2/icinga2_initial_importer.rb +9 -7
- data/lib/smart_proxy_monitoring_icinga2/icinga2_result_uploader.rb +4 -6
- data/lib/smart_proxy_monitoring_icinga2/icinga2_upload_queue.rb +0 -2
- data/lib/smart_proxy_monitoring_icinga2/monitoring_icinga2_main.rb +31 -25
- data/lib/smart_proxy_monitoring_icinga2/monitoring_icinga2_plugin.rb +5 -0
- data/lib/smart_proxy_monitoring_icingadirector/director_client.rb +4 -3
- data/lib/smart_proxy_monitoring_icingadirector/monitoring_icingadirector_main.rb +2 -2
- data/lib/smart_proxy_monitoring_icingadirector/monitoring_icingadirector_plugin.rb +3 -0
- metadata +14 -54
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: f5e92e5a9af2685d4f89adfae0b8327a53223a268a0eb1aee13957e8aac0311a
|
4
|
+
data.tar.gz: cd1edae1deef86f472486288c8cacac30608b493eab7bb6aad2c0d495dac303b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 8acc9f33e0def4e55a560362df6e1e6ca4e7fbaf5d7513c3013757109753b30bc57db0574ae1aaefb8d937941570e243e271aac92661122eadcb92e4ca25712a
|
7
|
+
data.tar.gz: b2c3fbe6a6d4441ecb7657669283ac29d1785a75a4c2a0d59cabe7b3112a33d0b30f24e7f5480905bcc113e7eb05e4a51586eb506c6c716f88567f6707376e92
|
@@ -58,11 +58,14 @@ module Proxy::Monitoring
|
|
58
58
|
comment = params[:comment] || 'triggered by foreman'
|
59
59
|
start_time = params[:start_time] || Time.now.to_i
|
60
60
|
end_time = params[:end_time] || (Time.now.to_i + (24 * 3600))
|
61
|
+
all_services = params[:all_services].to_s == 'true'
|
61
62
|
|
62
63
|
log_provider_errors do
|
63
64
|
validate_dns_name!(host)
|
64
65
|
host = strip_domain(host)
|
65
66
|
|
67
|
+
server.set_downtime_host(host, author, comment, start_time, end_time, all_services: all_services)
|
68
|
+
rescue ArgumentError
|
66
69
|
server.set_downtime_host(host, author, comment, start_time, end_time)
|
67
70
|
end
|
68
71
|
end
|
@@ -92,7 +95,7 @@ module Proxy::Monitoring
|
|
92
95
|
end
|
93
96
|
|
94
97
|
def validate_dns_name!(name)
|
95
|
-
raise Proxy::Monitoring::Error
|
98
|
+
raise Proxy::Monitoring::Error, "Invalid DNS name #{name}" unless /^([a-zA-Z0-9]([-a-zA-Z0-9]+)?\.?)+$/.match?(name)
|
96
99
|
end
|
97
100
|
|
98
101
|
def strip_domain(name)
|
@@ -11,9 +11,10 @@ module Proxy::Monitoring
|
|
11
11
|
uses_provider
|
12
12
|
default_settings use_provider: 'monitoring_icinga2'
|
13
13
|
default_settings collect_status: true
|
14
|
+
expose_setting :collect_status
|
15
|
+
expose_setting :strip_domain
|
14
16
|
|
15
|
-
|
16
|
-
https_rackup_path File.expand_path('monitoring_http_config.ru', File.expand_path('../', __FILE__))
|
17
|
+
rackup_path File.expand_path('monitoring_http_config.ru', __dir__)
|
17
18
|
|
18
19
|
load_classes ::Proxy::Monitoring::ConfigurationLoader
|
19
20
|
end
|
@@ -3,5 +3,29 @@ module Proxy::Monitoring
|
|
3
3
|
class NotFound < RuntimeError; end
|
4
4
|
class AuthenticationError < RuntimeError; end
|
5
5
|
|
6
|
-
class Provider
|
6
|
+
class Provider
|
7
|
+
def query_host(host)
|
8
|
+
raise NotImplementedError
|
9
|
+
end
|
10
|
+
|
11
|
+
def create_host(host, attributes)
|
12
|
+
raise NotImplementedError
|
13
|
+
end
|
14
|
+
|
15
|
+
def update_host(host, attributes)
|
16
|
+
raise NotImplementedError
|
17
|
+
end
|
18
|
+
|
19
|
+
def remove_host(host)
|
20
|
+
raise NotImplementedError
|
21
|
+
end
|
22
|
+
|
23
|
+
def remove_downtime_host(host, author, comment)
|
24
|
+
raise NotImplementedError
|
25
|
+
end
|
26
|
+
|
27
|
+
def set_downtime_host(host, author, comment, start_time, end_time, all_services: nil, **)
|
28
|
+
raise NotImplementedError
|
29
|
+
end
|
30
|
+
end
|
7
31
|
end
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'thread'
|
2
1
|
require 'socket'
|
3
2
|
require 'json'
|
4
3
|
|
@@ -24,19 +23,17 @@ module ::Proxy::Monitoring::Icinga2
|
|
24
23
|
logger.info 'Icinga event api monitoring started.'
|
25
24
|
|
26
25
|
while line = ssl_socket.gets
|
27
|
-
next unless line
|
26
|
+
next unless line[0] == '{'
|
28
27
|
|
29
28
|
with_event_counter('Icinga2 Event API Monitor') do
|
30
|
-
|
31
|
-
|
32
|
-
|
33
|
-
|
34
|
-
logger.error 'Queue was full. Flushing. Events were lost.'
|
35
|
-
end
|
36
|
-
@queue.push(parsed)
|
37
|
-
rescue JSON::ParserError => e
|
38
|
-
logger.error "Icinga2 Event API Monitor: Malformed JSON: #{e.message}"
|
29
|
+
parsed = JSON.parse(line)
|
30
|
+
if @queue.size > 100_000
|
31
|
+
@queue.clear
|
32
|
+
logger.error 'Queue was full. Flushing. Events were lost.'
|
39
33
|
end
|
34
|
+
@queue.push(parsed)
|
35
|
+
rescue JSON::ParserError => e
|
36
|
+
logger.error "Icinga2 Event API Monitor: Malformed JSON: #{e.message}"
|
40
37
|
end
|
41
38
|
|
42
39
|
end
|
@@ -51,7 +48,7 @@ module ::Proxy::Monitoring::Icinga2
|
|
51
48
|
sleep 1
|
52
49
|
retry
|
53
50
|
ensure
|
54
|
-
ssl_socket
|
51
|
+
ssl_socket&.sysclose
|
55
52
|
end
|
56
53
|
|
57
54
|
def do_start
|
@@ -61,7 +58,7 @@ module ::Proxy::Monitoring::Icinga2
|
|
61
58
|
end
|
62
59
|
|
63
60
|
def stop
|
64
|
-
@thread
|
61
|
+
@thread&.terminate
|
65
62
|
end
|
66
63
|
end
|
67
64
|
end
|
@@ -1,7 +1,6 @@
|
|
1
1
|
require 'json'
|
2
2
|
require 'uri'
|
3
3
|
require 'rest-client'
|
4
|
-
require 'thread'
|
5
4
|
require 'socket'
|
6
5
|
require 'base64'
|
7
6
|
|
@@ -10,36 +9,36 @@ module ::Proxy::Monitoring::Icinga2
|
|
10
9
|
class << self
|
11
10
|
def client(request_url)
|
12
11
|
headers = {
|
13
|
-
'Accept' => 'application/json'
|
12
|
+
'Accept' => 'application/json',
|
14
13
|
}
|
15
14
|
|
16
15
|
options = {
|
17
16
|
headers: headers,
|
18
17
|
user: user,
|
19
18
|
ssl_ca_file: cacert,
|
20
|
-
verify_ssl: ssl
|
19
|
+
verify_ssl: ssl,
|
21
20
|
}
|
22
21
|
|
23
22
|
auth_options = if certificate_request?
|
24
23
|
{
|
25
24
|
ssl_client_cert: cert,
|
26
|
-
ssl_client_key: key
|
25
|
+
ssl_client_key: key,
|
27
26
|
}
|
28
27
|
else
|
29
28
|
{
|
30
|
-
password: password
|
29
|
+
password: password,
|
31
30
|
}
|
32
31
|
end
|
33
32
|
options.merge!(auth_options)
|
34
33
|
|
35
34
|
RestClient::Resource.new(
|
36
|
-
[baseurl, request_url].join
|
35
|
+
[baseurl, request_url].join,
|
37
36
|
options
|
38
37
|
)
|
39
38
|
end
|
40
39
|
|
41
40
|
def events_socket(endpoint)
|
42
|
-
uri = URI.parse([baseurl, endpoint].join
|
41
|
+
uri = URI.parse([baseurl, endpoint].join)
|
43
42
|
socket = TCPSocket.new(uri.host, uri.port)
|
44
43
|
|
45
44
|
ssl_context = OpenSSL::SSL::SSLContext.new
|
@@ -90,12 +89,14 @@ module ::Proxy::Monitoring::Icinga2
|
|
90
89
|
def cert
|
91
90
|
file = Proxy::Monitoring::Icinga2::Plugin.settings.api_usercert
|
92
91
|
return unless !file.nil? && File.file?(file)
|
92
|
+
|
93
93
|
OpenSSL::X509::Certificate.new(File.read(file))
|
94
94
|
end
|
95
95
|
|
96
96
|
def key
|
97
97
|
file = Proxy::Monitoring::Icinga2::Plugin.settings.api_userkey
|
98
98
|
return unless !file.nil? && File.file?(file)
|
99
|
+
|
99
100
|
OpenSSL::PKey::RSA.new(File.read(file))
|
100
101
|
end
|
101
102
|
|
@@ -1,4 +1,3 @@
|
|
1
|
-
require 'thread'
|
2
1
|
require 'socket'
|
3
2
|
require 'json'
|
4
3
|
|
@@ -35,14 +34,15 @@ module ::Proxy::Monitoring::Icinga2
|
|
35
34
|
results = Icinga2Client.get('/objects/hosts?attrs=name&attrs=last_check_result&attrs=acknowledgement')
|
36
35
|
results = JSON.parse(results)
|
37
36
|
results['results'].each do |result|
|
38
|
-
next if result['attrs']['last_check_result']
|
37
|
+
next if result['attrs']['last_check_result'].nil?
|
38
|
+
|
39
39
|
parsed = {
|
40
40
|
host: result['attrs']['name'],
|
41
41
|
result: result['attrs']['last_check_result']['state'],
|
42
42
|
timestamp: result['attrs']['last_check_result']['schedule_end'],
|
43
43
|
acknowledged: (result['attrs']['acknowledgement'] != 0),
|
44
44
|
initial: true,
|
45
|
-
type: '_parsed'
|
45
|
+
type: '_parsed',
|
46
46
|
}
|
47
47
|
@queue.push(parsed)
|
48
48
|
end
|
@@ -52,7 +52,8 @@ module ::Proxy::Monitoring::Icinga2
|
|
52
52
|
results = Icinga2Client.get('/objects/services?attrs=name&attrs=last_check_result&attrs=acknowledgement&attrs=host_name')
|
53
53
|
results = JSON.parse(results)
|
54
54
|
results['results'].each do |result|
|
55
|
-
next if result['attrs']['last_check_result']
|
55
|
+
next if result['attrs']['last_check_result'].nil?
|
56
|
+
|
56
57
|
parsed = {
|
57
58
|
host: result['attrs']['host_name'],
|
58
59
|
service: result['attrs']['name'],
|
@@ -60,7 +61,7 @@ module ::Proxy::Monitoring::Icinga2
|
|
60
61
|
timestamp: result['attrs']['last_check_result']['schedule_end'],
|
61
62
|
acknowledged: (result['attrs']['acknowledgement'] != 0),
|
62
63
|
initial: true,
|
63
|
-
type: '_parsed'
|
64
|
+
type: '_parsed',
|
64
65
|
}
|
65
66
|
@queue.push(parsed)
|
66
67
|
end
|
@@ -71,12 +72,13 @@ module ::Proxy::Monitoring::Icinga2
|
|
71
72
|
results = JSON.parse(results)
|
72
73
|
results['results'].each do |result|
|
73
74
|
next unless result['attrs']['trigger_time'] != 0
|
75
|
+
|
74
76
|
parsed = {
|
75
77
|
host: result['attrs']['host_name'],
|
76
78
|
service: result['attrs']['service_name'],
|
77
79
|
downtime: true,
|
78
80
|
initial: true,
|
79
|
-
type: '_parsed'
|
81
|
+
type: '_parsed',
|
80
82
|
}
|
81
83
|
@queue.push(parsed)
|
82
84
|
end
|
@@ -89,7 +91,7 @@ module ::Proxy::Monitoring::Icinga2
|
|
89
91
|
end
|
90
92
|
|
91
93
|
def stop
|
92
|
-
@thread
|
94
|
+
@thread&.terminate
|
93
95
|
end
|
94
96
|
|
95
97
|
private
|
@@ -1,9 +1,7 @@
|
|
1
|
-
require 'thread'
|
2
|
-
|
3
1
|
module ::Proxy::Monitoring::Icinga2
|
4
2
|
class MonitoringResult < Proxy::HttpRequest::ForemanRequest
|
5
3
|
def push_result(result)
|
6
|
-
send_request(request_factory.create_post('api/monitoring_results', result))
|
4
|
+
send_request(request_factory.create_post('api/v2/monitoring_results', result))
|
7
5
|
end
|
8
6
|
end
|
9
7
|
|
@@ -60,7 +58,7 @@ module ::Proxy::Monitoring::Icinga2
|
|
60
58
|
rescue Errno::ECONNREFUSED => e
|
61
59
|
logger.error "Foreman refused connection when tried to upload monitoring result: #{e.message}"
|
62
60
|
sleep 10
|
63
|
-
rescue => e
|
61
|
+
rescue StandardError => e
|
64
62
|
logger.error "Error while uploading monitoring results to Foreman: #{e.message}"
|
65
63
|
sleep 1
|
66
64
|
retry
|
@@ -76,13 +74,13 @@ module ::Proxy::Monitoring::Icinga2
|
|
76
74
|
end
|
77
75
|
|
78
76
|
def stop
|
79
|
-
@thread
|
77
|
+
@thread&.terminate
|
80
78
|
end
|
81
79
|
|
82
80
|
private
|
83
81
|
|
84
82
|
def symbolize_keys_deep!(h)
|
85
|
-
h.
|
83
|
+
h.each_key do |k|
|
86
84
|
ks = k.to_sym
|
87
85
|
h[ks] = h.delete k
|
88
86
|
symbolize_keys_deep! h[ks] if h[ks].is_a? Hash
|
@@ -5,7 +5,7 @@ module Proxy::Monitoring::Icinga2
|
|
5
5
|
include Proxy::Log
|
6
6
|
include Proxy::Util
|
7
7
|
|
8
|
-
ICINGA_HOST_ATTRS = %w
|
8
|
+
ICINGA_HOST_ATTRS = %w[display_name address address6 templates].freeze
|
9
9
|
|
10
10
|
ICINGA_ATTR_MAPPING = {
|
11
11
|
'ip' => 'address',
|
@@ -39,7 +39,7 @@ module Proxy::Monitoring::Icinga2
|
|
39
39
|
result.to_json
|
40
40
|
end
|
41
41
|
|
42
|
-
|
42
|
+
def remove_host(host)
|
43
43
|
request_url = "/objects/hosts/#{host}?cascade=1"
|
44
44
|
|
45
45
|
result = with_errorhandling("Remove #{host}") do
|
@@ -49,8 +49,13 @@ module Proxy::Monitoring::Icinga2
|
|
49
49
|
end
|
50
50
|
|
51
51
|
def remove_downtime_host(host, author, comment)
|
52
|
-
request_url = "/actions/remove-downtime
|
53
|
-
data = {
|
52
|
+
request_url = "/actions/remove-downtime"
|
53
|
+
data = {
|
54
|
+
type: 'Host',
|
55
|
+
filter: "host.name==\"#{host}\"",
|
56
|
+
author: author,
|
57
|
+
comment: comment,
|
58
|
+
}
|
54
59
|
|
55
60
|
result = with_errorhandling("Remove downtime from #{host}") do
|
56
61
|
Icinga2Client.post(request_url, data.to_json)
|
@@ -58,15 +63,18 @@ module Proxy::Monitoring::Icinga2
|
|
58
63
|
result.to_json
|
59
64
|
end
|
60
65
|
|
61
|
-
def set_downtime_host(host, author, comment, start_time, end_time)
|
62
|
-
request_url = "/actions/schedule-downtime
|
66
|
+
def set_downtime_host(host, author, comment, start_time, end_time, all_services: nil, **)
|
67
|
+
request_url = "/actions/schedule-downtime"
|
63
68
|
data = {
|
69
|
+
'type' => 'Host',
|
70
|
+
'filter' => "host.name==\"#{host}\"",
|
64
71
|
'author' => author,
|
65
72
|
'comment' => comment,
|
66
73
|
'start_time' => start_time,
|
67
74
|
'end_time' => end_time,
|
68
|
-
'duration' => 1000
|
75
|
+
'duration' => 1000,
|
69
76
|
}
|
77
|
+
data['all_services'] = all_services unless all_services.nil?
|
70
78
|
|
71
79
|
result = with_errorhandling("Set downtime on #{host}") do
|
72
80
|
Icinga2Client.post(request_url, data.to_json)
|
@@ -76,15 +84,11 @@ module Proxy::Monitoring::Icinga2
|
|
76
84
|
|
77
85
|
private
|
78
86
|
|
79
|
-
def uri_encode_filter(filter)
|
80
|
-
URI.encode(filter)
|
81
|
-
end
|
82
|
-
|
83
87
|
def host_attributes(host, data)
|
84
88
|
attributes = {}
|
85
89
|
|
86
90
|
data['templates'].delete(host)
|
87
|
-
data.delete('templates') if data['templates'] == [
|
91
|
+
data.delete('templates') if data['templates'] == ['foreman-host']
|
88
92
|
if data['vars'].nil?
|
89
93
|
data.delete('vars')
|
90
94
|
else
|
@@ -102,7 +106,7 @@ module Proxy::Monitoring::Icinga2
|
|
102
106
|
def host_data(attributes)
|
103
107
|
data = {}
|
104
108
|
|
105
|
-
data['templates'] = [
|
109
|
+
data['templates'] = ['foreman-host'] unless attributes.key?('templates')
|
106
110
|
data['attrs'] = {}
|
107
111
|
|
108
112
|
attributes.each do |key, value|
|
@@ -119,31 +123,33 @@ module Proxy::Monitoring::Icinga2
|
|
119
123
|
logger.debug "Monitoring - Action successful: #{action}"
|
120
124
|
result = JSON.parse(response.body)
|
121
125
|
if result.key?('error') && result['status'] == "No objects found."
|
122
|
-
raise Proxy::Monitoring::NotFound
|
126
|
+
raise Proxy::Monitoring::NotFound, "Icinga server at #{::Proxy::Monitoring::Icinga2::Plugin.settings.server} returned no objects found."
|
123
127
|
end
|
128
|
+
|
124
129
|
unless result.key?('results')
|
125
130
|
logger.error "Invalid Icinga result or result with errors: #{result.inspect}"
|
126
|
-
raise Proxy::Monitoring::Error
|
131
|
+
raise Proxy::Monitoring::Error, "Icinga server at #{::Proxy::Monitoring::Icinga2::Plugin.settings.server} returned an invalid result."
|
127
132
|
end
|
128
133
|
unless result['results'].first
|
129
|
-
raise Proxy::Monitoring::NotFound
|
134
|
+
raise Proxy::Monitoring::NotFound, "Icinga server at #{::Proxy::Monitoring::Icinga2::Plugin.settings.server} returned an empty result."
|
130
135
|
end
|
131
136
|
if result['results'][0]['code'] && result['results'][0]['code'] != 200
|
132
|
-
raise Proxy::Monitoring::Error
|
137
|
+
raise Proxy::Monitoring::Error, "Icinga server at #{::Proxy::Monitoring::Icinga2::Plugin.settings.server} returned an error: #{result['results'][0]['code']} #{result['results'][0]['status']}"
|
133
138
|
end
|
139
|
+
|
134
140
|
result
|
135
141
|
rescue JSON::ParserError => e
|
136
|
-
raise Proxy::Monitoring::Error
|
142
|
+
raise Proxy::Monitoring::Error, "Icinga server at #{::Proxy::Monitoring::Icinga2::Plugin.settings.server} returned invalid JSON: '#{e.message}'"
|
137
143
|
rescue RestClient::Unauthorized => e
|
138
|
-
raise Proxy::Monitoring::AuthenticationError
|
144
|
+
raise Proxy::Monitoring::AuthenticationError, "Error authenicating to Icinga server at #{::Proxy::Monitoring::Icinga2::Plugin.settings.server}: #{e.message}."
|
139
145
|
rescue RestClient::ResourceNotFound => e
|
140
|
-
raise Proxy::Monitoring::NotFound
|
146
|
+
raise Proxy::Monitoring::NotFound, "Icinga server at #{::Proxy::Monitoring::Icinga2::Plugin.settings.server} returned: #{e.message}."
|
141
147
|
rescue RestClient::Exception => e
|
142
|
-
raise Proxy::Monitoring::Error
|
143
|
-
rescue Errno::ECONNREFUSED
|
144
|
-
raise Proxy::Monitoring::ConnectionError
|
145
|
-
rescue SocketError
|
146
|
-
raise Proxy::Monitoring::ConnectionError
|
148
|
+
raise Proxy::Monitoring::Error, "Icinga server at #{::Proxy::Monitoring::Icinga2::Plugin.settings.server} returned an error: '#{e.response}'"
|
149
|
+
rescue Errno::ECONNREFUSED
|
150
|
+
raise Proxy::Monitoring::ConnectionError, "Icinga server at #{::Proxy::Monitoring::Icinga2::Plugin.settings.server} is not responding"
|
151
|
+
rescue SocketError
|
152
|
+
raise Proxy::Monitoring::ConnectionError, "Icinga server '#{::Proxy::Monitoring::Icinga2::Plugin.settings.server}' is unknown"
|
147
153
|
end
|
148
154
|
end
|
149
155
|
end
|
@@ -5,6 +5,11 @@ module ::Proxy::Monitoring::Icinga2
|
|
5
5
|
default_settings server: 'localhost'
|
6
6
|
default_settings api_port: '5665'
|
7
7
|
default_settings verify_ssl: true
|
8
|
+
expose_setting :server
|
9
|
+
expose_setting :api_user
|
10
|
+
capability("config")
|
11
|
+
capability("downtime")
|
12
|
+
capability("status") unless Proxy::Monitoring::Plugin.settings.collect_status
|
8
13
|
|
9
14
|
requires :monitoring, ::Proxy::Monitoring::VERSION
|
10
15
|
|
@@ -54,12 +54,13 @@ module ::Proxy::Monitoring::IcingaDirector
|
|
54
54
|
{
|
55
55
|
headers: request_headers,
|
56
56
|
ssl_ca_file: cacert,
|
57
|
-
verify_ssl: verify_ssl
|
57
|
+
verify_ssl: verify_ssl?,
|
58
58
|
}.merge(auth_options)
|
59
59
|
end
|
60
60
|
|
61
61
|
def auth_options
|
62
62
|
return {} unless basic_auth?
|
63
|
+
|
63
64
|
{
|
64
65
|
user: user,
|
65
66
|
password: password,
|
@@ -72,7 +73,7 @@ module ::Proxy::Monitoring::IcingaDirector
|
|
72
73
|
|
73
74
|
def request_headers
|
74
75
|
{
|
75
|
-
'Accept' => 'application/json'
|
76
|
+
'Accept' => 'application/json',
|
76
77
|
}
|
77
78
|
end
|
78
79
|
|
@@ -90,7 +91,7 @@ module ::Proxy::Monitoring::IcingaDirector
|
|
90
91
|
end
|
91
92
|
|
92
93
|
def baseurl
|
93
|
-
Proxy::Monitoring::IcingaDirector::Plugin.settings.director_url
|
94
|
+
"#{Proxy::Monitoring::IcingaDirector::Plugin.settings.director_url}/"
|
94
95
|
end
|
95
96
|
|
96
97
|
def user
|
@@ -50,7 +50,7 @@ module Proxy::Monitoring::IcingaDirector
|
|
50
50
|
:address => attributes.delete('ip'),
|
51
51
|
:address6 => attributes.delete('ip6'),
|
52
52
|
:imports => attributes.delete('templates') || ['foreman_host'],
|
53
|
-
:vars => attributes
|
53
|
+
:vars => attributes,
|
54
54
|
}
|
55
55
|
end
|
56
56
|
|
@@ -63,7 +63,7 @@ module Proxy::Monitoring::IcingaDirector
|
|
63
63
|
'ip' => ip,
|
64
64
|
'ip6' => ip6,
|
65
65
|
}
|
66
|
-
result
|
66
|
+
result['templates'] = templates if templates != ['foreman_host']
|
67
67
|
result.merge!(response['vars'] || {})
|
68
68
|
result
|
69
69
|
end
|
@@ -3,6 +3,9 @@ module ::Proxy::Monitoring::IcingaDirector
|
|
3
3
|
plugin :monitoring_icingadirector, ::Proxy::Monitoring::VERSION
|
4
4
|
|
5
5
|
default_settings verify_ssl: true
|
6
|
+
expose_setting :director_url
|
7
|
+
expose_setting :director_user
|
8
|
+
capability("config")
|
6
9
|
|
7
10
|
requires :monitoring, ::Proxy::Monitoring::VERSION
|
8
11
|
requires :monitoring_icinga2, ::Proxy::Monitoring::VERSION
|
metadata
CHANGED
@@ -1,30 +1,16 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: smart_proxy_monitoring
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Timo Goebel
|
8
8
|
- Dirk Goetz
|
9
|
-
autorequire:
|
9
|
+
autorequire:
|
10
10
|
bindir: bin
|
11
11
|
cert_chain: []
|
12
|
-
date:
|
12
|
+
date: 2024-05-31 00:00:00.000000000 Z
|
13
13
|
dependencies:
|
14
|
-
- !ruby/object:Gem::Dependency
|
15
|
-
name: rest-client
|
16
|
-
requirement: !ruby/object:Gem::Requirement
|
17
|
-
requirements:
|
18
|
-
- - ">="
|
19
|
-
- !ruby/object:Gem::Version
|
20
|
-
version: '0'
|
21
|
-
type: :runtime
|
22
|
-
prerelease: false
|
23
|
-
version_requirements: !ruby/object:Gem::Requirement
|
24
|
-
requirements:
|
25
|
-
- - ">="
|
26
|
-
- !ruby/object:Gem::Version
|
27
|
-
version: '0'
|
28
14
|
- !ruby/object:Gem::Dependency
|
29
15
|
name: json
|
30
16
|
requirement: !ruby/object:Gem::Requirement
|
@@ -40,41 +26,13 @@ dependencies:
|
|
40
26
|
- !ruby/object:Gem::Version
|
41
27
|
version: '0'
|
42
28
|
- !ruby/object:Gem::Dependency
|
43
|
-
name:
|
44
|
-
requirement: !ruby/object:Gem::Requirement
|
45
|
-
requirements:
|
46
|
-
- - ">="
|
47
|
-
- !ruby/object:Gem::Version
|
48
|
-
version: '0'
|
49
|
-
type: :development
|
50
|
-
prerelease: false
|
51
|
-
version_requirements: !ruby/object:Gem::Requirement
|
52
|
-
requirements:
|
53
|
-
- - ">="
|
54
|
-
- !ruby/object:Gem::Version
|
55
|
-
version: '0'
|
56
|
-
- !ruby/object:Gem::Dependency
|
57
|
-
name: mocha
|
58
|
-
requirement: !ruby/object:Gem::Requirement
|
59
|
-
requirements:
|
60
|
-
- - ">="
|
61
|
-
- !ruby/object:Gem::Version
|
62
|
-
version: '0'
|
63
|
-
type: :development
|
64
|
-
prerelease: false
|
65
|
-
version_requirements: !ruby/object:Gem::Requirement
|
66
|
-
requirements:
|
67
|
-
- - ">="
|
68
|
-
- !ruby/object:Gem::Version
|
69
|
-
version: '0'
|
70
|
-
- !ruby/object:Gem::Dependency
|
71
|
-
name: test-unit
|
29
|
+
name: rest-client
|
72
30
|
requirement: !ruby/object:Gem::Requirement
|
73
31
|
requirements:
|
74
32
|
- - ">="
|
75
33
|
- !ruby/object:Gem::Version
|
76
34
|
version: '0'
|
77
|
-
type: :
|
35
|
+
type: :runtime
|
78
36
|
prerelease: false
|
79
37
|
version_requirements: !ruby/object:Gem::Requirement
|
80
38
|
requirements:
|
@@ -121,11 +79,11 @@ files:
|
|
121
79
|
- settings.d/monitoring.yml.example
|
122
80
|
- settings.d/monitoring_icinga2.yml.example
|
123
81
|
- settings.d/monitoring_icingadirector.yml.example
|
124
|
-
homepage:
|
82
|
+
homepage: https://github.com/theforeman/smart_proxy_monitoring
|
125
83
|
licenses:
|
126
|
-
-
|
84
|
+
- GPL-3.0
|
127
85
|
metadata: {}
|
128
|
-
post_install_message:
|
86
|
+
post_install_message:
|
129
87
|
rdoc_options: []
|
130
88
|
require_paths:
|
131
89
|
- lib
|
@@ -133,16 +91,18 @@ required_ruby_version: !ruby/object:Gem::Requirement
|
|
133
91
|
requirements:
|
134
92
|
- - ">="
|
135
93
|
- !ruby/object:Gem::Version
|
136
|
-
version: '
|
94
|
+
version: '2.7'
|
95
|
+
- - "<"
|
96
|
+
- !ruby/object:Gem::Version
|
97
|
+
version: '4'
|
137
98
|
required_rubygems_version: !ruby/object:Gem::Requirement
|
138
99
|
requirements:
|
139
100
|
- - ">="
|
140
101
|
- !ruby/object:Gem::Version
|
141
102
|
version: '0'
|
142
103
|
requirements: []
|
143
|
-
|
144
|
-
|
145
|
-
signing_key:
|
104
|
+
rubygems_version: 3.2.3
|
105
|
+
signing_key:
|
146
106
|
specification_version: 4
|
147
107
|
summary: Monitoring plug-in for Foreman's smart proxy
|
148
108
|
test_files: []
|