sensu-plugins-mofa 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 +4 -4
- data/bin/check-mofa-provisioning.rb +16 -15
- data/lib/sensu-plugins-mofa/version.rb +1 -1
- metadata +1 -1
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA1:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: dbc4bbcc2b960ad6fb91e5ddcda86864d19e1e67
|
4
|
+
data.tar.gz: 99d37c6be54d74b5cc91ad4210a3f18a394258e3
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: c73d7c483c7e2adc2f08c718eb79d046f6d1cb65e35e85e580e4547aa8498b7d179efde4507c6dd53a0d04672812504acd81404d705502954b5af9988f245c75
|
7
|
+
data.tar.gz: a765067297300d1e828abba3095dce49bd5718e4628c244e188915a092a5916b4b58d57552ca37be6dce0c48b425a7ad54368adce7b0c7a089709fdc92877c83
|
@@ -28,35 +28,36 @@
|
|
28
28
|
|
29
29
|
require 'sensu-plugin/check/cli'
|
30
30
|
|
31
|
-
class
|
31
|
+
class MofaProvisioningChecker < Sensu::Plugin::Check::CLI
|
32
32
|
option :mofa_status_file,
|
33
|
-
description: 'Mofa Status
|
34
|
-
short: '-s /var/lib/mofa
|
35
|
-
long: '--mofa-status-file /var/lib/mofa
|
36
|
-
default: '/var/lib/mofa
|
33
|
+
description: 'Mofa Status dir - defaults to /var/lib/mofa',
|
34
|
+
short: '-s /var/lib/mofa',
|
35
|
+
long: '--mofa-status-file /var/lib/mofa',
|
36
|
+
default: '/var/lib/mofa'
|
37
37
|
|
38
|
-
def
|
39
|
-
|
40
|
-
if File.file?(
|
38
|
+
def process_mofa_status_dir(mofa_status_dir)
|
39
|
+
data = { result: 'UNKNOWN' }
|
40
|
+
if File.file?(mofa_status_dir)
|
41
41
|
status = File.read(mofa_status_file).chomp
|
42
42
|
case
|
43
43
|
when status =~ /SUCCESS/
|
44
|
-
result = 'SUCCESS'
|
44
|
+
data.result = 'SUCCESS'
|
45
45
|
when status =~ /FAIL/
|
46
|
-
result = 'FAIL'
|
46
|
+
data.result = 'FAIL'
|
47
47
|
end
|
48
48
|
end
|
49
|
-
|
49
|
+
data
|
50
50
|
end
|
51
51
|
|
52
52
|
def run
|
53
|
-
|
53
|
+
data = process_mofa_status_file(config[:mofa_status_dir])
|
54
|
+
case data.result
|
54
55
|
when 'UNKNOWN'
|
55
|
-
unknown 'Cannot detect any mofa provisining (
|
56
|
+
unknown 'Cannot detect any mofa provisining (no cookbook info found).'
|
56
57
|
when 'SUCCESS'
|
57
|
-
ok 'Last mofa provisioning was successful
|
58
|
+
ok 'Last mofa provisioning was successful ()'
|
58
59
|
when 'FAIL'
|
59
|
-
critical 'Last mofa provisioning failed!'
|
60
|
+
critical 'Last mofa provisioning failed! ()'
|
60
61
|
end
|
61
62
|
end
|
62
63
|
end
|