diff options
author | Antoine GUEVARA <antoine.guevara@recia.fr> | 2015-06-24 16:52:35 +0200 |
---|---|---|
committer | Antoine GUEVARA <antoine.guevara@recia.fr> | 2015-06-24 16:52:35 +0200 |
commit | 069db4a8102993fd13b074473a2ca67e475bb2b1 (patch) | |
tree | 7af8b855f12ad7723cd88fdf3f11a7d3011d9687 /extra | |
parent | 50237f7d9044898fbee4526e22ba07f7cfaddc40 (diff) |
Added [WARN] which show the pending backups
Diffstat (limited to 'extra')
-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.' |