nagios-promoo 1.3.1 → 1.4.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA1:
3
- metadata.gz: 78d3db9f61b715786ba4c92aa9765abb039dce86
4
- data.tar.gz: 26182500e7ebf442b5d11dfc16a4f6e628d0378e
3
+ metadata.gz: a2c15e3b9d6a452b5b7972c715f6e7ac5cbfcbea
4
+ data.tar.gz: d592f809c7b003a0ea38dfc9b17ea2293c7ca356
5
5
  SHA512:
6
- metadata.gz: d266be6dd777758936c001037c3e9b0b688a6010dc5805355ca1ebdfa5c7e0cd8c18dbdaad9be0a99d4e2e66c0f0330eea6c1a52864968e5aa0e5fdeb6e6dceb
7
- data.tar.gz: 0d88c5bcf26929ffe30d981ea3ec64f977ea40efabe8062f902dced1bcc5b322d5646adf615931202eae3d5be74618e16f1d2bf18b8d7742c4a3610c29a36fa2
6
+ metadata.gz: 47dff019a4bb3d36e8235ac3afa16eda38c14fb6abe0f26d2e502e52bf97275a0cb2c5ffd2f1637cf3380c1655dcdb85710e37f7a27d1656ec43f82547e78e21
7
+ data.tar.gz: 5b5eab6dee2fb3fd60725e4a312cf494a733fe78e804e87563be31e2315e748c9c191d0751a60bea025dc89f48ac820e4f0e1a59457a282e9b28a1cd81c21db2
@@ -12,13 +12,7 @@ module Nagios
12
12
  end
13
13
  end
14
14
 
15
- APPDB_PROXY_URL = 'https://appdb.egi.eu/api/proxy'.freeze
16
- APPDB_REQUEST_FORM = 'version=1.0&resource=broker&data=%3Cappdb%3Abroker%20xmlns%3Axs%3D%22http%3A%2F%2F' \
17
- 'www.w3.org%2F2001%2FXMLSchema%22%20xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2F' \
18
- 'XMLSchema-instance%22%20xmlns%3Aappdb%3D%22http%3A%2F%2Fappdb.egi.eu%2Fapi%2F1.0%2F' \
19
- 'appdb%22%3E%3Cappdb%3Arequest%20id%3D%22vaproviders%22%20method%3D%22GET%22%20' \
20
- 'resource%3D%22va_providers%22%3E%3Cappdb%3Aparam%20name%3D%22listmode%22%3Edetails' \
21
- '%3C%2Fappdb%3Aparam%3E%3C%2Fappdb%3Arequest%3E%3C%2Fappdb%3Abroker%3E'.freeze
15
+ APPDB_PROVIDERS_URL = 'https://appdb.egi.eu/rest/1.0/va_providers?listmode=details'.freeze
22
16
 
23
17
  attr_reader :options
24
18
 
@@ -40,20 +34,17 @@ module Nagios
40
34
  private
41
35
 
42
36
  def appdb_providers
43
- response = HTTParty.post(APPDB_PROXY_URL, body: APPDB_REQUEST_FORM)
37
+ response = HTTParty.get(APPDB_PROVIDERS_URL)
44
38
  raise "Could not get site details from AppDB [HTTP #{response.code}]" unless response.success?
45
39
  raise 'Response from AppDB has unexpected structure' unless valid_response?(response.parsed_response)
46
40
 
47
- providers = response.parsed_response['appdb:broker']['appdb:reply']\
48
- ['appdb:appdb']['virtualization:provider']
41
+ providers = response.parsed_response['appdb:appdb']['virtualization:provider']
49
42
  providers.delete_if { |prov| prov['provider:endpoint_url'].blank? }
50
43
  end
51
44
 
52
45
  def valid_response?(response)
53
- response['appdb:broker'] \
54
- && response['appdb:broker']['appdb:reply'] \
55
- && response['appdb:broker']['appdb:reply']['appdb:appdb'] \
56
- && response['appdb:broker']['appdb:reply']['appdb:appdb']['virtualization:provider']
46
+ response['appdb:appdb'] \
47
+ && response['appdb:appdb']['virtualization:provider']
57
48
  end
58
49
  end
59
50
  end
@@ -1,7 +1,7 @@
1
1
  module Nagios
2
2
  module Promoo
3
3
  module Appdb
4
- VERSION = '1.2.0'.freeze
4
+ VERSION = '1.2.1'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -16,7 +16,15 @@ module Nagios
16
16
 
17
17
  def options
