diff options
author | Saku Ytti <saku@ytti.fi> | 2015-02-22 12:05:49 +0200 |
---|---|---|
committer | Saku Ytti <saku@ytti.fi> | 2015-02-22 12:05:49 +0200 |
commit | 5fe82dcf54beecbd24d30f8715aabeac12ecb33f (patch) | |
tree | 03a50e6ace7390191a7d51fbede9d57dfef5ebd8 /extra/nagios_check_failing_nodes.rb | |
parent | ee0298340ead4eb87ae6860d606ba61cd7e92c6c (diff) |
add nagios monitoring script
closes #67
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 |