changeset 2765:85cf9a8b4020

mod_http_host_status_check: Add list of failing hosts to the first line for summary
author Matthew Wild <mwild1@gmail.com>
date Mon, 18 Sep 2017 16:39:02 +0100
parents 1872a9129c2f
children 314cebb3071e
files mod_http_host_status_check/mod_http_host_status_check.lua
diffstat 1 files changed, 3 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/mod_http_host_status_check/mod_http_host_status_check.lua	Tue Sep 12 15:46:49 2017 +0200
+++ b/mod_http_host_status_check/mod_http_host_status_check.lua	Mon Sep 18 16:39:02 2017 +0100
@@ -35,6 +35,7 @@
 	local current_time = time();
 
 	local all_ok = true;
+	local failed_hosts = {};
 
 	for host in pairs(hosts) do
 		local last_heartbeat_time = heartbeats[host];
@@ -81,6 +82,7 @@
 
 		if not ok then
 			all_ok = false;
+			table.insert(failed_hosts, host);
 		end
 		
 		if not ok or is_component or last_heartbeat_time then
@@ -95,7 +97,7 @@
 		end
 	end
 	local page = template(status_page_template, {
-		status = all_ok and "OK" or "FAIL";
+		status = all_ok and "OK" or ("FAIL: "..table.concat(failed_hosts, ", "));
 		host_statuses = host_statuses;
 	});
 	return page;