summaryrefslogtreecommitdiff
path: root/lib
diff options
context:
space:
mode:
Diffstat (limited to 'lib')
-rw-r--r--lib/service_registry.rb11
1 files changed, 11 insertions, 0 deletions
diff --git a/lib/service_registry.rb b/lib/service_registry.rb
index 38aad87..c4296bf 100644
--- a/lib/service_registry.rb
+++ b/lib/service_registry.rb
@@ -27,6 +27,11 @@ module HelperMethods
status_data['hosts'][host]['current_state'] == 0
end
+ def host_down?(host)
+ status_data['hosts'].key?(host) &&
+ status_data['hosts'][host]['current_state'] == 1
+ end
+
def host_flapping?(host)
status_data['hosts'].key?(host) &&
status_data['hosts'][host]['is_flapping'] != 0
@@ -39,6 +44,12 @@ module HelperMethods
status_data['services'][host][service]['current_state'] == 0
end
+ def service_down?(host, service)
+ status_data['services'].key?(host) &&
+ status_data['services'][host].key?(service) &&
+ status_data['services'][host][service]['current_state'] == 1
+ end
+
def service_flapping?(host, service)
status_data['services'].key?(host) &&
status_data['services'][host].key?(service) &&