blob: 27a5c66653c7fc0bb287ffbfe661a8a0d9cd3136 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
|
#!/usr/bin/env ruby
## contrib via https://github.com/ytti/oxidized/issues/67
require 'open-uri'
require 'json'
critical = false
pending = false
critical_nodes = []
pending_nodes = []
json = JSON.load(open("http://localhost:8888/nodes.json"))
json.each do |node|
if not node['last'].nil?
if node['last']['status'] != 'success'
critical_nodes << node['name']
critical = true
end
else
pending_nodes << node['name']
pending = true
end
end
if pending
puts '[WARN] Pending backup: ' + pending_nodes.join(',')
exit 1
elsif critical
puts '[CRIT] Unable to backup: ' + critical_nodes.join(',')
exit 2
else
puts '[OK] Backup of all nodes completed successfully.'
exit 0
end
|