Commit 3f860a63 authored by Axel Brand's avatar Axel Brand Committed by daeva

Gojara

- nearing release of 2.1 , already running for us but waiting to see if performs good under load
- give better advice what to set as admin_jid

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13710 b35dd754-fafc-0310-a699-88a17e54d16e
parent ec72fd1c
......@@ -108,7 +108,7 @@ public class GojaraAdminManager {
public boolean areGatewaysConfigured() {
return unconfiguredGateways.isEmpty();
}
public boolean isGatewayConfigured(String gateway) {
return configuredGateways.contains(gateway);
}
......@@ -190,20 +190,21 @@ public class GojaraAdminManager {
gatherGatewayStatistics(gateway);
}
}
/**
* gathers Gatewaystatistics for specific gateway
*
* @param gateway
*/
public void gatherGatewayStatistics(String gateway) {
uptime(gateway);
messagesFrom(gateway);
messagesTo(gateway);
usedMemoryOf(gateway);
averageMemoryOfUser(gateway);
// Log.info("Gathering Gateway-Statistics for " + gateway);
uptime(gateway);
messagesFrom(gateway);
messagesTo(gateway);
usedMemoryOf(gateway);
averageMemoryOfUser(gateway);
// Log.info("Gathering Gateway-Statistics for " + gateway);
}
private void uptime(String transport) {
Message message = generateCommand(transport, "uptime");
router.route(message);
......@@ -228,9 +229,10 @@ public class GojaraAdminManager {
Message message = generateCommand(transport, "average_memory_per_user");
router.route(message);
}
/**
* Preps the specified stat for nicer output which is used in tables.
*
* @param gateway
* @param stat
* @return
......@@ -244,7 +246,7 @@ public class GojaraAdminManager {
long diffMinutes = time / 60 % 60;
long diffHours = time / (60 * 60) % 24;
long diffDays = time / (24 * 60 * 60);
return "" + diffSeconds+ " Sec " + diffMinutes + " Min " + diffHours + " Hours " + diffDays + " Days";
return "" + diffSeconds + " Sec " + diffMinutes + " Min " + diffHours + " Hours " + diffDays + " Days";
}
} else if (stat.equals("messages_from_xmpp")) {
if (gatewayStatisticsMap.get(gateway).get("messages_from_xmpp") != null)
......@@ -256,8 +258,8 @@ public class GojaraAdminManager {
if (gatewayStatisticsMap.get(gateway).get("used_memory") != null) {
DecimalFormat f = new DecimalFormat("#0.00");
double mb = gatewayStatisticsMap.get(gateway).get("used_memory") / 1024.0;
return "" + f.format(mb) + " MB";
return "" + f.format(mb) + " MB";
}
} else if (stat.equals("average_memory_per_user")) {
if (gatewayStatisticsMap.get(gateway).get("average_memory_per_user") != null) {
......
......@@ -54,8 +54,8 @@ public class TransportSessionManager {
* @param subdomain
*/
public void removeTransport(String subdomain) {
Map<String, Long> disconnectedUsers = transportSessions.remove(subdomain);
Log.debug("Removed " + subdomain + "from TransportSessionMap " + disconnectedUsers.toString());
transportSessions.remove(subdomain);
Log.debug("Removed " + subdomain + "from TransportSessionMap ");
}
......
......@@ -11,6 +11,7 @@
<%@ page import="java.util.Set"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%@ taglib uri="http://java.sun.com/jstl/core_rt" prefix="c"%>
<%
......@@ -62,7 +63,7 @@
<div align="center">
<% if (!gojaraAdminManager.areGatewaysConfigured()) {%>
<h2><a href="gojara-gatewayStatistics.jsp">Warning: Not all Gateways are configured for admin usage. This means unregistrations will not be properly executed.<br/>
Please configure admin_jid = gojaraadmin@yourdomain in Spectrum2 transport configuration.</a></h2>
Please configure admin_jid = gojaraadmin@<%= XMPPServer.getInstance().getServerInfo().getXMPPDomain() %> in Spectrum2 transport configuration.</a></h2>
<% } %>
<h5>Logintime 1970 means User did register but never logged in,
propably because of invalid credentials.</h5>
......
......@@ -12,6 +12,7 @@
<%@ page import="java.util.Set"%>
<%@ page import="java.util.Date"%>
<%@ page import="java.util.ArrayList"%>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%
TransportSessionManager transportManager = TransportSessionManager.getInstance();
......@@ -39,7 +40,7 @@
<div align="center">
<% if (!gojaraAdminManager.areGatewaysConfigured()) {%>
<h2><a href="gojara-gatewayStatistics.jsp">Warning: Not all Gateways are configured for admin usage. This means session details may be inaccurate or not logged at all.<br/>
Please configure admin_jid = gojaraadmin@yourdomain in Spectrum2 transport configuration.</a></h2><br/>
Please configure admin_jid = gojaraadmin@<%= XMPPServer.getInstance().getServerInfo().getXMPPDomain() %> in Spectrum2 transport configuration.</a></h2><br/>
<% } %>
<h4>
Current number of active Gateway Sessions: &emsp;
......
......@@ -4,10 +4,12 @@
import="org.jivesoftware.openfire.plugin.gojara.sessions.GojaraAdminManager"%>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.Set"%>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%
TransportSessionManager transportSessionManager = TransportSessionManager.getInstance();
GojaraAdminManager gojaraAdminManager = GojaraAdminManager.getInstance();
gojaraAdminManager.gatherGatewayStatistics();
String domain = XMPPServer.getInstance().getServerInfo().getXMPPDomain();
%>
<html>
<head>
......@@ -22,7 +24,7 @@
<h2 style="color: red" align="center">
Warning: Not all Gateways are configured for admin usage. Affected
gateways will not show spectrum2 data.<br /> Please configure admin_jid =
gojaraadmin@yourdomain in Spectrum2 transport configuration.
gojaraadmin@<%=domain %> in Spectrum2 transport configuration.
</h2>
<hr />
<%
......@@ -51,7 +53,11 @@
for (String gateway : gateways) {
%>
<tr class="jive-odd">
<td><%=gateway %></td>
<td><%=gateway %> <% if (!gateway.contains(domain)) { %>
<img alt="gateway configuration info" src="/images/header-help_new.gif" title="Component name does not include server name: <%=domain%>.
It should be configured like this: transport.server-name, e.g.: icq.<%=gateway%>">
<% } %>
</td>
<td>
<% if (gojaraAdminManager.isGatewayConfigured(gateway)) { %>
<img alt="Yes" src="/images/success-16x16.gif">
......
......@@ -8,6 +8,7 @@
import="org.jivesoftware.openfire.plugin.gojara.database.SessionEntry"%>
<%@ page
import="org.jivesoftware.openfire.plugin.gojara.utils.JspHelper"%>
<%@ page import="org.jivesoftware.openfire.XMPPServer" %>
<%@ page import="java.util.Map"%>
<%@ page import="java.util.Set"%>
<%@ page import="java.util.Date"%>
......@@ -36,7 +37,7 @@
<% if (!gojaraAdminManager.areGatewaysConfigured()) {%>
<h2 align="center"><a href="gojara-gatewayStatistics.jsp">Warning: Not all Gateways are configured for admin usage. This means unregistrations will not be properly executed.<br/>
Please configure admin_jid = gojaraadmin@yourdomain in Spectrum2 transport configuration.</a></h2>
Please configure admin_jid = gojaraadmin@<%= XMPPServer.getInstance().getServerInfo().getXMPPDomain() %> in Spectrum2 transport configuration.</a></h2>
<% } %>
<%
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment