diff options
author | Florian Hibler <fhibler@users.noreply.github.com> | 2015-02-26 16:47:18 +0000 |
---|---|---|
committer | Florian Hibler <fhibler@users.noreply.github.com> | 2015-02-26 16:47:18 +0000 |
commit | 1c85b3202033ed965abe16e15688f0b0025561ea (patch) | |
tree | 4ea9288b7a3dc774a60cdbd096761df4da147f8e /extra/nagios_check_failing_nodes.rb | |
parent | 19de2ac51cd765e1c7b7fe731759fb50086675b5 (diff) | |
parent | db165b5e1ebb3091a49029d739b68a913bc75db6 (diff) |
Merge pull request #1 from ytti/master
Merge to latest
Diffstat (limited to 'extra/nagios_check_failing_nodes.rb')
-rw-r--r-- | extra/nagios_check_failing_nodes.rb | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/extra/nagios_check_failing_nodes.rb b/extra/nagios_check_failing_nodes.rb new file mode 100644 index 0000000..1c81f66 --- /dev/null +++ b/extra/nagios_check_failing_nodes.rb @@ -0,0 +1,25 @@ +#!/usr/bin/env ruby + +## contrib via https://github.com/ytti/oxidized/issues/67 + +require 'open-uri' +require 'json' + +critical = false +critical_nodes = [] + +json = JSON.load(open("http://localhost:8888/nodes.json")) +json.each do |node| + if node['last']['status'] != 'success' + critical_nodes << node['name'] + critical = true + end +end + +if critical + puts 'Unable to backup: ' + critical_nodes.join(' ') + exit 2 +else + puts 'Backup of all nodes completed successfully.' + exit 0 +end |