nagios-promoo 1.0.0 → 1.1.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
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 03a43d2f650bc5bfa06dc735193c61b22ec16fba
|
4
|
+
data.tar.gz: f07fda7f6d2240c5e140509feeb05ab2b5c405d7
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 437c81a1847705426e476d597ed0e7744d463d3158c888db3b402340e374e1644ee74cc67c5782589f2719389e8fd950add0fa8ae2c3a28a73b9029e2b9fe8b4
|
7
|
+
data.tar.gz: 36d059ca5a98c910f570b1ae6ca376f25e104fb618f817f2931ee4f01f5406d77def52f9671ca33cbea62db23357af1a950fb9a84d9b329c75c2ca9388388349
|
@@ -11,8 +11,8 @@ class Nagios::Promoo::Appdb::Probes::VmcatcherProbe < Nagios::Promoo::Appdb::Pro
|
|
11
11
|
[
|
12
12
|
[:vo, { type: :string, required: true, desc: 'Virtual Organization name (used to select the appropriate VO-wide image list)' }],
|
13
13
|
[:token, { type: :string, required: true, desc: 'AppDB authentication token (used to access the VO-wide image list)' }],
|
14
|
-
[:
|
15
|
-
[:
|
14
|
+
[:warning_after, { type: :numeric, default: 24, desc: 'A number of hours after list publication when missing or outdated appliances raise WARNING' }],
|
15
|
+
[:critical_after, { type: :numeric, default: 72, desc: 'A number of hours after list publication when missing or outdated appliances raise CRITICAL' }],
|
16
16
|
]
|
17
17
|
end
|
18
18
|
|
@@ -31,22 +31,25 @@ class Nagios::Promoo::Appdb::Probes::VmcatcherProbe < Nagios::Promoo::Appdb::Pro
|
|
31
31
|
|
32
32
|
Timeout::timeout(options[:timeout]) { check_vmc_sync }
|
33
33
|
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
|
38
|
-
|
39
|
-
|
40
|
-
|
41
|
-
|
42
|
-
end
|
34
|
+
wrong = @_results[:missing] + @_results[:outdated]
|
35
|
+
if wrong.any?
|
36
|
+
if (@_last_update + options[:critical_after].hours) < Time.now
|
37
|
+
puts "VMCATCHER CRITICAL - Appliance(s) #{wrong.inspect} missing " \
|
38
|
+
"or outdated in #{options[:vo].inspect} " \
|
39
|
+
"more than #{options[:critical_after]} hours after list publication [#{@_last_update}]"
|
40
|
+
exit 2
|
41
|
+
end
|
43
42
|
|
44
|
-
|
45
|
-
|
46
|
-
|
43
|
+
if (@_last_update + options[:warning_after].hours) < Time.now
|
44
|
+
puts "VMCATCHER WARNING - Appliance(s) #{wrong.inspect} missing " \
|
45
|
+
"or outdated in #{options[:vo].inspect} " \
|
46
|
+
"more than #{options[:warning_after]} hours after list publication [#{@_last_update}]"
|
47
|
+
exit 1
|
48
|
+
end
|
47
49
|
end
|
48
50
|
|
49
|
-
puts "VMCATCHER OK - All appliances registered in #{options[:vo].inspect}
|
51
|
+
puts "VMCATCHER OK - All appliances registered in #{options[:vo].inspect} " \
|
52
|
+
"are available [#{@_results[:expected].count}]"
|
50
53
|
rescue => ex
|
51
54
|
puts "VMCATCHER UNKNOWN - #{ex.message}"
|
52
55
|
puts ex.backtrace if options[:debug]
|
@@ -95,10 +98,14 @@ class Nagios::Promoo::Appdb::Probes::VmcatcherProbe < Nagios::Promoo::Appdb::Pro
|
|
95
98
|
"from #{list_url.inspect} [#{response.code}]" unless response.success?
|
96
99
|
|
97
100
|
list = JSON.parse OpenSSL::PKCS7.read_smime(response.parsed_response).data
|
98
|
-
fail "AppDB image list #{list_url.inspect}
|
99
|
-
|
101
|
+
fail "AppDB image list #{list_url.inspect} is empty or malformed" unless list && list['hv:imagelist']
|
102
|
+
|
103
|
+
list = list['hv:imagelist']
|
104
|
+
fail "AppDB image list #{list_url.inspect} has expired" unless DateTime.parse(list['dc:date:expires']) > Time.now
|
105
|
+
fail "AppDB image list #{list_url.inspect} doesn't contain images" unless list['hv:images']
|
100
106
|
|
101
|
-
@
|
107
|
+
@_last_update = DateTime.parse list['dc:date:created']
|
108
|
+
@_hv_images = list['hv:images'].collect { |im| im['hv:image'] }.reject { |im| im.blank? || im['ad:mpuri'].blank? }
|
102
109
|
end
|
103
110
|
|
104
111
|
def normalize_mpuri(mpuri)
|
data/lib/nagios/promoo.rb
CHANGED
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.
|
4
|
+
version: 1.1.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-
|
11
|
+
date: 2017-03-30 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: occi-api
|