18
18
  [
19
- [:mpuri, { type: :string, required: true, desc: 'AppDB MPURI referencing a virtual appliance' }],
19
+ [:appid, { type: :string, required: true, desc: 'AppDB ID referencing a virtual appliance' }],
20
+ [
21
+ :vo,
22
+ {
23
+ type: :string,
24
+ required: true,
25
+ desc: 'Virtual Organization name used to select the appropriate virtual appliance'
26
+ }
27
+ ],
20
28
  [
21
29
  :with_storage,
22
30
  {
@@ -45,15 +53,8 @@ module Nagios
45
53
  CPU_SUM_WEIGHT = 1000
46
54
  COMPUTE_NAME_PREFIX = 'sam-nagios-promoo'.freeze
47
55
  DEFAULT_STORAGE_SIZE = 1 # GB
48
- APPDB_PROXY_URL = 'https://appdb.egi.eu/api/proxy'.freeze
49
- APPDB_REQUEST_FORM = 'version=1.0&resource=broker&data=%3Cappdb%3Abroker%20xmlns' \
50
- '%3Axs%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXMLSchema%22%20' \
51
- 'xmlns%3Axsi%3D%22http%3A%2F%2Fwww.w3.org%2F2001%2FXML' \
52
- 'Schema-instance%22%20xmlns%3Aappdb%3D%22http%3A%2F%2F' \
53
- 'appdb.egi.eu%2Fapi%2F1.0%2Fappdb%22%3E%3Cappdb%3Arequest%20' \
54
- 'id%3D%22vaproviders%22%20method%3D%22GET%22%20resource%3D%22' \
55
- 'va_providers%22%3E%3Cappdb%3Aparam%20name%3D%22listmode%22%3E' \
56
- 'details%3C%2Fappdb%3Aparam%3E%3C%2Fappdb%3Arequest%3E%3C%2Fappdb%3Abroker%3E'.freeze
56
+
57
+ APPDB_PROVIDERS_URL = 'https://appdb.egi.eu/rest/1.0/va_providers?listmode=details'.freeze
57
58
 
58
59
  def run(_args = [])
59
60
  @_links = {}
@@ -181,14 +182,14 @@ module Nagios
181
182
 
182
183
  def appdb_appliance
183
184
  appliances = [appdb_provider['provider:image']].flatten.compact
184
- appliances.delete_if { |appl| appl['mp_uri'].blank? }
185
+ appliances.delete_if { |appl| appl['appid'].blank? }
185
186
 
186
187
  appliance = appliances.detect do |appl|
187
- normalize_mpuri(appl['mp_uri']) == normalize_mpuri(options[:mpuri])
188
+ appl['appid'] == options[:appid] && appl['voname'] == options[:vo]
188
189
  end
189
190
  if appliance.blank?
190
- raise 'Site does not have an appliance with MPURI '\
191
- "#{normalize_mpuri(options[:mpuri]).inspect} published in AppDB"
191
+ raise 'Site does not have an appliance with AppID '\
192
+ "#{options[:appid]} published in AppDB for VO #{options[:vo]}"
192
193
  end
193
194
 
194
195
  appliance['va_provider_image_id'].split('#').last
@@ -224,15 +225,14 @@ module Nagios
224
225
 
225
226
  def appdb_providers
226
227
  parsed_response = cache_fetch('appdb-sites', options[:cache_expiration]) do
227
- response = HTTParty.post(APPDB_PROXY_URL, body: APPDB_REQUEST_FORM)
228
+ response = HTTParty.get(APPDB_PROVIDERS_URL)
228
229
  raise "Could not get appliance details from AppDB [#{response.code}]" unless response.success?
229
230
  raise 'Response from AppDB has unexpected structure' unless valid_response?(response.parsed_response)
230
231
 
231
232
  response.parsed_response
232
233
  end
233
234
 
234
- providers = parsed_response['appdb:broker']['appdb:reply']\
235
- ['appdb:appdb']['virtualization:provider']
235
+ providers = parsed_response['appdb:appdb']['virtualization:provider']
236
236
  providers.delete_if { |prov| prov['provider:endpoint_url'].blank? }
237
237
  end
238
238
 
@@ -241,10 +241,8 @@ module Nagios
241
241
  end
242
242
 
243
243
  def valid_response?(response)
244
- response['appdb:broker'] \
245
- && response['appdb:broker']['appdb:reply'] \
246
- && response['appdb:broker']['appdb:reply']['appdb:appdb'] \
247
- && response['appdb:broker']['appdb:reply']['appdb:appdb']['virtualization:provider']
244
+ response['appdb:appdb'] \
245
+ && response['appdb:appdb']['virtualization:provider']
248
246
  end
249
247
 
250
248
  include Nagios::Promoo::Utils::Cache
@@ -1,7 +1,7 @@
1
1
  module Nagios
2
2
  module Promoo
3
3
  module Occi
4
- VERSION = '1.2.0'.freeze
4
+ VERSION = '1.3.0'.freeze
5
5
  end
6
6
  end
7
7
  end
@@ -1,5 +1,5 @@
1
1
  module Nagios
2
2
  module Promoo
3
- VERSION = '1.3.1'.freeze
3
+ VERSION = '1.4.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,14 +1,14 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nagios-promoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.3.1
4
+ version: 1.4.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Parak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2017-06-14 00:00:00.000000000 Z
11
+ date: 2017-08-24 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: occi-api
@@ -359,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
359
359
  version: '0'
360
360
  requirements: []
361
361
  rubyforge_project:
362
- rubygems_version: 2.6.8
362
+ rubygems_version: 2.6.12
363
363
  signing_key:
364
364
  specification_version: 4
365
365
  summary: Nagios Probes for Monitoring OpenNebula and OCCI