From 069db4a8102993fd13b074473a2ca67e475bb2b1 Mon Sep 17 00:00:00 2001 From: Antoine GUEVARA Date: Wed, 24 Jun 2015 16:52:35 +0200 Subject: Added [WARN] which show the pending backups --- extra/nagios_check_failing_nodes.rb | 12 ++++++++++-- 1 file 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.' -- cgit v1.2.1