Commit ff5546ab authored by Axel Brand's avatar Axel Brand Committed by daeva

Gojara

- show if transport is configured on Spectrum2 Stats page
- remove debug logging from info tab so it wont spam
- tweak presentation of stats shown in jsp through slighty bigger numbers

git-svn-id: http://svn.igniterealtime.org/svn/repos/openfire/trunk@13706 b35dd754-fafc-0310-a699-88a17e54d16e
parent 71627198
...@@ -313,9 +313,10 @@ public class DatabaseManager { ...@@ -313,9 +313,10 @@ public class DatabaseManager {
pstmt.setString(2, transport); pstmt.setString(2, transport);
pstmt.setLong(3, time); pstmt.setLong(3, time);
pstmt.executeUpdate(); pstmt.executeUpdate();
Log.info("I have inserted " + user + " with " + transport + " at " + time); Log.debug("I have inserted " + user + " with " + transport + " at " + time);
} else } else {
Log.info("I have updated " + user + " with " + transport + " at " + time); Log.debug("I have updated " + user + " with " + transport + " at " + time);
}
} catch (SQLException sqle) { } catch (SQLException sqle) {
Log.error(sqle); Log.error(sqle);
} finally { } finally {
......
...@@ -65,7 +65,7 @@ public class MainInterceptor implements PacketInterceptor { ...@@ -65,7 +65,7 @@ public class MainInterceptor implements PacketInterceptor {
} }
public boolean addTransport(String subDomain) { public boolean addTransport(String subDomain) {
Log.info("Trying to add " + subDomain + " to Set of watched Transports."); Log.info("Adding " + subDomain + " to watched Transports.");
boolean retval = this.activeTransports.add(subDomain); boolean retval = this.activeTransports.add(subDomain);
if (retval) { if (retval) {
tSessionManager.addTransport(subDomain); tSessionManager.addTransport(subDomain);
...@@ -76,7 +76,7 @@ public class MainInterceptor implements PacketInterceptor { ...@@ -76,7 +76,7 @@ public class MainInterceptor implements PacketInterceptor {
} }
public boolean removeTransport(String subDomain) { public boolean removeTransport(String subDomain) {
Log.info("Trying to remove " + subDomain + " from Set of watched Transports."); Log.info("Removing " + subDomain + " from watched Transports.");
tSessionManager.removeTransport(subDomain); tSessionManager.removeTransport(subDomain);
gojaraAdminmanager.gatewayUnregistered(subDomain); gojaraAdminmanager.gatewayUnregistered(subDomain);
return this.activeTransports.remove(subDomain); return this.activeTransports.remove(subDomain);
......
...@@ -26,7 +26,7 @@ public class GojaraAdminProcessor extends AbstractRemoteRosterProcessor { ...@@ -26,7 +26,7 @@ public class GojaraAdminProcessor extends AbstractRemoteRosterProcessor {
Message message = (Message) packet; Message message = (Message) packet;
// handle different commands // handle different commands
Log.info("Intercepted something: " + message.toString()); Log.debug("Intercepted spectrum message: " + message.toString());
String command = packet.getID(); String command = packet.getID();
if (command.equals("online_users")) { if (command.equals("online_users")) {
handleOnlineUsers(message, subdomain); handleOnlineUsers(message, subdomain);
...@@ -48,7 +48,7 @@ public class GojaraAdminProcessor extends AbstractRemoteRosterProcessor { ...@@ -48,7 +48,7 @@ public class GojaraAdminProcessor extends AbstractRemoteRosterProcessor {
} }
private void handleOnlineUsers(Message message, String subdomain) { private void handleOnlineUsers(Message message, String subdomain) {
Log.info("Found online_users command!"); Log.debug("Found online_users command!");
if (message.getBody().equals("0")) if (message.getBody().equals("0"))
return; return;
String[] content = message.getBody().split("\\r?\\n"); String[] content = message.getBody().split("\\r?\\n");
...@@ -59,7 +59,7 @@ public class GojaraAdminProcessor extends AbstractRemoteRosterProcessor { ...@@ -59,7 +59,7 @@ public class GojaraAdminProcessor extends AbstractRemoteRosterProcessor {
} }
private void handleUnregister(Message message) { private void handleUnregister(Message message) {
Log.info("Found unregister command! "); Log.debug("Found unregister command! ");
} }
private void handleConfigCheck(String subdomain) { private void handleConfigCheck(String subdomain) {
......
...@@ -85,7 +85,7 @@ public class GojaraAdminManager { ...@@ -85,7 +85,7 @@ public class GojaraAdminManager {
message.setBody("status"); message.setBody("status");
message.setType(Type.chat); message.setType(Type.chat);
router.route(message); router.route(message);
Log.info("Sent config_check Packet!"); Log.info("Checking for admin configuration on " + gateway);
} }
/** /**
...@@ -111,7 +111,7 @@ public class GojaraAdminManager { ...@@ -111,7 +111,7 @@ public class GojaraAdminManager {
public boolean areGatewaysConfigured() { public boolean areGatewaysConfigured() {
return unconfiguredGateways.isEmpty(); return unconfiguredGateways.isEmpty();
} }
public boolean isGatewayConfigured(String gateway) { public boolean isGatewayConfigured(String gateway) {
return configuredGateways.contains(gateway); return configuredGateways.contains(gateway);
} }
...@@ -147,7 +147,7 @@ public class GojaraAdminManager { ...@@ -147,7 +147,7 @@ public class GojaraAdminManager {
Message message = generateCommand(transport, "online_users"); Message message = generateCommand(transport, "online_users");
router.route(message); router.route(message);
Log.info("Sent online_users Packet!" + message.toString()); Log.debug("Sent online_users Packet!" + message.toString());
} }
/** /**
...@@ -163,7 +163,7 @@ public class GojaraAdminManager { ...@@ -163,7 +163,7 @@ public class GojaraAdminManager {
Message message = generateCommand(transport, "unregister"); Message message = generateCommand(transport, "unregister");
message.setBody("unregister " + _server.createJID(user, null).toString()); message.setBody("unregister " + _server.createJID(user, null).toString());
router.route(message); router.route(message);
Log.info("Sent Unregister Packet!" + message.toString()); Log.debug("Sent Unregister Packet!" + message.toString());
} }
......
...@@ -46,7 +46,7 @@ public class TransportSessionManager { ...@@ -46,7 +46,7 @@ public class TransportSessionManager {
*/ */
public void addTransport(String subdomain) { public void addTransport(String subdomain) {
transportSessions.put(subdomain, new ConcurrentHashMap<String, Long>(64, 0.75f, 1)); transportSessions.put(subdomain, new ConcurrentHashMap<String, Long>(64, 0.75f, 1));
Log.info("Added key to transportSessionMap: " + subdomain); Log.debug("Added key to transportSessionMap: " + subdomain);
} }
/** /**
...@@ -56,7 +56,7 @@ public class TransportSessionManager { ...@@ -56,7 +56,7 @@ public class TransportSessionManager {
*/ */
public void removeTransport(String subdomain) { public void removeTransport(String subdomain) {
Map<String, Long> disconnectedUsers = transportSessions.remove(subdomain); Map<String, Long> disconnectedUsers = transportSessions.remove(subdomain);
Log.info("Removed " + subdomain + "from TransportSessionMap " + disconnectedUsers.toString()); Log.debug("Removed " + subdomain + "from TransportSessionMap " + disconnectedUsers.toString());
} }
...@@ -94,7 +94,7 @@ public class TransportSessionManager { ...@@ -94,7 +94,7 @@ public class TransportSessionManager {
} }
public boolean disconnectUserFrom(String transport, String user) { public boolean disconnectUserFrom(String transport, String user) {
Log.info("Trying to remove User " + JID.nodeprep(user) + " from Session for Transport " + transport); // Log.debug("Trying to remove User " + JID.nodeprep(user) + " from Session for Transport " + transport);
if (isUserConnectedTo(transport, user)) { if (isUserConnectedTo(transport, user)) {
transportSessions.get(transport).remove(user); transportSessions.get(transport).remove(user);
return true; return true;
...@@ -137,7 +137,7 @@ public class TransportSessionManager { ...@@ -137,7 +137,7 @@ public class TransportSessionManager {
* transportSessions * transportSessions
*/ */
public void initializeSessions() { public void initializeSessions() {
Log.info("initializing Sessions."); Log.info("Initializing Sessions.");
for (String transport : transportSessions.keySet()) { for (String transport : transportSessions.keySet()) {
adminManager.getOnlineUsersOf(transport); adminManager.getOnlineUsersOf(transport);
} }
......
...@@ -57,14 +57,17 @@ ...@@ -57,14 +57,17 @@
%> %>
<center> <div align="center">
<% if (!gojaraAdminManager.areGatewaysConfigured()) {%> <% if (!gojaraAdminManager.areGatewaysConfigured()) {%>
<h2 style="color:red">Warning: Not all Gateways are configured for admin usage. This means unregistrations will not be properly executed.<br/> <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.</h2> Please configure admin_jid = gojaraadmin@yourdomain in Spectrum2 transport configuration.</a></h2>
<% } %> <% } %>
<h5>Logintime 1970 means User did register but never logged in, <h5>Logintime 1970 means User did register but never logged in,
propably because of invalid credentials.</h5> propably because of invalid credentials.</h5>
</center> <br>
<br>
Registrations total: <b style="font-size:150%"><%=transportManager.getNumberOfRegistrations()%></b><br>
</div>
<br> <br>
<% <%
//Here we do our nice query //Here we do our nice query
...@@ -89,7 +92,6 @@ ...@@ -89,7 +92,6 @@
next_items = numOfSessions; next_items = numOfSessions;
%> %>
<p> <p>
Registrations total: <b><%=transportManager.getNumberOfRegistrations()%></b><br>
<br> Pages: [ <br> Pages: [
<% <%
for (int i = 1; i <= numOfPages; i++) { for (int i = 1; i <= numOfPages; i++) {
...@@ -167,9 +169,9 @@ ...@@ -167,9 +169,9 @@
] ]
</p> </p>
<br> <br>
<center> <div align="center">
<input type="submit" value="Unregister"> <input type="submit" value="Unregister">
</center> </div>
</form> </form>
</body> </body>
</html> </html>
\ No newline at end of file
...@@ -36,14 +36,14 @@ ...@@ -36,14 +36,14 @@
<meta name="pageID" content="gojaraSessions" /> <meta name="pageID" content="gojaraSessions" />
</head> </head>
<body> <body>
<div align="center">
<% if (!gojaraAdminManager.areGatewaysConfigured()) {%> <% if (!gojaraAdminManager.areGatewaysConfigured()) {%>
<center><h2 style="color:red">Warning: Not all Gateways are configured for admin usage. This means session details may be inaccurate or not logged at all.<br/> <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.</h2></center><br/> Please configure admin_jid = gojaraadmin@yourdomain in Spectrum2 transport configuration.</a></h2><br/>
<% } %> <% } %>
<h4> <h4>
Current number of active Gateway Sessions: &emsp; Current number of active Gateway Sessions: &emsp;
<%=transportManager.getNumberOfActiveSessions()%> <b style="font-size:150%"><%= transportManager.getNumberOfActiveSessions() %></b>
</h4> </h4>
<br> <br>
<% <%
...@@ -51,10 +51,10 @@ ...@@ -51,10 +51,10 @@
for (String transport : sessions.keySet()) { for (String transport : sessions.keySet()) {
%> %>
<%=transport.substring(0, 10)%>... : <%=transport.substring(0, 10)%>... :
<b><%=sessions.get(transport).size()%></b> &emsp; <b style="font-size:150%"><%=sessions.get(transport).size()%></b> &emsp;
<% <%
} }
%> %></div>
<br> <br>
<br> <br>
<% <%
......
...@@ -19,13 +19,11 @@ ...@@ -19,13 +19,11 @@
<% <%
if (!gojaraAdminManager.areGatewaysConfigured()) { if (!gojaraAdminManager.areGatewaysConfigured()) {
%> %>
<center> <h2 style="color: red" align="center">
<h2 style="color: red">
Warning: Not all Gateways are configured for admin usage. Affected Warning: Not all Gateways are configured for admin usage. Affected
gateways will not show any data.<br /> Please configure admin_jid = gateways will not show spectrum2 data.<br /> Please configure admin_jid =
gojaraadmin@yourdomain in Spectrum2 transport configuration. gojaraadmin@yourdomain in Spectrum2 transport configuration.
</h2> </h2>
</center>
<hr /> <hr />
<% <%
} }
...@@ -37,13 +35,14 @@ ...@@ -37,13 +35,14 @@
<thead> <thead>
<tr> <tr>
<th nowrap>Name</th> <th nowrap>Name</th>
<th nowrap>Admin Configured?</th>
<th nowrap># Online Users</th> <th nowrap># Online Users</th>
<th nowrap># Registrations</th> <th nowrap># Registrations</th>
<th nowrap>Uptime</th> <th nowrap>Uptime</th>
<th nowrap># Messages received</th> <th nowrap># Messages received</th>
<th nowrap># Messages sent</th> <th nowrap># Messages sent</th>
<th nowrap>Used Memory</th> <th nowrap>Used Memory</th>
<th nowrap>Avg. Memory per User</th> <th nowrap>Avg. Mem. per User</th>
</tr> </tr>
</thead> </thead>
<tbody> <tbody>
...@@ -53,8 +52,15 @@ ...@@ -53,8 +52,15 @@
%> %>
<tr class="jive-odd"> <tr class="jive-odd">
<td><%=gateway %></td> <td><%=gateway %></td>
<td><%=transportSessionManager.getNumberOfActiveSessionsFor(gateway)%></td> <td>
<td><%=transportSessionManager.getNumberOfRegistrationsForTransport(gateway)%></td> <% if (gojaraAdminManager.isGatewayConfigured(gateway)) { %>
<img alt="Yes" src="/images/success-16x16.gif">
<% } else { %>
<img alt="No" src="/images/error-16x16.gif" title="Will probably not show correct # of online users and not do unregister properly.">
<% }%>
</td>
<td><div style="font-size:140%"><%=transportSessionManager.getNumberOfActiveSessionsFor(gateway)%></div></td>
<td><div style="font-size:140%"><%=transportSessionManager.getNumberOfRegistrationsForTransport(gateway)%></div></td>
<td><%=gojaraAdminManager.getStatisticsPresentationString(gateway, "uptime")%></td> <td><%=gojaraAdminManager.getStatisticsPresentationString(gateway, "uptime")%></td>
<td><%=gojaraAdminManager.getStatisticsPresentationString(gateway, "messages_from_xmpp")%></td> <td><%=gojaraAdminManager.getStatisticsPresentationString(gateway, "messages_from_xmpp")%></td>
<td><%=gojaraAdminManager.getStatisticsPresentationString(gateway, "messages_to_xmpp") %></td> <td><%=gojaraAdminManager.getStatisticsPresentationString(gateway, "messages_to_xmpp") %></td>
......
...@@ -33,9 +33,10 @@ ...@@ -33,9 +33,10 @@
</script> </script>
</head> </head>
<body> <body>
<% if (!gojaraAdminManager.areGatewaysConfigured()) {%> <% if (!gojaraAdminManager.areGatewaysConfigured()) {%>
<center><h2 style="color:red">Warning: Not all Gateways are configured for admin usage. This means unregistrations will not be properly executed.<br/> <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.</h2></center> Please configure admin_jid = gojaraadmin@yourdomain in Spectrum2 transport configuration.</a></h2>
<% } %> <% } %>
<% <%
...@@ -48,7 +49,7 @@ ...@@ -48,7 +49,7 @@
for (String key : unregister) { for (String key : unregister) {
%> %>
<%=transportManager.removeRegistrationOfUser(key, username)%><br> <div align="center"><%=transportManager.removeRegistrationOfUser(key, username)%></div><br>
<% <%
} }
%> %>
...@@ -60,15 +61,11 @@ ...@@ -60,15 +61,11 @@
ArrayList<GatewaySession> userconnections = transportManager.getConnectionsFor(username); ArrayList<GatewaySession> userconnections = transportManager.getConnectionsFor(username);
if (userconnections.isEmpty()) { if (userconnections.isEmpty()) {
%> %>
<h2> <h2 align="center">User has no active sessions</h2>
<center>User has no active sessions</center>
</h2>
<% <%
} else { } else {
%> %>
<center> <h1 align="center">Active Sessions:</h1>
<h1>Active Sessions:</h1>
</center>
<br> <br>
<div class="jive-table"> <div class="jive-table">
<table cellpadding="0" cellspacing="0" border="0" width="100%"> <table cellpadding="0" cellspacing="0" border="0" width="100%">
...@@ -99,9 +96,7 @@ ...@@ -99,9 +96,7 @@
<br> <br>
<hr> <hr>
<center> <h1 align="center">Associated Registrations:</h1>
<h1>Associated Registrations:</h1>
</center>
<br> <br>
<form name="unregister-form" id="gojara-sessDetailsUnregister" <form name="unregister-form" id="gojara-sessDetailsUnregister"
method="POST"> method="POST">
...@@ -156,15 +151,11 @@ ...@@ -156,15 +151,11 @@
</tbody> </tbody>
</table> </table>
</div> </div>
<div align="center"><br>
<input type="button" value="check/uncheck all" onclick='checkedAll();'>
<br> <br>
<center>
<input type="button" value="check/uncheck all"
onclick='checkedAll();'>
</center>
<br>
<center>
<input type="submit" value="Unregister"> <input type="submit" value="Unregister">
</center> </div>
</form> </form>
</body> </body>
</html> </html>
......
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