health_checker.rb 538 B

12345678910111213141516171819202122232425262728293031
  1. # Copyright (C) 2012-2024 Zammad Foundation, https://zammad-foundation.org/
  2. module MonitoringHelper
  3. class HealthChecker
  4. include ::Mixin::HasBackends
  5. attr_reader :response
  6. def check_health
  7. response = Response.new
  8. backends.each do |backend|
  9. response.merge backend.new.check_health
  10. end
  11. @response = response
  12. end
  13. def healthy?
  14. response.issues.none?
  15. end
  16. def message
  17. if healthy?
  18. return 'success'
  19. end
  20. response.issues.join(';')
  21. end
  22. end
  23. end