diff options
-rw-r--r-- | extra/nagios_check_failing_nodes.rb | 12 |
1 files changed, 10 insertions, 2 deletions
diff --git a/extra/nagios_check_failing_nodes.rb b/extra/nagios_check_failing_nodes.rb index 848978d..27a5c66 100644 --- a/extra/nagios_check_failing_nodes.rb +++ b/extra/nagios_check_failing_nodes.rb @@ -6,7 +6,9 @@ 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| @@ -15,11 +17,17 @@ json.each do |node| critical_nodes << node['name'] critical = true end + else + pending_nodes << node['name'] + pending = true end end -if critical - puts '[CRIT] Unable to backup: ' + critical_nodes.join(' ') +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.' |