Skip to content

Commit

Permalink
for #162: Show warning for mismatched plugin on cluster
Browse files Browse the repository at this point in the history
When running in a cluster, and not all servers in the cluster have the same version of the Monitoring plugin loaded, behavior will be broken. This commit detects version mismatches, and displays a warning on the admin console.
  • Loading branch information
guusdk committed Dec 23, 2021
1 parent 4cfc7ba commit 5980e57
Show file tree
Hide file tree
Showing 7 changed files with 65 additions and 7 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<artifactId>plugins</artifactId>
<groupId>org.igniterealtime.openfire</groupId>
<version>4.7.0-beta</version>
<version>4.7.0-SNAPSHOT</version>
</parent>
<groupId>org.igniterealtime.openfire.plugins</groupId>
<artifactId>monitoring</artifactId>
Expand Down
1 change: 1 addition & 0 deletions src/i18n/monitoring_i18n.properties
Original file line number Diff line number Diff line change
Expand Up @@ -244,5 +244,6 @@ muc.conversation.joined={0} ({1}) has joined the room
muc.conversation.left={0} ({1}) has left the room

warning.httpbinding.disabled=The HTTP Binding service appears to be disabled! Web-based logs will not be accessible without this service. {0}Please enable the HTTP Binding service here!{1}
warning.clustering.versions=This Openfire server is part of a cluster. Not all servers in the cluster are running (the same version of) the Monitoring plugin. This will result in inconsistent behavior, possibly even errors. Please review {0}the version of the Monitoring plugin that is installed on each cluster node.{1}

monitoring.search.allow-unrecognized-fields=If 'true', silently ignores unrecognized search filters in queries, which otherwise result in error responses.
16 changes: 12 additions & 4 deletions src/web/archive-search.jsp
Original file line number Diff line number Diff line change
@@ -1,9 +1,5 @@
<%@ page contentType="text/html; charset=UTF-8" %>
<%@ page errorPage="/error.jsp" import="org.jivesoftware.openfire.plugin.MonitoringPlugin"%>
<%@ page import="org.jivesoftware.openfire.archive.ArchiveSearch" %>
<%@ page import="org.jivesoftware.openfire.archive.ArchiveSearcher" %>
<%@ page import="org.jivesoftware.openfire.archive.Conversation" %>
<%@ page import="org.jivesoftware.openfire.archive.ConversationManager" %>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%@ page import="org.jivesoftware.openfire.user.UserNameManager" %>
<%@ page import="org.jivesoftware.openfire.user.UserNotFoundException" %>
Expand All @@ -15,6 +11,8 @@
<%@ page import="org.slf4j.Logger" %>
<%@ page import="org.slf4j.LoggerFactory" %>
<%@ page import="com.reucon.openfire.plugin.archive.xep.AbstractXepSupport" %>
<%@ page import="org.jivesoftware.openfire.archive.*" %>
<%@ page import="org.jivesoftware.openfire.cluster.ClusterManager" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
Expand Down Expand Up @@ -499,6 +497,16 @@
</head>
<body>

<% if (!ClusterManager.findRemotePluginsWithDifferentVersion(MonitoringConstants.PLUGIN_NAME).isEmpty()) { %>
<div class="warning">
<fmt:message key="warning.clustering.versions">
<fmt:param value="<a href='/system-clustering.jsp'>" />
<fmt:param value="</a>" />
</fmt:message>
</div>
<br/>
<% } %>

<a href="archive-conversation-participants.jsp?conversationID=" id="lbmessage" title="<fmt:message key="archive.group_conversation.participants" />" style="display:none;"></a>

<form action="archive-search.jsp" name="f">
Expand Down
16 changes: 14 additions & 2 deletions src/web/archiving-settings.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -12,9 +12,10 @@
<%@ page import="java.util.Map" %>
<%@ page import="com.reucon.openfire.plugin.archive.impl.MucIndexer" %>
<%@ page import="org.jivesoftware.openfire.plugin.service.LogAPI" %>
<%@ page import="org.jivesoftware.util.*" %>
<%@ page import="org.jivesoftware.openfire.http.HttpBindManager" %>
<%@ page import="com.reucon.openfire.plugin.archive.impl.MessageIndexer" %>
<%@ page import="org.jivesoftware.openfire.archive.MonitoringConstants" %>
<%@ page import="org.jivesoftware.openfire.cluster.ClusterManager" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
Expand Down Expand Up @@ -310,7 +311,8 @@

<div class="success" id="rebuild" style="display: <%=rebuildIndex?"block":"none"%>">
<fmt:message key="archive.settings.rebuild.success"/>
</div><br/>
<br/>
</div>

<% if (errors.size() > 0) { %>
<div class="error">
Expand All @@ -319,6 +321,16 @@
<br/>
<% } %>

<% if (!ClusterManager.findRemotePluginsWithDifferentVersion(MonitoringConstants.PLUGIN_NAME).isEmpty()) { %>
<div class="warning">
<fmt:message key="warning.clustering.versions">
<fmt:param value="<a href='/system-clustering.jsp'>" />
<fmt:param value="</a>" />
</fmt:message>
</div>
<br/>
<% } %>

<p>
<fmt:message key="archive.settings.description"/>
</p>
Expand Down
12 changes: 12 additions & 0 deletions src/web/conversations.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
<%@ page import="org.jivesoftware.openfire.user.UserManager"%>
<%@ page import="java.net.URLEncoder" %>
<%@ page import="org.jivesoftware.util.StringUtils" %>
<%@ page import="org.jivesoftware.openfire.archive.MonitoringConstants" %>
<%@ page import="org.jivesoftware.openfire.cluster.ClusterManager" %>

<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>
Expand Down Expand Up @@ -139,6 +141,16 @@ function updateConversations(data) {
//# sourceURL=conversations.jsp
</script>

<% if (!ClusterManager.findRemotePluginsWithDifferentVersion(MonitoringConstants.PLUGIN_NAME).isEmpty()) { %>
<div class="warning">
<fmt:message key="warning.clustering.versions">
<fmt:param value="<a href='/system-clustering.jsp'>" />
<fmt:param value="</a>" />
</fmt:message>
</div>
<br/>
<% } %>

<!-- <a href="#" onclick="conversationUpdater(); return false;">click me</a> -->
<p>
<fmt:message key="archive.conversations" />
Expand Down
13 changes: 13 additions & 0 deletions src/web/stats-dashboard.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,8 @@
<%@ page import="java.util.*"%>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%@ page import="org.jivesoftware.openfire.plugin.MonitoringPlugin" %>
<%@ page import="org.jivesoftware.openfire.cluster.ClusterManager" %>
<%@ page import="org.jivesoftware.openfire.archive.MonitoringConstants" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

Expand Down Expand Up @@ -380,6 +382,17 @@ function createCookie(name,value,days) {
</script>

<div id="instructions">

<% if (!ClusterManager.findRemotePluginsWithDifferentVersion(MonitoringConstants.PLUGIN_NAME).isEmpty()) { %>
<div class="warning">
<fmt:message key="warning.clustering.versions">
<fmt:param value="<a href='/system-clustering.jsp'>" />
<fmt:param value="</a>" />
</fmt:message>
</div>
<br/>
<% } %>

<table width="756" border="0">
<tr>
<td width="426">
Expand Down
12 changes: 12 additions & 0 deletions src/web/stats-reporter.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
<%@ page import="java.util.List"%>
<%@ page import="org.jivesoftware.openfire.plugin.MonitoringPlugin" %>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%@ page import="org.jivesoftware.openfire.cluster.ClusterManager" %>
<%@ page import="org.jivesoftware.openfire.archive.MonitoringConstants" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/core" prefix="c" %>
<%@ taglib uri="http://java.sun.com/jsp/jstl/fmt" prefix="fmt" %>

Expand Down Expand Up @@ -281,6 +283,16 @@

<body>

<% if (!ClusterManager.findRemotePluginsWithDifferentVersion(MonitoringConstants.PLUGIN_NAME).isEmpty()) { %>
<div class="warning">
<fmt:message key="warning.clustering.versions">
<fmt:param value="<a href='/system-clustering.jsp'>" />
<fmt:param value="</a>" />
</fmt:message>
</div>
<br/>
<% } %>

<table cellpadding="0" cellspacing="0" border="0" width="753">
<tr>
<td width="180" valign="top">
Expand Down

0 comments on commit 5980e57

Please sign in to comment.