[packages/nagios] Rel 2; try harder doing refreshes
arekm
arekm at pld-linux.org
Sat Mar 14 13:26:55 CET 2026
commit 6c11c4389961c56bcbcb6ad3fc53b2d12c0a5a42
Author: Arkadiusz Miśkiewicz <arekm at maven.pl>
Date: Sat Mar 14 13:26:17 2026 +0100
Rel 2; try harder doing refreshes
nagios-resilient-refresh.patch | 68 ++++++++++++++++++++++++++++++++++++++++++
nagios.spec | 4 ++-
2 files changed, 71 insertions(+), 1 deletion(-)
---
diff --git a/nagios.spec b/nagios.spec
index dbbf88a..258e149 100644
--- a/nagios.spec
+++ b/nagios.spec
@@ -13,7 +13,7 @@ Summary(pl.UTF-8): Program do monitorowania serwerów/usług/sieci
Summary(pt_BR.UTF-8): Programa para monitoração de máquinas e serviços
Name: nagios
Version: 4.5.11
-Release: 1
+Release: 2
License: GPL v2+
Group: Networking
# https://www.nagios.org/downloads/nagios-core/thanks/?product_download=nagioscore-source
@@ -48,6 +48,7 @@ Patch7: remove-information-leak.patch
Patch8: archivelog-timeformat.patch
Patch10: system-jquery.patch
+Patch11: %{name}-resilient-refresh.patch
URL: https://www.nagios.org/projects/nagios-core/
BuildRequires: autoconf
BuildRequires: automake
@@ -265,6 +266,7 @@ mv %{name}-%{version}/* .
%patch -P8 -p1
%patch -P10 -p1
+%patch -P11 -p1
find -name .cvsignore -o -name .gitignore | xargs rm
diff --git a/nagios-resilient-refresh.patch b/nagios-resilient-refresh.patch
new file mode 100644
index 0000000..a02b2b5
--- /dev/null
+++ b/nagios-resilient-refresh.patch
@@ -0,0 +1,68 @@
+Resilient refresh for main content iframe.
+
+CGI pages use the HTTP Refresh header to auto-reload, but when a reload
+fails due to a network outage the browser displays an error page that
+lacks the header, permanently breaking the refresh cycle.
+
+The fix has two parts:
+1. index.php (parent frame, never reloads) exposes a nagiosSetRefresh()
+ function that manages a fallback timer for the content iframe.
+2. display_info_table() in cgiutils.c calls nagiosSetRefresh(rate) for
+ pages that auto-refresh (refresh==TRUE) and nagiosSetRefresh(0) for
+ pages that don't, so the timer is only active on the right pages.
+
+The fallback timer fires at 2x the refresh interval, so it only acts
+when the CGI's own Refresh header has failed. On success, the reloaded
+page calls nagiosSetRefresh() again, resetting the cycle. On failure,
+the timer retries at the normal interval until the server is reachable.
+
+--- nagios-4.5.11.orig/html/index.php.in 2026-01-14 17:37:45.000000000 +0100
++++ nagios-4.5.11/html/index.php.in 2026-03-14 13:13:54.586581151 +0100
+@@ -45,6 +45,37 @@
+ <script LANGUAGE="javascript">
+ var n = Math.round(Math.random() * 10000000000);
+ document.cookie = "NagFormId=" + n.toString(16);
++
++ // Resilient refresh: CGI pages call nagiosSetRefresh(rate) to
++ // register for auto-refresh. This parent frame persists across
++ // network outages, so the timer survives even when the content
++ // iframe fails to load and loses its HTTP Refresh header cycle.
++ var _nagiosRefreshTimer = null;
++ var _nagiosRefreshUrl = null;
++ window.nagiosSetRefresh = function(rate) {
++ if (_nagiosRefreshTimer) {
++ clearTimeout(_nagiosRefreshTimer);
++ _nagiosRefreshTimer = null;
++ }
++ if (rate > 0) {
++ try {
++ var f = document.querySelector('iframe[name="main"]');
++ if (f && f.contentWindow)
++ _nagiosRefreshUrl = f.contentWindow.location.href;
++ } catch(e) {}
++ _nagiosRefreshTimer = setTimeout(function doRefresh() {
++ var f = document.querySelector('iframe[name="main"]');
++ try {
++ if (f && f.contentWindow)
++ f.contentWindow.location.reload();
++ } catch(e) {
++ if (f && _nagiosRefreshUrl)
++ f.src = _nagiosRefreshUrl;
++ }
++ _nagiosRefreshTimer = setTimeout(doRefresh, rate * 1000);
++ }, rate * 2 * 1000);
++ }
++ };
+ </script>
+
+ <style>
+--- nagios-4.5.11.orig/cgi/cgiutils.c 2026-01-14 17:37:45.000000000 +0100
++++ nagios-4.5.11/cgi/cgiutils.c 2026-03-14 13:17:09.096581142 +0100
+@@ -1658,6 +1658,8 @@
+ printf("Last Updated: %s<BR>\n", date_time);
+ if(refresh == TRUE)
+ printf("Updated every %d seconds<br>\n", refresh_rate);
++ printf("<script>if(parent&&parent.nagiosSetRefresh)parent.nagiosSetRefresh(%d);</script>\n",
++ refresh == TRUE ? refresh_rate : 0);
+
+ printf("Nagios® Core™ %s - <A HREF='https://www.nagios.org' TARGET='_new' REL='nofollow' CLASS='homepageURL'>www.nagios.org</A><BR>\n", PROGRAM_VERSION);
================================================================
---- gitweb:
http://git.pld-linux.org/gitweb.cgi/packages/nagios.git/commitdiff/6c11c4389961c56bcbcb6ad3fc53b2d12c0a5a42
More information about the pld-cvs-commit
mailing list