nagios-promoo 0.0.1 → 0.0.2
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/README.md +1 -1
- data/lib/nagios/promoo/occi/probes/compute_probe.rb +15 -6
- data/lib/nagios/promoo/version.rb +1 -1
- metadata +2 -2
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 9043be237dc97ac7bdb31cfd4be73029353dc2c3
|
4
|
+
data.tar.gz: f172f315b3aad9bea0485b85ab96a2ab0a4b3933
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 22c9ff0527e02594d5091bb55ed3300a827b83b898041950440db851b7c7db659134858232ef26af7c164129cdd7fb6eebfdc9b1d0364957e93a4792e5ab39fd
|
7
|
+
data.tar.gz: 8c83796b632e84e248d1cccdf8f32c17a3078a41cc10996a9021c4e6c0c5deec24b21527902d2491d5cfd86f90ea44b603967f8b97086005de5b870c02841a63
|
data/README.md
CHANGED
@@ -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 <<
|
57
|
-
compute.mixins <<
|
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 "
|
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
|
|
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.
|
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-
|
11
|
+
date: 2016-03-04 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: occi-api
|