nagios-promoo 1.2.0 → 1.3.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: a526ad530f8f724a31721b81e321ad2d6ba7d847
4
- data.tar.gz: a8627259081ce7c0d5b928b826d5bab32a0af4c5
3
+ metadata.gz: 0c242118ff175bfc75cd2dcdb1f601ee0bce917a
4
+ data.tar.gz: fc1af479b2fc2e7fabb7ac425b5b785eb3e95f73
5
5
  SHA512:
6
- metadata.gz: 4b467c9e3a11f3f41c47f084c7a6f91efaf47a2f1b8c39995f1fe9dbd6056ab08e71eeb1ebded5f3747a9721c90233f06838d6337b72b121f793734ef5160439
7
- data.tar.gz: 6c82cf8ac8d6a19ffaa9ae75eba459eb4e561cec0ef5547dea7a155d8d141e12699506d506cc1a9480e1c3c656cc8b069c4e931a9a54f3362a448d878b38aa3c
6
+ metadata.gz: d36bfb153389e3391c8d533979067bc64362f0ce3aed4a82b7ca4a8b7776abb284adc080b86c10252ad8a0f0a33069eb2284efdf88d6978645b45e4cdc4b7f32
7
+ data.tar.gz: f71856419e0ee71de26cede648b834be3deeea9741e22178789780ff71107f86860004e41e65ab82aa56ee9f4f9484d2dfb1d34f5d2a6a8cbe6f22be6fa9939e
@@ -0,0 +1,63 @@
1
+ # Internal deps
2
+ require File.join(File.dirname(__FILE__), 'base_probe')
3
+
4
+ module Nagios
5
+ module Promoo
6
+ module Opennebula
7
+ module Probes
8
+ # Probe for checking ONe for ERRORs on hosts.
9
+ #
10
+ # @author Boris Parak <parak@cesnet.cz>
11
+ class HostErrorProbe < Nagios::Promoo::Opennebula::Probes::BaseProbe
12
+ class << self
13
+ def description
14
+ ['host-error', 'Run a probe checking for ERRORs on hosts']
15
+ end
16
+
17
+ def options
18
+ []
19
+ end
20
+
21
+ def declaration
22
+ 'host_error'
23
+ end
24
+
25
+ def runnable?
26
+ true
27
+ end
28
+ end
29
+
30
+ ERROR_KEYWORD = 'ERROR'.freeze
31
+
32
+ def run(_args = [])
33
+ Timeout.timeout(options[:timeout]) do
34
+ errors = host_pool.select { |host| errored?(host) }
35
+ errors.map! { |host| host['NAME'] }
36
+ raise "HOSTs #{errors.inspect} are in state #{ERROR_KEYWORD}" if errors.count > 0
37
+ end
38
+
39
+ puts 'HOSTERR OK - Everything is hunky-dory'
40
+ rescue => ex
41
+ puts "HOSTERR CRITICAL - #{ex.message}"
42
+ puts ex.backtrace if options[:debug]
43
+ exit 2
44
+ end
45
+
46
+ private
47
+
48
+ def host_pool
49
+ host_pool = OpenNebula::HostPool.new(client)
50
+ rc = host_pool.info
51
+ raise rc.message if OpenNebula.is_error?(rc)
52
+
53
+ host_pool
54
+ end
55
+
56
+ def errored?(host)
57
+ host.state_str == ERROR_KEYWORD
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -0,0 +1,63 @@
1
+ # Internal deps
2
+ require File.join(File.dirname(__FILE__), 'base_probe')
3
+
4
+ module Nagios
5
+ module Promoo
6
+ module Opennebula
7
+ module Probes
8
+ # Probe for checking ONe for FAILED virtual machines.
9
+ #
10
+ # @author Boris Parak <parak@cesnet.cz>
11
+ class VirtualMachineFailsProbe < Nagios::Promoo::Opennebula::Probes::BaseProbe
12
+ class << self
13
+ def description
14
+ ['virtual-machine-fails', 'Run a probe checking for FAILED virtual machines']
15
+ end
16
+
17
+ def options
18
+ []
19
+ end
20
+
21
+ def declaration
22
+ 'virtual_machine_fails'
23
+ end
24
+
25
+ def runnable?
26
+ true
27
+ end
28
+ end
29
+
30
+ FAIL_KEYWORD = 'FAILURE'.freeze
31
+
32
+ def run(_args = [])
33
+ Timeout.timeout(options[:timeout]) do
34
+ fails = virtual_machine_pool.select { |vm| failed?(vm) }
35
+ fails.map!(&:id)
36
+ raise "Virtual machines #{fails.inspect} are in a FAILED state" if fails.count > 0
37
+ end
38
+
39
+ puts 'VMFAILS OK - Everything is hunky-dory'
40
+ rescue => ex
41
+ puts "VMFAILS CRITICAL - #{ex.message}"
42
+ puts ex.backtrace if options[:debug]
43
+ exit 2
44
+ end
45
+
46
+ private
47
+
48
+ def virtual_machine_pool
49
+ vm_pool = OpenNebula::VirtualMachinePool.new(client)
50
+ rc = vm_pool.info_all
51
+ raise rc.message if OpenNebula.is_error?(rc)
52
+
53
+ vm_pool
54
+ end
55
+
56
+ def failed?(vm)
57
+ vm.lcm_state_str.include?(FAIL_KEYWORD) || vm.state_str.include?(FAIL_KEYWORD)
58
+ end
59
+ end
60
+ end
61
+ end
62
+ end
63
+ end
@@ -1,7 +1,7 @@
1
1
  module Nagios
2
2
  module Promoo
3
3
  module Opennebula
4
- VERSION = '1.0.0'.freeze
4
+ VERSION = '1.1.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.2.0'.freeze
3
+ VERSION = '1.3.0'.freeze
4
4
  end
5
5
  end
metadata CHANGED
@@ -1,7 +1,7 @@
1
1
  --- !ruby/object:Gem::Specification
2
2
  name: nagios-promoo
3
3
  version: !ruby/object:Gem::Version
4
- version: 1.2.0
4
+ version: 1.3.0
5
5
  platform: ruby
6
6
  authors:
7
7
  - Boris Parak
@@ -330,6 +330,8 @@ files:
330
330
  - lib/nagios/promoo/opennebula/master.rb
331
331
  - lib/nagios/promoo/opennebula/probes/.keep
332
332
  - lib/nagios/promoo/opennebula/probes/base_probe.rb
333
+ - lib/nagios/promoo/opennebula/probes/host_error_probe.rb
334
+ - lib/nagios/promoo/opennebula/probes/virtual_machine_fails_probe.rb
333
335
  - lib/nagios/promoo/opennebula/probes/virtual_machine_probe.rb
334
336
  - lib/nagios/promoo/opennebula/probes/xmlrpc_health_probe.rb
335
337
  - lib/nagios/promoo/opennebula/version.rb
@@ -357,7 +359,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
357
359
  version: '0'
358
360
  requirements: []
359
361
  rubyforge_project:
360
- rubygems_version: 2.6.10
362
+ rubygems_version: 2.6.8
361
363
  signing_key:
362
364
  specification_version: 4
363
365
  summary: Nagios Probes for Monitoring OpenNebula and OCCI