nagios-promoo 0.0.1 → 0.0.2

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: 37eb72c6a72643b3f6cbd46813aefd70cc7ba0dc
4
- data.tar.gz: 15040ffff6884f1a2520cdaae33bcbcbe0a6bfd8
3
+ metadata.gz: 9043be237dc97ac7bdb31cfd4be73029353dc2c3
4
+ data.tar.gz: f172f315b3aad9bea0485b85ab96a2ab0a4b3933
5
5
  SHA512:
6
- metadata.gz: 21dc3378b775714ae7821dd33662361502ef80e65a1e3fd961b3d57298cb259839ba0fb9b818fd4a5e70a43b4c4e7f04cc98ce1677971e9856209ba1f73cd3b3
7
- data.tar.gz: 23a0400d4f4f12aa26f429da56bb1effe143eec86defbd87aa5c147a345490b6c5d42a7db4ae03154eae290488527055ea7c224cead96def6de38e5276e9cc29
6
+ metadata.gz: 22c9ff0527e02594d5091bb55ed3300a827b83b898041950440db851b7c7db659134858232ef26af7c164129cdd7fb6eebfdc9b1d0364957e93a4792e5ab39fd
7
+ data.tar.gz: 8c83796b632e84e248d1cccdf8f32c17a3078a41cc10996a9021c4e6c0c5deec24b21527902d2491d5cfd86f90ea44b603967f8b97086005de5b870c02841a63
data/README.md CHANGED
@@ -1,4 +1,4 @@
1
- # Nagios Probes for Monitoring OpenNebula and OCCI
1
+ # Nagios Probes for Monitoring OpenNebula and OCCI-enabled clouds
2
2
 
3
3
  ## Installation
4
4
 
@@ -24,6 +24,7 @@ class Nagios::Promoo::Occi::Probes::ComputeProbe < Nagios::Promoo::Occi::Probes:
24
24
  def runnable?; true; end
25
25
  end
26
26
 
27
+ CPU_SUM_WEIGHT = 1000
27
28
  COMPUTE_NAME_PREFIX = "sam-nagios-promoo"
28
29
  CACHE_DIR = '/tmp/nagios-promoo_cache'
29
30
  APPDB_PROXY_URL = 'https://appdb.egi.eu/api/proxy'
@@ -53,8 +54,8 @@ class Nagios::Promoo::Occi::Probes::ComputeProbe < Nagios::Promoo::Occi::Probes:
53
54
  compute = client(options).get_resource('compute')
54
55
  compute.title = compute.hostname = "#{COMPUTE_NAME_PREFIX}-#{Time.now.to_i}"
55
56
 
56
- compute.mixins << client(options).get_mixin(os_tpl, 'os_tpl', true)
57
- compute.mixins << client(options).get_mixin(resource_tpl, 'resource_tpl', true)
57
+ compute.mixins << get_mixin(os_tpl, 'os_tpl', options)
58
+ compute.mixins << get_mixin(resource_tpl, 'resource_tpl', options)
58
59
 
59
60
  link = client(options).create(compute)
60
61
  wait4compute(link, options)
@@ -73,6 +74,12 @@ class Nagios::Promoo::Occi::Probes::ComputeProbe < Nagios::Promoo::Occi::Probes:
73
74
  link
74
75
  end
75
76
 
77
+ def get_mixin(term, type, options)
78
+ mxn = client(options).get_mixin(term, type, true)
79
+ fail "Mixin #{term.inspect} of type #{type.inspect} not found at the site" unless mxn
80
+ mxn
81
+ end
82
+
76
83
  def wait4compute(link, options)
77
84
  state = 'inactive'
78
85
 
@@ -103,10 +110,12 @@ class Nagios::Promoo::Occi::Probes::ComputeProbe < Nagios::Promoo::Occi::Probes:
103
110
  end
104
111
 
105
112
  def appdb_appliance(options)
113
+ appliance = nil
106
114
  appliance = appdb_provider(options)['image'].select do |image|
107
115
  image['mp_uri'] && (normalize_mpuri(image['mp_uri']) == normalize_mpuri(options[:mpuri]))
108
- end.first
109
- fail "No such appliance is published in AppDB" if appliance.blank?
116
+ end.first if appdb_provider(options)['image']
117
+ fail "Site does not have an appliance with MPURI "\
118
+ "#{normalize_mpuri(options[:mpuri]).inspect} published in AppDB" if appliance.blank?
110
119
 
111
120
  appliance['va_provider_image_id'].split('#').last
112
121
  end
@@ -116,9 +125,9 @@ class Nagios::Promoo::Occi::Probes::ComputeProbe < Nagios::Promoo::Occi::Probes:
116
125
  appdb_provider(options)['template'].each do |template|
117
126
  sizes << [
118
127
  template['resource_name'].split('#').last,
119
- template['main_memory_size'].to_i + template['physical_cpus'].to_i
128
+ template['main_memory_size'].to_i + (template['physical_cpus'].to_i * CPU_SUM_WEIGHT)
120
129
  ]
121
- end
130
+ end if appdb_provider(options)['template']
122
131
  fail "No appliance sizes available in AppDB" if sizes.blank?
123
132
  sizes.sort! { |x,y| x.last <=> y.last }
124
133
 
@@ -1,5 +1,5 @@
1
1
  module Nagios
2
2
  module Promoo
3
- VERSION = "0.0.1"
3
+ VERSION = "0.0.2"
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: 0.0.1
4
+ version: 0.0.2
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Parak
8
8
  autorequire:
9
9
  bindir: bin
10
10
  cert_chain: []
11
- date: 2016-03-02 00:00:00.000000000 Z
11
+ date: 2016-03-04 00:00:00.000000000 Z
12
12
  dependencies:
13
13
  - !ruby/object:Gem::Dependency
14
14
  name: occi-api